Add Russian translation provided by Валерий Крувялис <valkru@mail.ru>
[xiph-mirror.git] / ao / configure.ac
blob3646dcc3cbf16ce27d959c14fc27a9aa75a689ae
1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([libao],[1.2.2],[monty@xiph.org])
4 AM_INIT_AUTOMAKE([gnu 1.6])
6 AM_MAINTAINER_MODE
8 dnl $$$ben: Is that neccessary ? And why ?
9 AM_DISABLE_STATIC
11 dnl Library versioning
12 LIB_CURRENT=5
13 LIB_REVISION=1
14 LIB_AGE=1
15 AC_SUBST(LIB_CURRENT)
16 AC_SUBST(LIB_REVISION)
17 AC_SUBST(LIB_AGE)
19 dnl Plugin versioning.  We use an integer version number much like LIB_CURRENT.
20 PLUGIN_VERSION=4
22 AC_CANONICAL_BUILD
23 AC_CANONICAL_HOST
25 plugindir=$libdir/ao/plugins-$PLUGIN_VERSION
26 AC_SUBST(plugindir)
28 dnl ====================================
29 dnl Check for programs
30 dnl ====================================
32 cflags_save="$CFLAGS"
33 AC_PROG_CC
34 AC_LIBTOOL_WIN32_DLL
35 AC_LIBTOOL_DLOPEN
36 AM_PROG_LIBTOOL
38 dnl ====================================
39 dnl Check dlopen 
40 dnl ====================================
42 dnl Currently use this to disable plugin support dlfcn.h
43 AC_CHECK_HEADERS([dlfcn.h],
44         [AC_SEARCH_LIBS([dlopen],[dl],
45                 [AC_DEFINE([HAVE_DLOPEN],[1],
46                         [support dynamic linking loader])])])
48 dnl ====================================
49 dnl Set some general compile options
50 dnl ====================================
52 if test -z "$GCC"; then
53         case $host in
54         *-*-irix*)
55                 if test -z "$CC"; then
56                         CC=cc
57                 fi
58                 PLUGIN_LDFLAGS="-export-dynamic -avoid-version"
59                 DEBUG="-g -signed"
60                 CFLAGS="-O2 -w -signed"
61                 PROFILE="-p -g3 -O2 -signed" ;;
62         sparc-sun-solaris*)
63                 PLUGIN_LDFLAGS="-export-dynamic -avoid-version"
64                 DEBUG="-v -g"
65                 CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
66                 PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
67         *)
68                 PLUGIN_LDFLAGS="-export-dynamic -avoid-version"
69                 DEBUG="-g"
70                 CFLAGS="-O"
71                 PROFILE="-g -p" ;;
72         esac
73 else
75         case $host in
76         *-*-linux*)
77                 PLUGIN_LDFLAGS="-export-dynamic -avoid-version"
78                 DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
79                 CFLAGS="-O20 -ffast-math -D_REENTRANT -fsigned-char"
80                 PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
81         sparc-sun-*)
82                 PLUGIN_LDFLAGS="-export-dynamic -avoid-version"
83                 DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
84                 CFLAGS="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char"
85                 PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char" ;;
86         *-darwin*)
87                 PLUGIN_LDFLAGS="-module -avoid-version"
88                 DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
89                 CFLAGS="-D__NO_MATH_INLINES -fsigned-char"
90                 PROFILE="-g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
91         *)
92                 PLUGIN_LDFLAGS="-export-dynamic -avoid-version"
93                 DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
94                 CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char"
95                 PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
96         esac
98 CFLAGS="$CFLAGS $cflags_save -DAO_BUILDING_LIBAO"
99 DEBUG="$DEBUG $cflags_save -DAO_BUILDING_LIBAO"
100 PROFILE="$PROFILE $cflags_save -DAO_BUILDING_LIBAO"
102 AC_SUBST(DEBUG)
103 AC_SUBST(PROFILE)
105 dnl =========================================
106 dnl Need -no-undefined for building win32 dll
107 dnl =========================================
108 dnl Should we do that for cygwin too ???
109 dnl I guess so but it needs to be tested.
110 case $host in
111     *-mingw*|*-cygwin*)
112         LIBAO_LA_LDFLAGS="-no-undefined"
113         ;;
114     *)  
115         LIBAO_LA_LDFLAGS=""
116         ;;
117 esac
118 AC_SUBST(LIBAO_LA_LDFLAGS)
120 dnl ===================================
121 dnl Check for symbol versioning support
122 dnl ===================================
124 AC_MSG_CHECKING([if libraries can be versioned])
125 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
126 if test "$GLD"; then
127     have_ld_version_script=yes
128     AC_MSG_RESULT(yes)
129 else
130     have_ld_version_script=no
131     AC_MSG_RESULT(no)
133 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
135 dnl ==============================
136 dnl Check for libraries
137 dnl ==============================
139 # we link to libpthread just in case one of our plugins does
140 # in which case this is required to avoid problems on dlclose()
141 AC_CHECK_LIB(pthread, pthread_kill)
143 dnl ==============================
144 dnl Checks for header files
145 dnl ==============================
147 dnl ==============================
148 dnl Select proper plugin options
149 dnl ==============================
150 case $host in
151     *hpux*)
152         DLOPEN_FLAG='(RTLD_LAZY)'
153         SHARED_LIB_EXT='.sl'
154         ;;    
155     *openbsd* | *netbsd* | *solaris2.7 | *darwin*)
156         DLOPEN_FLAG='(RTLD_LAZY)'
157         SHARED_LIB_EXT='.so'
158         ;;
159     *)
160         DLOPEN_FLAG='(RTLD_NOW | RTLD_GLOBAL)'
161         SHARED_LIB_EXT='.so'
162         ;;
163 esac
164 AC_DEFINE_UNQUOTED(DLOPEN_FLAG, $DLOPEN_FLAG)
165 AC_DEFINE_UNQUOTED(SHARED_LIB_EXT, "$SHARED_LIB_EXT")
167 dnl ==============================
168 dnl Checks for types
169 dnl ==============================
171 AC_CHECK_SIZEOF(short)
172 AC_CHECK_SIZEOF(int)
173 AC_CHECK_SIZEOF(long)
175 case 2 in
176         $ac_cv_sizeof_short) SIZE16="short";;
177         $ac_cv_sizeof_int) SIZE16="int";;
178 esac
180 case 4 in
181         $ac_cv_sizeof_short) SIZE32="short";;
182         $ac_cv_sizeof_int) SIZE32="int";;
183         $ac_cv_sizeof_long) SIZE32="long";;
184 esac
186 if test -z "$SIZE16"; then
187         AC_MSG_ERROR(No 16 bit type found on this platform!)
189 if test -z "$SIZE32"; then
190         AC_MSG_ERROR(No 32 bit type found on this platform!)
193 AC_SUBST(SIZE16)
194 AC_SUBST(SIZE32)
196 dnl ======================================
197 dnl Disable default use of SLP in roar 
198 dnl until such time as SLP doesn't block
199 dnl indefinitely
200 dnl ======================================
202 use_slp="no"
203 AC_ARG_ENABLE([roar-default-slp],
204     [AS_HELP_STRING(
205         [--enable-roar-default-slp],
206         [allow Roar driver to use SLP in default search])],
207         [use_slp="$enableval"],[use_slp="no"]
209 if test "x$use_slp" != "xyes"; then
210    SLP_DEF="-DROAR_LIBROAR_CONFIG_WAS_NO_SLP"
212 AC_SUBST([SLP_DEF])
214 dnl ======================================
215 dnl Detect possible output devices 
216 dnl ======================================
218 dnl Check for WMM
220 [have_wmm="no"]
221 AC_ARG_ENABLE([wmm],
222     [AS_HELP_STRING(
223         [--enable-wmm],
224         [include WMM output plugin @<:@default=check@:>@])],
225         [],[enable_wmm="check"]
227 AS_IF([AC_LANG_SOURCE([test "x$enable_wmm" != "xno"],
228 [AC_CHECK_HEADERS([mmsystem.h],
229    [
230    AC_MSG_CHECKING([waveOut family functions])
231    waveout_old_LIBS="$LIBS"; LIBS="$LIBS -lwinmm"
232 dnl Can't use AC_SEARCH_LIBS because symbols are decorated
233    AC_LINK_IFELSE([
234 #include <windows.h>
235 #include <mmsystem.h>
236 int main(int na, char ** a) {
237     return waveOutOpen(0,0,0,0,0,0);
239 ])],[
240 have_wmm="yes";
241 AC_MSG_RESULT([yes])
242 AC_DEFINE([HAVE_WMM],[1],[Support Windows MultiMedia])
244 AC_MSG_RESULT([no])
245 LIBS="$waveout_old_LIBS"
247 ],[],[#include <windows.h>])])
248 AM_CONDITIONAL([HAVE_WMM],[test "x$have_wmm" = "xyes"])
249 AS_IF([test "x${have_wmm}" = "xyes"],[WMM_LIBS="-lwinmm"],[WMM_LIBS=""])
250 AC_SUBST([WMM_LIBS])
252 dnl Check for ESD
254 have_esd="no";
255 AC_ARG_ENABLE(esd, [  --enable-esd            include ESD output plugin ],
256 [ BUILD_ESD="$enableval" ],[ BUILD_ESD="yes" ])
258 if test "$BUILD_ESD" = "yes"; then
259   AM_PATH_ESD(0.2.8, have_esd=yes)
261 AM_CONDITIONAL(HAVE_ESD,test "x$have_esd" = xyes)
264 dnl Check for OSS
266 have_oss="no";
267 AC_CHECK_HEADERS(sys/soundcard.h, have_oss=yes)
268 AC_CHECK_HEADERS(machine/soundcard.h, have_oss=yes)
269 AM_CONDITIONAL(HAVE_OSS,test "${have_oss}" = "yes")
272 dnl Check for ALSA 0.9/1.0
273 have_alsa="no";
274 AC_ARG_ENABLE(alsa, [  --enable-alsa         include alsa 0.9/1.0 output plugin ],
275 [ BUILD_ALSA="$enableval" ],[ BUILD_ALSA="yes" ])
276 AC_ARG_ENABLE(alsa-mmap,
277    [  --enable-alsa-mmap          use mmio with alsa ],
278    [ BUILD_ALSAMMIO="$enableval" ],[ BUILD_ALSAMMIO="no" ])
280 if test "$BUILD_ALSA" = "yes"; then
281    AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no)
282    AC_CHECK_HEADER(alsa/asoundlib.h, , have_alsa=no)
283    if test "$BUILD_ALSAMMIO" = "yes" ; then
284       AC_CHECK_HEADER(sys/mman.h, have_alsammio=yes, have_alsammio=no)
285    fi
289 if test "x$have_alsa" = xyes; then
290         ALSA_LIBS="-lasound"
291         if test "x$have_alsammio" = xyes; then
292                 AC_DEFINE(USE_ALSA_MMIO)
293         fi
294 else
295         ALSA_LIBS=""
297 AM_CONDITIONAL(HAVE_ALSA,test "x$have_alsa" = xyes)
298 AC_SUBST(ALSA_LIBS)
300 dnl Decide whether we need to enable the workaround for broken OSS APIs
301 dnl such as the OSS emulation in ALSA.
303 AC_ARG_ENABLE(broken-oss, [  --enable-broken-oss           workaround for some OSS drivers (see README for details)],,
304 if test "x$have_alsa" = "xyes" -o "x$have_alsa" = "xyes"; then
305    enable_broken_oss="yes"
308 if test "x$enable_broken_oss" = "xyes"; then
309    AC_DEFINE(BROKEN_OSS)
310    AC_MSG_WARN(Broken OSS API workaround enabled.  See README for details.)
312    
313 dnl Check for Sun audio
315 have_sun="no";
316 AC_CHECK_HEADERS(sys/audioio.h, have_sun=yes)
317 AM_CONDITIONAL(HAVE_SUN_AUDIO,test "${have_sun}" = yes)
319 dnl Check for libsndio audio
321 have_sndio="no";
322 AC_CHECK_HEADERS(sndio.h, have_sndio=yes)
323 AM_CONDITIONAL(HAVE_SNDIO_AUDIO,test "${have_sndio}" = yes)
325 dnl Check for roaraudio
327 have_roar="no";
328 AC_CHECK_HEADERS(libroar/config.h, have_roar=yes)
329 if test "x$have_roar" = "xyes"; then
330    AC_MSG_CHECKING([if SLP lookup can be disabled in libroar])
331    AC_COMPILE_IFELSE([AC_LANG_SOURCE([
332 #include <libroar/config.h>
333 int main(int a, char **b) {
334 #ifdef ROAR_LIBROAR_CONFIG_WAS_NO_SLP
335        return 0;
336 #else
337         ROAR_LIBROAR_CONFIG_WAS_NO_SLP required
338 #endif
340      ],
341      [AC_MSG_RESULT([yes])],
342      [
343         AC_MSG_RESULT([no])
344         AC_MSG_RESULT([RoarAudio 0.4beta2 or later required to build Roar support])
345         have_roar="no"])])
347 AM_CONDITIONAL(HAVE_ROAR_AUDIO,test "${have_roar}" = yes)
349 dnl Check for AIX audio
351 have_aix="no";
352 case $host in
353     *-aix*)
354         AC_CHECK_HEADERS(sys/audio.h, have_aix=yes)
355         ;;
356 esac
357 AM_CONDITIONAL(HAVE_AIX_AUDIO,test "x$have_aix" = xyes)
359 dnl Check for aRts
361 AC_ARG_ENABLE(arts, [  --enable-arts           include aRts output plugin ],
362 [ BUILD_ARTS="$enableval" ],[ BUILD_ARTS="maybe" ])
364 dnl aRts support is whacked on OS X, so don't build it by default
365 if test "$BUILD_ARTS" = "maybe"; then
366   case $host in
367          *-darwin*)
368                  BUILD_ARTS=no;;
369          *)
370                  BUILD_ARTS=yes;;
371   esac
374 have_arts="no";
375 if test "$BUILD_ARTS" = "yes"; then
376   AC_PATH_PROG(ARTSC_CONFIG, artsc-config)
378   if test "x$ac_cv_path_ARTSC_CONFIG" != x
379   then
380         PKG_CHECK_MODULES(ARTSGLIB, glib-2.0 gthread-2.0)
381         ARTS_CFLAGS="`$ac_cv_path_ARTSC_CONFIG --cflags` $ARTSGLIB_CFLAGS"
382         ARTS_LIBS="`$ac_cv_path_ARTSC_CONFIG --libs` $ARTSGLIB_LIBS"
383         SAVELIBS=$LIBS
384         LIBS="$LIBS $ARTS_LIBS"
385         AC_CHECK_FUNCS(arts_suspended)
386         LIBS=$SAVELIBS
387         have_arts=yes
388   fi
390 AM_CONDITIONAL(HAVE_ARTS,test "x${have_arts}" = xyes)
392 AC_SUBST(ARTS_CFLAGS)
393 AC_SUBST(ARTS_LIBS)
396 dnl Check for IRIX
398 have_irix="no";
399 case $host in
400         *-*-irix*)
401                 AC_CHECK_LIB(audio, ALwritesamps, have_irix=yes, have_irix=no)
402         ;;
403 esac
404 AM_CONDITIONAL(HAVE_IRIX,test "x$have_irix" = xyes)
407 dnl Check for MacOS X
408 case $host in
409        *-darwin*)
410                have_macosx=yes;;
411        *)
412                have_macosx=no;;
413 esac
414 AM_CONDITIONAL(HAVE_MACOSX,test "x$have_macosx" = xyes)
417 dnl Check for NAS
419 AC_ARG_ENABLE(nas, [  --enable-nas            include NAS output plugin ],
420 [ BUILD_NAS="$enableval" ],[ BUILD_NAS="yes" ])
422 have_nas="no"
423 if test "$BUILD_NAS" = "yes"; then
424    AC_PATH_XTRA
425    AC_CHECK_LIB(Xau, XauFileName, have_nas=yes, have_nas=no, $X_LIBS)
426    AC_CHECK_LIB(audio, AuOpenServer, dummy="no-op", have_nas=no, -lXau $X_LIBS)
427    
428    ac_save_CPPFLAGS="$CPPFLAGS"
429    CPPFLAGS="$CPPFLAGS $X_CFLAGS"
430    AC_CHECK_HEADER(audio/audiolib.h, dummy="no-op", have_nas=no)
431    CPPFLAGS="$ac_save_CPPFLAGS"
434 AM_CONDITIONAL(HAVE_NAS,test "x$have_nas" = xyes)
436 if test "x$have_nas" = xyes; then
437         NAS_CFLAGS="$X_CFLAGS"
438         NAS_LIBS="-laudio -lXau $X_LIBS"
439 else
440         NAS_CFLAGS=""
441         NAS_LIBS=""
443 AC_SUBST(NAS_CFLAGS)
444 AC_SUBST(NAS_LIBS)
446 dnl Check for pulse
448 AC_ARG_ENABLE(pulse, [  --enable-pulse       include PulseAudio output plugin ],
449 [ BUILD_PULSE="$enableval" ],[ BUILD_PULSE="yes" ])
451 have_pulse="no";
452 if test "x$BUILD_PULSE" = "xyes" ; then
453     PKG_CHECK_MODULES(PULSE, [ libpulse-simple >= 0.9 ],
454         [have_pulse=yes],[have_pulse=no])
456 AC_SUBST(PULSE_LIBS)
458 AM_CONDITIONAL(HAVE_PULSE,test "x$have_pulse" = xyes)
460 dnl Orphaned driver.  We'll probably dump it soon.
461 AM_CONDITIONAL(HAVE_SOLARIS,test "x$have_solaris" = xyes)
463 dnl Plugins get special LDFLAGS
464 AC_SUBST(PLUGIN_LDFLAGS)
467 AC_OUTPUT([Makefile src/Makefile doc/Makefile include/Makefile include/ao/Makefile include/ao/os_types.h src/plugins/Makefile src/plugins/esd/Makefile src/plugins/oss/Makefile src/plugins/alsa/Makefile src/plugins/sun/Makefile src/plugins/irix/Makefile src/plugins/arts/Makefile src/plugins/macosx/Makefile src/plugins/nas/Makefile src/plugins/pulse/Makefile src/plugins/sndio/Makefile src/plugins/roar/Makefile ao.pc])
469 AS_AC_EXPAND(LIBDIR, ${libdir})
470 AS_AC_EXPAND(INCLUDEDIR, ${includedir})
471 AS_AC_EXPAND(BINDIR, ${bindir})
472 AS_AC_EXPAND(DOCDIR, ${docdir})
474 AC_MSG_RESULT([
475 ------------------------------------------------------------------------
476   $PACKAGE $VERSION:  Automatic configuration OK.
478   Backends to be built:
480     AU file output: .............. yes
481     RAW file output: ............. yes
482     WAV file output: ............. yes
484     AIX live output: ............. ${have_aix}
485     ALSA live output: ............ ${have_alsa}
486     ARTS live output: ............ ${have_arts}
487     ESD live output: ............. ${have_esd}
488     IRIX live output: ............ ${have_irix}
489     MACOSX live output: .......... ${have_macosx}
490     NAS live output: ............. ${have_nas}
491     NULL live output: ............ yes
492     OSS live output: ............. ${have_oss}
493     PULSE live output: ........... ${have_pulse}
494     ROAR live output: ............ ${have_roar}
495     SNDIO live output: ........... ${have_sndio}
496     SUN live output: ............. ${have_sun}
497     Windows WMM live output: ..... ${have_wmm}
499   Installation paths:
501     libao: ....................... ${LIBDIR}
502     C header files: .............. ${INCLUDEDIR}/ao
503     Documentation: ............... ${DOCDIR}
505   Building:
507     Type 'make' to compile $PACKAGE.
509     Type 'make install' to install $PACKAGE.
511 ------------------------------------------------------------------------