Cleanup
[framework/multimedia/alsa-scenario-0.2.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.59)
3 AC_INIT(src/ascenario.c)
4 dnl *************************************************
5 dnl current:revision:age
6 dnl change (without API) = c:r+1:a
7 dnl change API = c+1:0:a
8 dnl add API = c+1:0:a+1
9 dnl remove API = c+1:0:0
10 dnl *************************************************
11
12 # libtool versioning
13 ASCENARIO_MAJOR_VERSION=0
14 ASCENARIO_MINOR_VERSION=2
15 ASCENARIO_MICRO_VERSION=0
16 ASCENARIO_VERSION=$ASCENARIO_MAJOR_VERSION.$ASCENARIO_MINOR_VERSION.$ASCENARIO_MICRO_VERSION
17 AC_SUBST(ASCENARIO_MAJOR_VERSION)
18 AC_SUBST(ASCENARIO_MINOR_VERSION)
19 AC_SUBST(ASCENARIO_MICRO_VERSION)
20 AC_SUBST(ASCENARIO_VERSION)
21
22 LT_VERSION=$ASCENARIO_MICRO_VERSION
23 LT_RELEASE=$ASCENARIO_MAJOR_VERSION.$ASCENARIO_MINOR_VERSION
24 AC_SUBST(LT_VERSION)
25 AC_SUBST(LT_RELEASE)
26
27 AC_CANONICAL_SYSTEM
28 AM_INIT_AUTOMAKE(scenario-lib, $ASCENARIO_VERSION)
29 eval LIBTOOL_VERSION_INFO="2:0:0"
30 dnl *************************************************
31 AM_CONDITIONAL(INSTALL_M4, test -n "${ACLOCAL}")
32
33 # Test for new silent rules
34 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
35
36 AC_PREFIX_DEFAULT(/usr)
37
38 dnl Checks for programs.
39
40 dnl try to gues cross-compiler if not set
41 if test "x$target" != "x$host" -a -z "`echo $CC | grep -e '-gcc'`";
42 then
43   AC_MSG_CHECKING(for cross-compiler)
44
45   which ${program_prefix}gcc >/dev/null 2>&1 && CC=${program_prefix}gcc
46   which ${target_cpu}-${target_os}-gcc >/dev/null 2>&1 \
47   && CC=${target_cpu}-${target-os}-gcc
48   which ${target_cpu}-${target_vendor}-${target_os}-gcc >/dev/null 2>&1 \
49   && CC=${target_cpu}-${target_vendor}-${target_os}-gcc
50
51   AC_MSG_RESULT($CC)
52 fi
53
54 AC_PROG_CC
55 AC_PROG_CPP
56 AC_PROG_INSTALL
57 AC_PROG_LN_S
58 AC_DISABLE_STATIC
59 AC_LIBTOOL_DLOPEN
60 AM_PROG_LIBTOOL
61
62 dnl Checks for header files.
63 AC_HEADER_STDC
64 AM_CONFIG_HEADER(include/config.h)
65
66 dnl Checks for typedefs, structures, and compiler characteristics.
67 AC_C_CONST
68 AC_C_INLINE
69 AC_HEADER_TIME
70
71 SAVE_LIBRARY_VERSION
72 AC_SUBST(LIBTOOL_VERSION_INFO)
73
74 test "x$prefix" = xNONE && prefix=$ac_default_prefix
75
76 PKG_CHECK_MODULES(ALSA, alsa)
77
78 dnl ALSA configuration directory
79 AC_ARG_WITH(configdir,
80     AS_HELP_STRING([--with-configdir=dir],
81         [path where ALSA config files are stored]),
82     confdir="$withval", confdir="")
83 if test -z "$confdir"; then
84     eval dir="$datadir"
85     case "$dir" in
86     /*) ;;
87     *) dir="$prefix/share"
88     esac
89     confdir="$dir/alsa"
90 fi
91 ALSA_CONFIG_DIR="$confdir"
92 AC_DEFINE_UNQUOTED(ALSA_CONFIG_DIR, "$confdir", [directory containing ALSA configuration database])
93 AC_SUBST(ALSA_CONFIG_DIR)
94
95 dnl ALSA plugin directory
96 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
97
98 AC_ARG_WITH(plugindir,
99     AS_HELP_STRING([--with-plugindir=dir],
100         [path where ALSA plugin files are stored]),
101     plugindir="$withval", plugindir="")
102 if test -z "$plugindir"; then
103     eval dir="$libdir"
104     case "$dir" in
105     /*) ;;
106     *) dir="$dir"
107     esac
108     plugindir="$dir/$PACKAGE"
109 fi
110 AC_DEFINE_UNQUOTED(ALSA_PLUGIN_DIR, "$plugindir", [directory containing ALSA add-on modules])
111 ALSA_PLUGIN_DIR="$plugindir"
112 AC_SUBST(ALSA_PLUGIN_DIR)
113
114 dnl Check for versioned symbols
115 AC_MSG_CHECKING(for versioned symbols)
116 AC_ARG_WITH(versioned,
117   AS_HELP_STRING([--with-versioned],
118     [shared library will be compiled with versioned symbols (default = yes)]),
119   versioned="$withval", versioned="yes")
120 if test "$versioned" = "yes"; then
121   # it seems that GNU ld versions since 2.10 are not broken
122   xres=`grep '^VERSION=' libtool | cut -d = -f 2 | cut -d \" -f 2`
123   major=`echo $xres | cut -d . -f 1`
124   minor=`echo $xres | cut -d . -f 2`
125   pass=0
126   if test $major -eq 1 -a $minor -gt 3; then
127     pass=1
128   else
129     if test $major -gt 1; then
130       pass=1
131     fi
132   fi
133   if test $pass -eq 1; then
134     AC_DEFINE(VERSIONED_SYMBOLS,,[compiled with versioned symbols])
135     AC_MSG_RESULT(yes)
136   else
137     AC_MSG_RESULT(broken libtool - use libtool v1.4+; no versions)
138   fi
139 else
140   AC_MSG_RESULT(no)
141 fi
142 AM_CONDITIONAL(VERSIONED_SYMBOLS, test x$versioned = xyes)
143
144 dnl Check for symbolic-functions
145 AC_MSG_CHECKING(for symbolic-functions)
146 AC_ARG_ENABLE(symbolic-functions,
147   AS_HELP_STRING([--enable-symbolic-functions],
148     [use -Bsymbolic-functions option if available (optmization for size and speed)]),
149   symfuncs="$enableval", symfuncs="no")
150 if test "$symfuncs" = "yes"; then
151   if ld --help | grep -q -- '-Bsymbolic-functions'; then
152     AC_MSG_RESULT(yes)
153   else
154     AC_MSG_RESULT(not supported by ld)
155     symfuncs="no"
156   fi
157 else
158   AC_MSG_RESULT(no)
159 fi
160 AM_CONDITIONAL(SYMBOLIC_FUNCTIONS, test x"$symfuncs" = xyes)
161
162 dnl See if toolchain has a custom prefix for symbols ...
163 AC_MSG_CHECKING(for custom symbol prefixes)
164 SYMBOL_PREFIX=` \
165         echo "PREFIX=__USER_LABEL_PREFIX__" \
166                 | ${CPP-${CC-gcc} -E} - 2>&1 \
167                 | ${EGREP-grep} "^PREFIX=" \
168                 | ${SED-sed} "s:^PREFIX=::"`
169 AC_DEFINE_UNQUOTED([__SYMBOL_PREFIX], "$SYMBOL_PREFIX", [Toolchain Symbol Prefix])
170 AC_SUBST(SYMBOL_PREFIX)
171 AC_MSG_RESULT($SYMBOL_PREFIX)
172
173 dnl Check for debug...
174 AC_MSG_CHECKING(for debug)
175 AC_ARG_WITH(debug,
176   AS_HELP_STRING([--with-debug],
177     [library will be compiled with asserts (default = yes)]),
178   debug="$withval", debug="yes")
179 if test "$debug" = "yes"; then
180   AC_MSG_RESULT(yes)
181 else
182   AC_DEFINE(NDEBUG,,[No assert debug])
183   AC_MSG_RESULT(no)
184 fi
185
186 if test "$debug" = "yes"; then
187   AC_MSG_CHECKING(for debug assert)
188   AC_ARG_ENABLE(debug-assert,
189     AS_HELP_STRING([--enable-debug],
190       [enable assert call at the default error message handler]),
191     debug_assert="$enableval", debug_assert="no")
192   if test "$debug_assert" = "yes"; then
193     AC_MSG_RESULT(yes)
194     AC_DEFINE(ALSA_DEBUG_ASSERT,,[Enable assert at error message handler])
195   else
196     AC_MSG_RESULT(no)
197   fi
198 fi
199
200 AC_SUBST(ALSA_DEPLIBS)
201
202 dnl Check for architecture
203 AC_MSG_CHECKING(for architecture)
204 case "$target" in
205 i?86*)
206   AC_MSG_RESULT(x86)
207   ;;
208 x86_64*)
209   AC_MSG_RESULT(x86)
210   ;;
211 alpha*)
212   AC_MSG_RESULT(alpha)
213   ;;
214 powerpc*|ppc*)
215   AC_MSG_RESULT(ppc)
216   CPPFLAGS="$CPPFLAGS -D__ppc__"
217   ;;
218 ia64*)
219   AC_MSG_RESULT(ia64)
220   CPPFLAGS="$CPPFLAGS -D__ia64__"
221   ;;
222 mips*)
223   AC_MSG_RESULT(mips)
224   CPPFLAGS="$CPPFLAGS -D__mips__"
225   ;;
226 arm*)
227   AC_MSG_RESULT(arm)
228   CPPFLAGS="$CPPFLAGS -D__arm__"
229   ;;
230 *)
231   AC_MSG_RESULT($host_cpu)
232   echo "No atomic operations supported.."
233   ;;
234 esac
235
236 dnl Check for wordexp.h
237 AC_CHECK_HEADERS([wordexp.h])
238
239 dnl Make a symlink for inclusion of alsa/xxx.h
240 #if test ! -L "$srcdir"/include/alsa ; then
241 #  echo "Making a symlink include/alsa"
242 #  rm -f "$srcdir"/include/alsa
243 #  ln -sf . "$srcdir"/include/alsa
244 #fi
245
246 AC_OUTPUT(Makefile include/Makefile src/Makefile examples/Makefile pkgconfig/Makefile pkgconfig/libascenario.pc)