check for alsa-lib 1.0.18, now required
[jack.git] / configure.ac
blobda9fa78dc7f24c0e1f5c3b4a6994bb6499612880
1 dnl Process this file with autoconf to produce a configure script.
2 dnl $Id$
4 AC_INIT(jackd/jackd.c)
7 dnl
8 dnl Check for existing JACK installs
9 dnl 
11 AC_MSG_CHECKING([existing, conflicting JACK installs])
12 not_overwriting=0
13 installs=
14 for dir in /usr/lib /usr/local/lib /opt/lib ; do
15     if test -d $dir ; then
16         if test $(find $dir/ -name 'libjack.*' 2>/dev/null | wc -l) -gt 0 ; then
17             if echo $prefix/lib | grep -vs $dir >/dev/null 2>&1 ; then
18                 not_overwriting=$(expr $not_overwriting + 1)
19             fi
20             installs="$installs $dir"
21         fi          
22     fi
23 done
25 if test $not_overwriting -gt 0 ; then
26     echo 
27     echo
28     echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
29     echo "You appear to have at least one existing installation of JACK."
30     echo
31     echo "Complete or partial JACK installs exist in:$installs"
32     echo 
33     echo "Installing this version will leave at least one of these"
34     echo "existing installations installed and this will probably break"
35     echo "JACK on your machine. "
36     echo
37     echo "Before building, you should first remove the existing JACK"
38     echo "installation(s). "
39     echo
40     echo "Alternatively use ./configure --prefix=... to force overwriting"
41     echo "the existing install."
42     echo
43     echo "WARNING: ON ANY DEBIAN-DERIVED DISTRIBUTION (Debian, Ubuntu etc)"
44     echo "CHANGING THE INSTALLATION PREFIX WILL NOT PRODUCE A WORKING JACK"
45     echo "INSTALL. Please contact the distribution packager for JACK and"
46     echo "ask them to fix their packaging."
47     echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
48     exit 1
51 AC_CONFIG_AUX_DIR(config)
52 AC_CANONICAL_TARGET
54 dnl ---
55 dnl HOWTO: updating the JACK version number
56 dnl
57 dnl major version = ask on jackit-devel :)
58 dnl minor version = incremented when any of the public or internal
59 dnl                 interfaces are changed
60 dnl micro version = incremented when implementation-only
61 dnl                 changes are made
62 dnl ---
63 JACK_MAJOR_VERSION=0
64 JACK_MINOR_VERSION=118
65 JACK_MICRO_VERSION=0
67 dnl ---
68 dnl HOWTO: updating the jack protocol version
69 dnl
70 dnl increment the protocol version whenever a change is
71 dnl made to the way libjack communicates with jackd
72 dnl that would break applications statically linked with an older
73 dnl version of libjack. NOTE: statically linking to libjack
74 dnl is a huge mistake.
75 dnl ---
76 JACK_PROTOCOL_VERSION=24
78 dnl ---
79 dnl HOWTO: updating the libjack interface version
80 dnl
81 dnl current = incremented whenever the public libjack API is changed 
82 dnl revision = incremented when the libjack implementation is changed
83 dnl age = current libjack is both source and binary compatible with
84 dnl       libjack interfaces current,current-1,...,current-age
85 dnl
86 dnl Note! see libtool documentation for detailed documentation
87 dnl
88 dnl Note Also! until we reach CURRENT>=1, the rules are somewhat
89 dnl slacker than this, and closer to those for the JACK version
90 dnl number.
91 dnl ---
92 JACK_API_CURRENT=0
93 JACK_API_REVISION=28
94 JACK_API_AGE=0
96 AC_SUBST(JACK_MAJOR_VERSION)
97 AC_SUBST(JACK_MINOR_VERSION)
98 AC_SUBST(JACK_MICRO_VERSION)
100 AC_SUBST(JACK_PROTOCOL_VERSION)
101 AC_DEFINE_UNQUOTED(PROTOCOL_VERSION, "$JACK_PROTOCOL_VERSION", [Protocol version])
103 AC_SUBST(JACK_API_MAJOR_VERSION)
104 AC_SUBST(JACK_API_MINOR_VERSION)
105 AC_SUBST(JACK_API_MICRO_VERSION)
107 JACK_SO_VERSION=${JACK_API_CURRENT}:${JACK_API_REVISION}:${JACK_API_AGE}
109 JACK_VERSION=$JACK_MAJOR_VERSION.$JACK_MINOR_VERSION.${JACK_MICRO_VERSION}${BETA}
110 JACK_RELEASE=$JACK_MAJOR_VERSION-$JACK_MINOR_VERSION-${JACK_MICRO_VERSION}${BETA}
112 AC_SUBST(JACK_SO_VERSION)
113 AC_SUBST(JACK_VERSION)
114 AC_SUBST(JACK_RELEASE)
116 AM_INIT_AUTOMAKE(jack-audio-connection-kit,${JACK_VERSION})
119 dnl save any user-provided CFLAGS so we can forget
120 dnl about any nonsense that configure generates
121 dnl 
123 ORIGINAL_CFLAGS="$CFLAGS"
125 AM_CONFIG_HEADER(config.h)
126 AC_ENABLE_STATIC(no)
127 AC_ENABLE_SHARED(yes)
128 AC_PROG_CC
129 AC_PROG_CXX
130 AC_PROG_LD
131 AM_PROG_LIBTOOL
132 AC_PROG_LN_S
133 AM_PROG_CC_C_O
134 AC_C_BIGENDIAN
137 dnl now use those user-provided CFLAGS
138 dnl and dump whatever nonsense configure generated
139 dnl while looking for a compiler
142 CFLAGS="$ORIGINAL_CFLAGS"
144 AC_MSG_CHECKING([platform dependencies])
146 HOST_DEFAULT_TMP_DIR=/dev/shm
147 case "${host_os}" in
148   freebsd*)
149     # current FreeBSD header files conflict with the OSS driver's
150     # barrier code, this may be fixed in 5.3, stay tuned.
151     USE_BARRIER="no"
152     ;;
153   openbsd*)
154     # pthread_barrier* not implemented
155     USE_BARRIER="no"
156     # need small realtime stack
157     JACK_THREAD_STACK_TOUCH=10000
158     ;;
159   darwin*)
160     JACK_THREAD_STACK_TOUCH=10000       # need small realtime stack
161     JACK_CPP_VARARGS_BROKEN=1
162     JACK_DO_NOT_MLOCK=1
163     JACK_USE_MACH_THREADS=1
164     OS_LDFLAGS="-framework CoreAudio -framework CoreServices -framework AudioUnit"
165     TRY_POSIX_SHM=yes                   # POSIX shm works better
166     HOST_DEFAULT_TMP_DIR=/tmp
167     ;;
168 esac
170 AC_SUBST(OS_LDFLAGS)
173 # We need to establish suitable defaults for a 64-bit OS
174 libnn=lib
175 case "${host_os}" in
176     linux*)
177     case "${host_cpu}" in
178         x86_64|mips64|ppc64|sparc64|s390x)
179         libnn=lib64
180         ;;
181     esac
182     ;;
183     solaris*)
184     ## libnn=lib/sparcv9 ## on 64-bit only, but that's compiler-specific
185     ;;  
186 esac
188 ## take care not to  override the command-line setting
189 if test "${libdir}" = '${exec_prefix}/lib'; then
190   libdir='${exec_prefix}/'${libnn}
193 # system-dependent config.h values
194 test "x$JACK_THREAD_STACK_TOUCH" = "x" && JACK_THREAD_STACK_TOUCH=500000
195 AC_DEFINE_UNQUOTED(JACK_THREAD_STACK_TOUCH,
196         [$JACK_THREAD_STACK_TOUCH],
197         [Guaranteed size of realtime stack])
198 if test "x$JACK_CPP_VARARGS_BROKEN" != "x"; then
199     AC_DEFINE_UNQUOTED(JACK_CPP_VARARGS_BROKEN,
200         [$JACK_CPP_VARARGS_BROKEN],
201         [CPP has a broken varargs implementation])
203 if test "x$JACK_USE_MACH_THREADS" != "x"; then
204     AC_DEFINE_UNQUOTED(JACK_USE_MACH_THREADS,
205         [$JACK_USE_MACH_THREADS],
206         [Use MACH threads where possible])
209 # headers
210 AC_CHECK_HEADERS(string.h strings.h alloca.h)
211 AC_CHECK_HEADERS(getopt.h, [], [
212     for d in /Developer/SDKs/MacOSX10.3.0.sdk/usr/include/ ; do
213         AC_CHECK_HEADERS($d/getopt.h, [], [CFLAGS="$CFLAGS -I$d"])
214     done])
215 AC_CHECK_HEADER(/usr/include/nptl/pthread.h,
216         [CFLAGS="$CFLAGS -I/usr/include/nptl"])
218 # functions and libraries
219 AC_CHECK_FUNC(getopt_long, [],
220     AC_MSG_ERROR([*** JACK requires GNU getopt_long]))
221 AC_CHECK_FUNC(gethostent, [], AC_CHECK_LIB(nsl, gethostent))
222 AC_CHECK_FUNC(setsockopt, [], AC_CHECK_LIB(socket, setsockopt))
223 AC_CHECK_FUNC(connect, [], AC_CHECK_LIB(inet, connect))
224 AC_CHECK_FUNC(dlopen, [], 
225     AC_CHECK_LIB(dl, dlopen, [],
226         AC_MSG_ERROR([*** JACK requires dynamic load support])))
227 AC_CHECK_FUNC(pthread_create, [],
228     AC_CHECK_LIB(pthread, pthread_create, [],
229         AC_MSG_ERROR([*** JACK requires POSIX threads support])))
230 AC_CHECK_FUNCS(on_exit atexit)
231 AC_CHECK_FUNCS(posix_memalign)
232 AC_CHECK_LIB(m, sin)
234 echo -n "Checking for ppoll()... "
235 AC_EGREP_CPP( ppoll,
237 #define _GNU_SOURCE
238 #include <poll.h>
239 ], [
240         AC_DEFINE(HAVE_PPOLL,1,"Whether ppoll is available")
241         echo "yes"
242    ],[
243         AC_DEFINE(HAVE_PPOLL,0,"Whether ppoll is available")
244         echo "no"
245    ] )
247          
249 AC_CHECK_FUNC(clock_gettime, 
250        [
251            AC_DEFINE(HAVE_CLOCK_GETTIME,0,"Whether or not clock_gettime can be found in system libraries")
252        ], 
253        #
254        # if not found, check librt specifically
255        #
256        AC_CHECK_LIB(rt, clock_gettime, 
257            [
258               AC_DEFINE(HAVE_CLOCK_GETTIME,1,"Whether or not clock_gettime can be found in system libraries")
259               OS_LDFLAGS="$OS_LDFLAGS -lrt"
260            ])
261 )         
263 # should we use mlockall() on this platform?
264 if test "x$JACK_DO_NOT_MLOCK" = "x"; then
265     AC_CHECK_HEADER(sys/mman.h,
266         [AC_CHECK_FUNC(mlockall,
267             [AC_DEFINE(USE_MLOCK, 1, [Use POSIX memory locking])])])
270 # look for system support for POSIX shm API
271 AC_ARG_ENABLE(posix-shm,
272         AC_HELP_STRING([--enable-posix-shm], [use POSIX shm API (default=auto)]),
273         [TRY_POSIX_SHM=$enableval])
274 if test "x$TRY_POSIX_SHM" = "xyes"
275 then
276         AC_CHECK_FUNC(shm_open, [],
277                 AC_CHECK_LIB(rt, shm_open, [], [TRY_POSIX_SHM=no]))
279 AC_MSG_CHECKING([shared memory support])
280 if test "x$TRY_POSIX_SHM" = "xyes"
281 then
282         AC_MSG_RESULT([POSIX shm_open().])
283         AC_DEFINE(USE_POSIX_SHM,1,[Use POSIX shared memory interface])
284         JACK_SHM_TYPE='"POSIX"'
285         USE_POSIX_SHM="true"
286 else
287         AC_MSG_RESULT([System V shmget().])
288         JACK_SHM_TYPE='"System V"'
289         USE_POSIX_SHM="false"
291 AC_DEFINE_UNQUOTED(JACK_SHM_TYPE, [$JACK_SHM_TYPE],
292         [JACK shared memory type])
293 AM_CONDITIONAL(USE_POSIX_SHM, $USE_POSIX_SHM)
295 JACK_CORE_CFLAGS="-I\$(top_srcdir)/config -I\$(top_srcdir) \
296 -I\$(top_srcdir) -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -Wall"
298 JACK_LIBC_HELPER_FLAGS=
299 AC_ARG_ENABLE(ancient_libc,
300         AC_HELP_STRING([--enable-ancient-libc],[Add required CFLAGS for libc versions too old to expose PThread R/W Lock and other modern code]),
301         JACK_LIBC_HELPER_FLAGS="-D_XOPEN_SOURCE=600 -D_BSD_SOURCE",
302         JACK_LIBC_HELPER_FLAGS=""
303         )
304          
305 JACK_CORE_CFLAGS="$JACK_CORE_CFLAGS $JACK_LIBC_HELPER_FLAGS"   
307 AC_ARG_WITH(cpu-target,
308             [  --with-cpu-target=cpu-type    explicit, overriding argument for gcc -march= flag])
312 dnl figure out how best to optimize
313 dnl JOQ: this should be done via config/configure.hosts
316 dnl ----------------------------------------------------------------------
318 if test "$target_cpu" = "powerpc64" ; then
320     AC_ARG_ENABLE(cell,
321         AC_HELP_STRING([--enable-cell],[enable Cell BE support (default=no)]),,
322         [ enable_cell=no ])
324     if test "x$enable_cell" = xyes; then
325         AC_DEFINE(ENABLE_CELLBE, 1, [Define to 1 if you need support for the Cell BE.])
326     fi
330 if test "$target_cpu" = "powerpc" -o "$target_cpu" = "powerpc64" ; then
332     AC_DEFINE(POWERPC, 1, "Are we running a ppc CPU?")
333     
334 ############################
335 # Check for Altivec assembly
336 ############################
338     AC_ARG_ENABLE(altivec,
339         AC_HELP_STRING([--enable-altivec],[enable Altivec support (default=auto)]),,
340         [ enable_altivec=yes ])
341     
342     if test "x$enable_altivec" = xyes; then
343         
344         AC_MSG_CHECKING(whether we can compile Altivec code)
345         
346         AC_COMPILE_IFELSE([asm ("vand %v0, %v0, %v0");],
347             AC_DEFINE(USE_ALTIVEC, 1, [Define to 1 if Altivec assembly is available.])
348             AC_DEFINE(HAVE_ALTIVEC_LINUX, 1, "Is there Altivec Support ?")
349             ALTIVEC_OPT_FLAGS="-maltivec -mabi=altivec"
350             AC_MSG_RESULT(yes)
351             ,
352             enable_altivec=no
353             AC_MSG_RESULT(no)
354             AC_MSG_WARN([The assembler does not support the Altivec command set.])
355         )
356         
357     fi
359     dnl -mcpu=7450 does not reliably work with gcc 3.*
360     
361     JACK_OPT_CFLAGS="-O2 -mcpu=7400 $ALTIVEC_OPT_FLAGS -mhard-float -mpowerpc-gfxopt"
363     if test "$target_cpu" = "powerpc64"; then
364         JACK_OPT_CFLAGS="-O2 -mcpu=powerpc64 $ALTIVEC_OPT_FLAGS -mhard-float" 
365     fi
367 elif echo $target_cpu | egrep '(i.86|x86_64)' >/dev/null; then
369     dnl Check for MMX/SSE assembly
370     
371     if test -r /proc/cpuinfo ; then
372         procflags=`grep '^flags' /proc/cpuinfo`
373         if echo $procflags | grep -s mmx ; then
374             cpu_supports_mmx=yes
375         fi
376         if echo $procflags | grep -s sse ; then
377             cpu_supports_sse=yes
378         fi
379     else
380         # this is not linux, but assume that if the processor
381         # is x86 then is supports SSE and not MMX
382         cpu_supports_sse=yes
383         AC_MSG_WARN([Assuming your x86/x86_64 system can support SSE. Use --disable-sse if this is not the case])
384         cpu_supports_mmx=no
385         AC_MSG_WARN([Assuming your x86/x86_64 system does not need to use MMX. Use --enable-mmx if this is not the case])
386     fi
387     
388     AC_ARG_ENABLE(optimization-by-compiler,
389         AC_HELP_STRING([--enable-optimization-by-compiler],[use compiler (NOT processor) capabilities to determine optimization flags (default=no)]),
390         optimization_by_compiler=yes,
391         optimization_by_compiler=no
392     )
393     
394     AC_ARG_ENABLE(optimization-by-cpu,
395         AC_HELP_STRING([--enable-optimization-by-cpu],[use processor capabilities to determine optimization flags (default=yes)]),,
396         optimization_by_cpu=yes
397     )
398     
399     AC_ARG_ENABLE(mmx,
400         AC_HELP_STRING([--enable-mmx],[enable MMX support (default=auto)]),,
401         enable_mmx=yes)
402     
403     AC_ARG_ENABLE(sse,
404         AC_HELP_STRING([--enable-sse],[enable SSE support (default=auto)]),,
405         enable_sse=$enable_mmx)
406     
407     if test "x$enable_mmx" = xyes; then
408         
409         AC_MSG_CHECKING(whether we can compile MMX code)
410         
411         AC_COMPILE_IFELSE([asm ("movq 0, %mm0");],
412             
413             AC_DEFINE(USE_MMX, 1, [Define to 1 if MMX assembly is available.])
414             AC_MSG_RESULT(yes)
415             
416             if test x$optimization_by_cpu = xyes ; then
417                 if test x$cpu_supports_mmx = xyes ; then
418                     MMX_FLAGS="-mmmx"
419                 fi
420             else 
421                 MMX_FLAGS="-mmmx"
422             fi
423             
424             AC_MSG_RESULT(yes)
425             ,
426             enable_mmx=no
427             AC_MSG_RESULT(no)
428             AC_MSG_WARN([The assembler does not support the MMX command set.])
429         )
430     fi
432     if test "x$enable_sse" = xyes; then
433         
434         AC_MSG_CHECKING(whether we can compile SSE code)
435         
436         AC_COMPILE_IFELSE([asm ("movntps %xmm0, 0");],
437             [
438                 if test x$optimization_by_cpu = xyes ; then
439                     if test x$cpu_supports_sse = xyes ; then
440                         SSE_FLAGS="-msse -mfpmath=sse"
441                         MMX_FLAGS=""
442                     fi
443                 else 
444                     SSE_FLAGS="-msse -mfpmath=sse"
445                     MMX_FLAGS=""
446                 fi
447                 
448                 AC_MSG_RESULT(yes)
449                 ],
450             [
451                 enable_sse=no
452                 AC_MSG_RESULT(no)
453                 AC_MSG_WARN([The assembler does not support the SSE command set.]) 
454                 ])
455     fi
456     
457     AC_DEFINE(x86, 1, "Nope it's intel")
458     COMMON_X86_OPT_FLAGS="-O3 -fomit-frame-pointer -ffast-math -funroll-loops"
461 dnl its a little sad that OS X doesn't make it possible to identify 
462 dnl the target_cpu a little more precisely. on os x we always get "i386"
463 dnl as the CPU type. we miss out on some possible optimizations as 
464 dnl a result. oh well.
465 dnl     
466     
467     if test x$with_cpu_target != x ; then
468         JACK_OPT_CFLAGS="-march=$with_cpu_target"
469     else
470         if test "$target_cpu" = "i586"; then
471            JACK_OPT_CFLAGS="-march=i586 "
472         elif test "$target_cpu" = "i686"; then
473             JACK_OPT_CFLAGS="-march=i686"
474         elif test "$target_cpu" = "x86_64"; then
475             JACK_OPT_CFLAGS="-march=k8"
476         else
477             :
478         fi
479     fi
482 dnl do not add h/w specific flags if asked to let compiler
483 dnl to the optimization
484 dnl    
486     if test x$optimization_by_compiler != xyes ; then
487         JACK_OPT_CFLAGS="$COMMON_X86_OPT_FLAGS $JACK_OPT_CFLAGS $MMX_FLAGS $SSE_FLAGS"
488     else
489        JACK_OPT_CFLAGS="$COMMON_X86_OPT_FLAGS"
490     fi
494 AC_ARG_ENABLE(dynsimd,
495         AC_HELP_STRING([--enable-dynsimd],[enable dynamic SIMD selection (default=no)]),,
496     enable_dynsimd=no)
498 if test "x$enable_dynsimd" = xyes; then
499         AC_DEFINE(USE_DYNSIMD, 1, [Define to 1 to use dynamic SIMD selection.])
500         dnl This needs update once there's more than x86/x86-64 supported
501         SIMD_CFLAGS="-O -msse -msse2 -m3dnow"
502         AC_SUBST(SIMD_CFLAGS)
505 AC_ARG_ENABLE(optimize,
506     AC_HELP_STRING([--enable-optimize],
507         [optimize code, based on CPU or compiler, as separately selected (default=no)]),
508     [ if test x$enable_optimize != xno ; then
509         AC_MSG_WARN([optimization in use.........................])
510       else
511         # no optimization, so lets get debugging symbols instead
512         JACK_OPT_CFLAGS="-g"
513         AC_MSG_WARN([no optimization.........................])
514       fi 
515     ],
516     [
517         # no optimization, so lets get debugging symbols instead
518         JACK_OPT_CFLAGS="-g"
519         AC_MSG_WARN([no optimization.........................])
520     ]
523 JACK_CFLAGS="$JACK_CORE_CFLAGS $JACK_OPT_CFLAGS"
526 dnl most makefiles use JACK_CFLAGS, but simd code needs JACK_CORE_CFLAGS
529 AC_SUBST(JACK_CFLAGS)
530 AC_SUBST(JACK_CORE_CFLAGS)
533 dnl use JACK_CFLAGS for jackd compilation
534 dnl 
536 CFLAGS="$CFLAGS $JACK_CFLAGS"
538 # allow buffer resizing unless --disable-resize specified
539 buffer_resizing=yes
540 AC_ARG_ENABLE(resize,
541         AC_HELP_STRING([--enable-resize], [enable buffer resizing feature (default=yes)]),
542         [ 
543           if test x$enable_resize = xno ; then
544                 buffer_resizing=no
545           fi
546          ]
549 if test x$buffer_resizing != xno; then 
550    AC_DEFINE(DO_BUFFER_RESIZE,,[Enable buffer resizing])
554 AC_ARG_ENABLE(ensure-mlock,
555         AC_HELP_STRING([--enable-ensure-mlock], [server should fail if unable to lock memory (default=no)]),
556         [ 
557           if test x$enable_ensure_mlock != xno ; then
558                 AC_DEFINE(ENSURE_MLOCK,,[Ensure that memory locking succeeds])
559           fi
560         ]
563 AC_ARG_ENABLE(debug,
564         AC_HELP_STRING([--enable-debug],
565                 [enable debugging messages in jackd and libjack (default=no)]),
566         [ 
567           if test x$enable_debug != xno ; then
568              AC_DEFINE(DEBUG_ENABLED,,[Enable debugging messages])
569           fi
570         ]
573 AC_ARG_ENABLE(timestamps,
574         AC_HELP_STRING([--enable-timestamps],
575                 [allow clients to use the JACK timestamp API (JACK developers only) (default=no)]),
576         [ 
577           if test x$enable_timestamps != xno ; then
578                 AC_DEFINE(WITH_TIMESTAMPS,,[Enable JACK timestamp API])
579           fi
580         ]               
583 AC_ARG_ENABLE(preemption-check,
584         AC_HELP_STRING([--enable-preemption-check],
585                 [check for inappropriate realtime preemption (requires a specially built Linux kernel) (default=no)]),
586                 [
587                   if test x$enable_preemption_check != xno ; then
588                         echo checking for realtime preemption bugs
589                         AC_DEFINE(DO_PREEMPTION_CHECKING,,
590                                 [check realtime preemption])
591                   fi
592                 ])
594 USE_CAPABILITIES=false
596 AC_ARG_ENABLE(capabilities,
597         AC_HELP_STRING([--enable-capabilities],[!!! LINUX 2.4 KERNELS ONLY !!! use libcap to gain realtime scheduling priviledges]),
598               [ if test "x$enable_capabilities" != "xno" ; then
599                     AC_CHECK_LIB(cap, capgetp,
600                                  [AC_CHECK_HEADER(sys/capability.h,
601                                                   [HAVE_CAPABILITIES=true],
602                                                   [AC_MSG_WARN([*** no kernel support for capabilities])
603                                                    HAVE_CAPABILITIES=false]
604                                   )],
605                                  [AC_MSG_WARN([*** no libcap present])
606                                   HAVE_CAPABILITIES=false]
607                     )
608                     if test "x$HAVE_CAPABILITIES" = "xtrue"; then
609                         AC_CHECK_PROG(HAVE_CAPABILITIES, md5sum, true, false)
610                     fi
611                     if test "x$HAVE_CAPABILITIES" = "xfalse"; then
612                         AC_MSG_WARN([*** required program md5sum not found])
613                     fi
614                     if test "x$HAVE_CAPABILITIES" = "xfalse"; then
615                         AC_MSG_ERROR([*** Capabilities support not present. Run configure again without --enable-capabilities.])
616                     fi
617                     USE_CAPABILITIES=true
618                     AC_DEFINE(USE_CAPABILITIES,,[Enable POSIX 1.e capabilities support])
619                 fi
620               ]
623 with_oldtrans=yes
624 AC_ARG_ENABLE(oldtrans,
625         AC_HELP_STRING([--disable-oldtrans],[remove old transport interfaces (default=yes)]),
626               [ if test "x$enable_oldtrans" = "xno" ; then
627                     with_oldtrans=no
628                 fi 
629               ]
631 if test "x$with_oldtrans" != "xno" ; then
632         AC_DEFINE(OLD_TRANSPORT,,[Include old transport interfaces])
635 STRIPPED_JACKD=false
636 AC_ARG_ENABLE(stripped-jackd,
637         AC_HELP_STRING([--enable-stripped-jackd],[strip jack before computing its md5 sum (useful only with Linux 2.4 kernel)]),
638               [ if test "x$USE_CAPABILITIES" != "xtrue" ; then      
639                     AC_MSG_WARN([*** capabilities not enabled, stripped jackd has no effect])
640                 elif test "x$enable_stripped_jackd" != "xno"; then
641                     STRIPPED_JACKD=true             
642                 fi  
643               ] 
646 # plugins go in the addon dir.
648 ADDON_DIR='${libdir}/jack'
649 AC_SUBST(ADDON_DIR)
650 AS_AC_EXPAND(ADDON_DIR_EXPANDED,${libdir}/jack)
651 AC_DEFINE_UNQUOTED(ADDON_DIR,"$ADDON_DIR_EXPANDED",[Directory for plugins])
653 AC_ARG_WITH(html-dir,
654                 AC_HELP_STRING([--with-html-dir=PATH],[where to install the html documentation]))
656 if test "x$with_html_dir" = "x" ; then
657     HTML_DIR='${pkgdatadir}'
658 else
659     HTML_DIR=$with_html_dir
662 AC_SUBST(HTML_DIR)
665 # allow specifying default tmpdir
666 AC_ARG_WITH(default-tmpdir,
667             AC_HELP_STRING([--with-default-tmpdir],[where jackd and clients will put tmp files (default=/dev/shm)]))
669 if test "x$with_default_tmpdir" = "x" ; then
670         DEFAULT_TMP_DIR=$HOST_DEFAULT_TMP_DIR
671 else
672         DEFAULT_TMP_DIR=$with_default_tmpdir
675 AC_SUBST(DEFAULT_TMP_DIR)
676 AC_DEFINE_UNQUOTED(DEFAULT_TMP_DIR,"$DEFAULT_TMP_DIR",[Default tmp directory])
678 # Check for barrier functions in the pthreads library.  The default
679 # option setting may be OS-dependent, otherwise it's "yes".
680 test "x$USE_BARRIER" = "x" && USE_BARRIER="yes"
681 AC_ARG_WITH(barrier,
682         AC_HELP_STRING([--without-barrier],
683                        [avoid using pthread barrier functions (only used by OSS driver)]),
684         [ USE_BARRIER=$withval ])
685 if test "x$USE_BARRIER" = "xyes"; then
686         AC_CHECK_LIB([pthread], [pthread_barrier_init],
687                 AC_DEFINE(USE_BARRIER, 1, [Use pthread barrier functions]))
690 # some example-clients need libsndfile
691 HAVE_SNDFILE=false
692 PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0,[HAVE_SNDFILE=true], [true])
693 if test x$HAVE_SNDFILE = xfalse; then
694              AC_MSG_WARN([*** the jackrec example client will not be built])
697 # NetJack backend and internal client need libsamplerate
698 HAVE_SAMPLERATE=false
699 PKG_CHECK_MODULES(SAMPLERATE, samplerate >= 0.1.2,[HAVE_SAMPLERATE=true], [true])
700 if test x$HAVE_SAMPLERATE = xfalse; then
701         AC_MSG_WARN([*** the NetJack backend and internal client will not be built])
702         AC_DEFINE(HAVE_SAMPLERATE,0,"Whether libsamplerate is available")
703 else
704         NETJACK_CFLAGS="$NETJACK_CFLAGS $SAMPLERATE_CFLAGS"
705         NETJACK_LIBS="$NETJACK_LIBS $SAMPLERATE_LIBS"
706         AC_DEFINE(HAVE_SAMPLERATE,1,"Whether libsamplerate is available")
709 # Celt low-latency audio codec. netjack transmission via internet.
710 HAVE_CELT=false
711 PKG_CHECK_MODULES(CELT, celt >= 0.7.0,[HAVE_CELT=true], [true])
712 if test x$HAVE_CELT = xfalse; then
713         PKG_CHECK_MODULES(CELT, celt >= 0.5.0,[HAVE_CELT=true], [true])
714         if test x$HAVE_CELT = xfalse; then
715                 AC_DEFINE(HAVE_CELT,0,"Whether CELT is available")
716                 AC_MSG_RESULT(no)
717                 AC_MSG_WARN([*** NetJack will not be built with celt support])
718         else
719                 AC_DEFINE(HAVE_CELT,1,"Whether CELT is available")
720                 AC_DEFINE(HAVE_CELT_API_0_5,1,"Whether CELT API is 0.5 API")
721                 AC_DEFINE(HAVE_CELT_API_0_7,0,"Whether CELT API is 0.7 API")
722                 AC_MSG_RESULT(yes (0.5))
723                 NETJACK_LIBS="$NETJACK_LIBS $CELT_LIBS"
724         fi
725 else
726         AC_DEFINE(HAVE_CELT,1,"Whether CELT is available")
727         AC_MSG_RESULT(yes (0.7))
728         AC_DEFINE(HAVE_CELT_API_0_5,0,"Whether CELT API is 0.5 API")
729         AC_DEFINE(HAVE_CELT_API_0_7,1,"Whether CELT API is 0.7 API")
730         NETJACK_LIBS="$NETJACK_LIBS $CELT_LIBS"
733 AC_SUBST(NETJACK_LIBS)
734 AC_SUBST(NETJACK_CFLAGS)
736 # Note: A bug in pkg-config causes problems if the first occurence of
737 # PKG_CHECK_MODULES can be disabled. So, if you're going to use
738 # PKG_CHECK_MODULES inside a --disable-whatever check, you need to
739 # do it somewhere *below* this comment.
741 # Check which backend drivers can be built.  The last one successfully
742 # configured becomes the default JACK driver; so the order of
743 # precedence is: alsa, sun, oss, coreaudio, portaudio, dummy.
745 JACK_DEFAULT_DRIVER=\"dummy\"
747 AC_ARG_ENABLE(portaudio,
748         AC_HELP_STRING([--enable-portaudio],[build PortAudio driver]),
749    TRY_PORTAUDIO=$enableval , TRY_PORTAUDIO=no)
751 HAVE_PA="false"
752 if test "x$TRY_PORTAUDIO" = "xyes"
753 then
754         # check for portaudio V18
755         AC_CHECK_LIB(portaudio, Pa_Initialize,
756                 [ AC_CHECK_HEADERS(portaudio.h,
757                         [ HAVE_PA="true"
758                           PA_LIBS=-lportaudio
759                           JACK_DEFAULT_DRIVER=\"portaudio\"
760                         ])
761                 ])
762         AC_SUBST(PA_LIBS)
764 AM_CONDITIONAL(HAVE_PA, $HAVE_PA)
766 AC_ARG_ENABLE(coreaudio, AC_HELP_STRING([--disable-coreaudio], [ignore CoreAudio driver]),
767                         TRY_COREAUDIO=$enableval , TRY_COREAUDIO=yes )
768 HAVE_COREAUDIO="false"
769 if test "x$TRY_COREAUDIO" = "xyes"
770 then
771         # check for coreaudio
772         AC_CHECK_HEADERS(CoreAudio/CoreAudio.h,
773                 [ HAVE_COREAUDIO="true"
774                   JACK_DEFAULT_DRIVER=\"coreaudio\"
775                 ])
777 AM_CONDITIONAL(HAVE_COREAUDIO, $HAVE_COREAUDIO)
779 AC_ARG_ENABLE(oss, AC_HELP_STRING([--disable-oss],[ignore OSS driver ]),
780                         TRY_OSS=$enableval , TRY_OSS=yes ) 
781 HAVE_OSS="false"
782 if test "x$TRY_OSS" = "xyes"
783 then
784         # check for Open Sound System
785         AC_CHECK_HEADER([sys/soundcard.h],
786              [HAVE_OSS="true"
787               JACK_DEFAULT_DRIVER=\"oss\"])
789 AM_CONDITIONAL(HAVE_OSS, $HAVE_OSS)
791 AC_ARG_ENABLE(sun, AC_HELP_STRING([--disable-sun],[ignore Sun driver ]),
792                         TRY_SUN=$enableval , TRY_SUN=yes ) 
793 HAVE_SUN="false"
794 if test "x$TRY_SUN" = "xyes"
795 then
796         # check for Sun audio API
797         AC_CHECK_HEADER([sys/audioio.h],
798              [HAVE_SUN="true"
799               JACK_DEFAULT_DRIVER=\"sun\"])
801 AM_CONDITIONAL(HAVE_SUN, $HAVE_SUN)
803 AC_ARG_ENABLE(freebob, AC_HELP_STRING([--disable-freebob],[ignore FreeBob driver ]),
804                         TRY_FREEBOB=$enableval , TRY_FREEBOB=yes ) 
805 HAVE_FREEBOB="false"
806 if test "x$TRY_FREEBOB" = "xyes"
807 then
808         # check for FreeBob libraries
809         PKG_CHECK_MODULES(LIBFREEBOB, libfreebob >= 1.0.0,
810              [HAVE_FREEBOB="true"
811               JACK_DEFAULT_DRIVER=\"freebob\"
812              ], AC_MSG_RESULT([no]))
814         AC_SUBST([LIBFREEBOB_CFLAGS])
815         AC_SUBST([LIBFREEBOB_LIBS])
818 AM_CONDITIONAL(HAVE_FREEBOB,$HAVE_FREEBOB)
820 AC_ARG_ENABLE(firewire, AC_HELP_STRING([--disable-firewire],[ignore FireWire driver (FFADO)]),
821                         TRY_FIREWIRE=$enableval , TRY_FIREWIRE=yes ) 
822 HAVE_FIREWIRE="false"
823 if test "x$TRY_FIREWIRE" = "xyes"
824 then
825         # check for FFADO libraries
826         PKG_CHECK_MODULES(LIBFFADO, libffado >= 1.999.17,
827              [HAVE_FIREWIRE="true"
828               JACK_DEFAULT_DRIVER=\"firewire\"
829              ], AC_MSG_RESULT([no]))
831         AC_SUBST([LIBFFADO_CFLAGS])
832         AC_SUBST([LIBFFADO_LIBS])
835 AM_CONDITIONAL(HAVE_FIREWIRE,$HAVE_FIREWIRE)
837 AC_ARG_ENABLE(alsa, AC_HELP_STRING([--disable-alsa],[ignore ALSA driver ]),
838                         TRY_ALSA=$enableval , TRY_ALSA=yes ) 
839 HAVE_ALSA="false"
840 if test "x$TRY_ALSA" = "xyes"
841 then
842         # check for ALSA >= 1.0.18
843         PKG_CHECK_MODULES(ALSA, alsa >= 1.0.18,
844              [HAVE_ALSA="true"
845               ALSA_LIBS=-lasound
846               JACK_DEFAULT_DRIVER=\"alsa\"
847              ], AC_MSG_RESULT([no]), [-lm]
848         )
849         AC_SUBST(ALSA_LIBS)
851 AM_CONDITIONAL(HAVE_ALSA, $HAVE_ALSA)
853 HAVE_ALSA_MIDI=$HAVE_ALSA
854 AM_CONDITIONAL(HAVE_ALSA_MIDI, $HAVE_ALSA_MIDI)
856 if test "$JACK_DEFAULT_DRIVER" = \"dummy\"; then
857   AC_MSG_WARN([Only the dummy driver can be built])
859 AC_DEFINE_UNQUOTED(JACK_DEFAULT_DRIVER,
860         [$JACK_DEFAULT_DRIVER],
861         [Default JACK driver])
863 JACK_SEMAPHORE_KEY=0x282929
864 AC_DEFINE_UNQUOTED(JACK_SEMAPHORE_KEY,
865           [$JACK_SEMAPHORE_KEY],
866           [ an integer constant used as the semaphore and SysV SHM key. see libjack/shm.c for usage])
867 AC_SUBST(JACK_SEMAPHORE_KEY)
869 # On some systems, readline depends on termcap or ncurses.  But, the
870 # MacOSX linker complains bitterly if these libraries are explicitly
871 # referenced.  
873 # AC_CHECK_LIB() foolishly assumes that checking a library for an entry
874 # point always returns the same result regardless of any dependent
875 # libraries specified.  The `unset ac_cv_lib_readline_readline' erases
876 # the cached result to work around this problem.
877 READLINE_DEPS=""
878 HAVE_READLINE=true
879 AC_CHECK_LIB(readline, readline, [:],
880     [unset ac_cv_lib_readline_readline
881      AC_CHECK_LIB(readline, readline, [READLINE_DEPS="-ltermcap"],
882         [unset ac_cv_lib_readline_readline
883          AC_CHECK_LIB(readline, readline,
884             [READLINE_DEPS="-lncurses"], [HAVE_READLINE=false], "-lncurses")],
885         "-ltermcap")])
886 AC_CHECK_HEADER(readline/chardefs.h, [], [HAVE_READLINE=false])
887 if test x$HAVE_READLINE = xfalse; then
888         AC_MSG_WARN([*** the jack_transport example client will not be built])
890 AC_SUBST(READLINE_DEPS)
892 # you need doxygen to make dist.
893 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
894 if test $HAVE_DOXYGEN = "false"; then
895              AC_MSG_WARN([*** doxygen not found, docs will not be built])
898 AM_CONDITIONAL(HAVE_SNDFILE, $HAVE_SNDFILE)
899 AM_CONDITIONAL(HAVE_CELT, $HAVE_CELT)
900 AM_CONDITIONAL(HAVE_SAMPLERATE, $HAVE_SAMPLERATE)
901 AM_CONDITIONAL(HAVE_READLINE, $HAVE_READLINE)
902 AM_CONDITIONAL(HAVE_DOXYGEN, $HAVE_DOXYGEN)
903 AM_CONDITIONAL(USE_CAPABILITIES, $USE_CAPABILITIES)
904 AM_CONDITIONAL(STRIPPED_JACKD, $STRIPPED_JACKD)
905 AM_CONDITIONAL(HAVE_PPOLL, $HAVE_PPOLL)
907 AC_OUTPUT(
908 Makefile
909 config/Makefile
910 config/cpu/Makefile
911 config/cpu/alpha/Makefile
912 config/cpu/cris/Makefile
913 config/cpu/generic/Makefile
914 config/cpu/i386/Makefile
915 config/cpu/i486/Makefile
916 config/cpu/ia64/Makefile
917 config/cpu/m68k/Makefile
918 config/cpu/mips/Makefile
919 config/cpu/powerpc/Makefile
920 config/cpu/s390/Makefile
921 config/os/Makefile
922 config/os/generic/Makefile
923 config/os/gnu-linux/Makefile
924 config/os/macosx/Makefile
925 config/sysdeps/Makefile
926 doc/Makefile
927 doc/reference.doxygen
928 drivers/Makefile
929 drivers/alsa/Makefile
930 drivers/alsa-midi/Makefile
931 drivers/dummy/Makefile
932 drivers/oss/Makefile
933 drivers/sun/Makefile
934 drivers/portaudio/Makefile
935 drivers/coreaudio/Makefile
936 drivers/freebob/Makefile
937 drivers/firewire/Makefile
938 drivers/netjack/Makefile
939 example-clients/Makefile
940 tools/Makefile
941 man/Makefile
942 jack.pc
943 jack.spec
944 jack/Makefile
945 jack/version.h
946 jackd/Makefile
947 jackd/jackd.1
948 libjack/Makefile
952 dnl Output summary message
955 echo
956 echo $PACKAGE $VERSION :
957 echo
958 echo \| Build with ALSA support............................... : $HAVE_ALSA
959 echo \| Build with old FireWire \(FreeBob\) support............. : $HAVE_FREEBOB
960 echo \| Build with new FireWire \(FFADO\) support............... : $HAVE_FIREWIRE
961 echo \| Build with OSS support................................ : $HAVE_OSS
962 echo \| Build with Sun audio support.......................... : $HAVE_SUN
963 echo \| Build with CoreAudio support.......................... : $HAVE_COREAUDIO
964 echo \| Build with PortAudio support.......................... : $HAVE_PA
965 echo \| Build with Celt support............................... : $HAVE_CELT
966 echo \| Build with dynamic buffer size support................ : $buffer_resizing
967 echo \| Compiler optimization flags........................... : $JACK_OPT_CFLAGS
968 echo \| Compiler full flags................................... : $CFLAGS
969 echo \| Install dir for libjack + backends.................... : $libdir/jack
970 echo \|
971 echo \| Default driver backend................................ : $JACK_DEFAULT_DRIVER
972 echo \| Shared memory interface............................... : $JACK_SHM_TYPE
973 echo \| IPC Temporary directory............................... : $DEFAULT_TMP_DIR
974 echo \| Install prefix........................................ : $prefix
975 echo \| Default tmp dir....................................... : $DEFAULT_TMP_DIR
976 echo