make jitter val configurable... the connectscript will use this soon.
[jack.git] / configure.ac
blob8cb1f5e8b7c23a95d62baf9837677019a0ebefa4
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=117
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})
117 AM_MAINTAINER_MODE
120 dnl save any user-provided CFLAGS so we can forget
121 dnl about any nonsense that configure generates
122 dnl 
124 ORIGINAL_CFLAGS="$CFLAGS"
126 AM_CONFIG_HEADER(config.h)
127 AC_ENABLE_STATIC(no)
128 AC_ENABLE_SHARED(yes)
129 AC_PROG_CC
130 AC_PROG_CXX
131 AC_PROG_LD
132 AM_PROG_LIBTOOL
133 AC_PROG_LN_S
134 AM_PROG_CC_C_O
135 AC_C_BIGENDIAN
138 dnl now use those user-provided CFLAGS
139 dnl and dump whatever nonsense configure generated
140 dnl while looking for a compiler
143 CFLAGS="$ORIGINAL_CFLAGS"
145 AC_MSG_CHECKING([platform dependencies])
147 HOST_DEFAULT_TMP_DIR=/dev/shm
148 case "${host_os}" in
149   freebsd*)
150     # current FreeBSD header files conflict with the OSS driver's
151     # barrier code, this may be fixed in 5.3, stay tuned.
152     USE_BARRIER="no"
153     ;;
154   openbsd*)
155     # pthread_barrier* not implemented
156     USE_BARRIER="no"
157     # need small realtime stack
158     JACK_THREAD_STACK_TOUCH=10000
159     ;;
160   darwin*)
161     JACK_THREAD_STACK_TOUCH=10000       # need small realtime stack
162     JACK_CPP_VARARGS_BROKEN=1
163     JACK_DO_NOT_MLOCK=1
164     JACK_USE_MACH_THREADS=1
165     OS_LDFLAGS="-framework CoreAudio -framework CoreServices -framework AudioUnit"
166     TRY_POSIX_SHM=yes                   # POSIX shm works better
167     HOST_DEFAULT_TMP_DIR=/tmp
168     ;;
169 esac
171 AC_SUBST(OS_LDFLAGS)
174 # We need to establish suitable defaults for a 64-bit OS
175 libnn=lib
176 case "${host_os}" in
177     linux*)
178     case "${host_cpu}" in
179         x86_64|mips64|ppc64|sparc64|s390x)
180         libnn=lib64
181         ;;
182     esac
183     ;;
184     solaris*)
185     ## libnn=lib/sparcv9 ## on 64-bit only, but that's compiler-specific
186     ;;  
187 esac
189 ## take care not to  override the command-line setting
190 if test "${libdir}" = '${exec_prefix}/lib'; then
191   libdir='${exec_prefix}/'${libnn}
194 # system-dependent config.h values
195 test "x$JACK_THREAD_STACK_TOUCH" = "x" && JACK_THREAD_STACK_TOUCH=500000
196 AC_DEFINE_UNQUOTED(JACK_THREAD_STACK_TOUCH,
197         [$JACK_THREAD_STACK_TOUCH],
198         [Guaranteed size of realtime stack])
199 if test "x$JACK_CPP_VARARGS_BROKEN" != "x"; then
200     AC_DEFINE_UNQUOTED(JACK_CPP_VARARGS_BROKEN,
201         [$JACK_CPP_VARARGS_BROKEN],
202         [CPP has a broken varargs implementation])
204 if test "x$JACK_USE_MACH_THREADS" != "x"; then
205     AC_DEFINE_UNQUOTED(JACK_USE_MACH_THREADS,
206         [$JACK_USE_MACH_THREADS],
207         [Use MACH threads where possible])
210 # headers
211 AC_CHECK_HEADERS(string.h strings.h alloca.h)
212 AC_CHECK_HEADERS(getopt.h, [], [
213     for d in /Developer/SDKs/MacOSX10.3.0.sdk/usr/include/ ; do
214         AC_CHECK_HEADERS($d/getopt.h, [], [CFLAGS="$CFLAGS -I$d"])
215     done])
216 AC_CHECK_HEADER(/usr/include/nptl/pthread.h,
217         [CFLAGS="$CFLAGS -I/usr/include/nptl"])
219 # functions and libraries
220 AC_CHECK_FUNC(getopt_long, [],
221     AC_MSG_ERROR([*** JACK requires GNU getopt_long]))
222 AC_CHECK_FUNC(gethostent, [], AC_CHECK_LIB(nsl, gethostent))
223 AC_CHECK_FUNC(setsockopt, [], AC_CHECK_LIB(socket, setsockopt))
224 AC_CHECK_FUNC(connect, [], AC_CHECK_LIB(inet, connect))
225 AC_CHECK_FUNC(dlopen, [], 
226     AC_CHECK_LIB(dl, dlopen, [],
227         AC_MSG_ERROR([*** JACK requires dynamic load support])))
228 AC_CHECK_FUNC(pthread_create, [],
229     AC_CHECK_LIB(pthread, pthread_create, [],
230         AC_MSG_ERROR([*** JACK requires POSIX threads support])))
231 AC_CHECK_FUNCS(on_exit atexit)
232 AC_CHECK_FUNCS(posix_memalign)
233 AC_CHECK_LIB(m, sin)
235 echo -n "Checking for ppoll()... "
236 AC_EGREP_CPP( ppoll,
238 #define _GNU_SOURCE
239 #include <poll.h>
240 ], [
241         AC_DEFINE(HAVE_PPOLL,1,"Whether ppoll is available")
242         echo "yes"
243    ],[
244         AC_DEFINE(HAVE_PPOLL,0,"Whether ppoll is available")
245         echo "no"
246    ] )
248          
250 AC_CHECK_FUNC(clock_gettime, 
251        [
252            AC_DEFINE(HAVE_CLOCK_GETTIME,0,"Whether or not clock_gettime can be found in system libraries")
253        ], 
254        #
255        # if not found, check librt specifically
256        #
257        AC_CHECK_LIB(rt, clock_gettime, 
258            [
259               AC_DEFINE(HAVE_CLOCK_GETTIME,1,"Whether or not clock_gettime can be found in system libraries")
260               OS_LDFLAGS="$OS_LDFLAGS -lrt"
261            ])
262 )         
264 # should we use mlockall() on this platform?
265 if test "x$JACK_DO_NOT_MLOCK" = "x"; then
266     AC_CHECK_HEADER(sys/mman.h,
267         [AC_CHECK_FUNC(mlockall,
268             [AC_DEFINE(USE_MLOCK, 1, [Use POSIX memory locking])])])
271 # look for system support for POSIX shm API
272 AC_ARG_ENABLE(posix-shm,
273         AC_HELP_STRING([--enable-posix-shm], [use POSIX shm API (default=auto)]),
274         [TRY_POSIX_SHM=$enableval])
275 if test "x$TRY_POSIX_SHM" = "xyes"
276 then
277         AC_CHECK_FUNC(shm_open, [],
278                 AC_CHECK_LIB(rt, shm_open, [], [TRY_POSIX_SHM=no]))
280 AC_MSG_CHECKING([shared memory support])
281 if test "x$TRY_POSIX_SHM" = "xyes"
282 then
283         AC_MSG_RESULT([POSIX shm_open().])
284         AC_DEFINE(USE_POSIX_SHM,1,[Use POSIX shared memory interface])
285         JACK_SHM_TYPE='"POSIX"'
286         USE_POSIX_SHM="true"
287 else
288         AC_MSG_RESULT([System V shmget().])
289         JACK_SHM_TYPE='"System V"'
290         USE_POSIX_SHM="false"
292 AC_DEFINE_UNQUOTED(JACK_SHM_TYPE, [$JACK_SHM_TYPE],
293         [JACK shared memory type])
294 AM_CONDITIONAL(USE_POSIX_SHM, $USE_POSIX_SHM)
296 JACK_CORE_CFLAGS="-I\$(top_srcdir)/config -I\$(top_srcdir) \
297 -I\$(top_srcdir) -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -Wall"
299 JACK_LIBC_HELPER_FLAGS=
300 AC_ARG_ENABLE(ancient_libc,
301         AC_HELP_STRING([--enable-ancient-libc],[Add required CFLAGS for libc versions too old to expose PThread R/W Lock and other modern code]),
302         JACK_LIBC_HELPER_FLAGS="-D_XOPEN_SOURCE=600 -D_BSD_SOURCE",
303         JACK_LIBC_HELPER_FLAGS=""
304         )
305          
306 JACK_CORE_CFLAGS="$JACK_CORE_CFLAGS $JACK_LIBC_HELPER_FLAGS"   
308 AC_ARG_WITH(cpu-target,
309             [  --with-cpu-target=cpu-type    explicit, overriding argument for gcc -march= flag])
313 dnl figure out how best to optimize
314 dnl JOQ: this should be done via config/configure.hosts
317 dnl ----------------------------------------------------------------------
319 if test "$target_cpu" = "powerpc64" ; then
321     AC_ARG_ENABLE(cell,
322         AC_HELP_STRING([--enable-cell],[enable Cell BE support (default=no)]),,
323         [ enable_cell=no ])
325     if test "x$enable_cell" = xyes; then
326         AC_DEFINE(ENABLE_CELLBE, 1, [Define to 1 if you need support for the Cell BE.])
327     fi
331 if test "$target_cpu" = "powerpc" -o "$target_cpu" = "powerpc64" ; then
333     AC_DEFINE(POWERPC, 1, "Are we running a ppc CPU?")
334     
335 ############################
336 # Check for Altivec assembly
337 ############################
339     AC_ARG_ENABLE(altivec,
340         AC_HELP_STRING([--enable-altivec],[enable Altivec support (default=auto)]),,
341         [ enable_altivec=yes ])
342     
343     if test "x$enable_altivec" = xyes; then
344         
345         AC_MSG_CHECKING(whether we can compile Altivec code)
346         
347         AC_COMPILE_IFELSE([asm ("vand %v0, %v0, %v0");],
348             AC_DEFINE(USE_ALTIVEC, 1, [Define to 1 if Altivec assembly is available.])
349             AC_DEFINE(HAVE_ALTIVEC_LINUX, 1, "Is there Altivec Support ?")
350             ALTIVEC_OPT_FLAGS="-maltivec -mabi=altivec"
351             AC_MSG_RESULT(yes)
352             ,
353             enable_altivec=no
354             AC_MSG_RESULT(no)
355             AC_MSG_WARN([The assembler does not support the Altivec command set.])
356         )
357         
358     fi
360     dnl -mcpu=7450 does not reliably work with gcc 3.*
361     
362     JACK_OPT_CFLAGS="-O2 -mcpu=7400 $ALTIVEC_OPT_FLAGS -mhard-float -mpowerpc-gfxopt"
364     if test "$target_cpu" = "powerpc64"; then
365         JACK_OPT_CFLAGS="-O2 -mcpu=powerpc64 $ALTIVEC_OPT_FLAGS -mhard-float" 
366     fi
368 elif echo $target_cpu | egrep '(i.86|x86_64)' >/dev/null; then
370     dnl Check for MMX/SSE assembly
371     
372     if test -r /proc/cpuinfo ; then
373         procflags=`grep '^flags' /proc/cpuinfo`
374         if echo $procflags | grep -s mmx ; then
375             cpu_supports_mmx=yes
376         fi
377         if echo $procflags | grep -s sse ; then
378             cpu_supports_sse=yes
379         fi
380     else
381         # this is not linux, but assume that if the processor
382         # is x86 then is supports SSE and not MMX
383         cpu_supports_sse=yes
384         AC_MSG_WARN([Assuming your x86/x86_64 system can support SSE. Use --disable-sse if this is not the case])
385         cpu_supports_mmx=no
386         AC_MSG_WARN([Assuming your x86/x86_64 system does not need to use MMX. Use --enable-mmx if this is not the case])
387     fi
388     
389     AC_ARG_ENABLE(optimization-by-compiler,
390         AC_HELP_STRING([--enable-optimization-by-compiler],[use compiler (NOT processor) capabilities to determine optimization flags (default=no)]),
391         optimization_by_compiler=yes,
392         optimization_by_compiler=no
393     )
394     
395     AC_ARG_ENABLE(optimization-by-cpu,
396         AC_HELP_STRING([--enable-optimization-by-cpu],[use processor capabilities to determine optimization flags (default=yes)]),,
397         optimization_by_cpu=yes
398     )
399     
400     AC_ARG_ENABLE(mmx,
401         AC_HELP_STRING([--enable-mmx],[enable MMX support (default=auto)]),,
402         enable_mmx=yes)
403     
404     AC_ARG_ENABLE(sse,
405         AC_HELP_STRING([--enable-sse],[enable SSE support (default=auto)]),,
406         enable_sse=$enable_mmx)
407     
408     if test "x$enable_mmx" = xyes; then
409         
410         AC_MSG_CHECKING(whether we can compile MMX code)
411         
412         AC_COMPILE_IFELSE([asm ("movq 0, %mm0");],
413             
414             AC_DEFINE(USE_MMX, 1, [Define to 1 if MMX assembly is available.])
415             AC_MSG_RESULT(yes)
416             
417             if test x$optimization_by_cpu = xyes ; then
418                 if test x$cpu_supports_mmx = xyes ; then
419                     MMX_FLAGS="-mmmx"
420                 fi
421             else 
422                 MMX_FLAGS="-mmmx"
423             fi
424             
425             AC_MSG_RESULT(yes)
426             ,
427             enable_mmx=no
428             AC_MSG_RESULT(no)
429             AC_MSG_WARN([The assembler does not support the MMX command set.])
430         )
431     fi
433     if test "x$enable_sse" = xyes; then
434         
435         AC_MSG_CHECKING(whether we can compile SSE code)
436         
437         AC_COMPILE_IFELSE([asm ("movntps %xmm0, 0");],
438             [
439                 if test x$optimization_by_cpu = xyes ; then
440                     if test x$cpu_supports_sse = xyes ; then
441                         SSE_FLAGS="-msse -mfpmath=sse"
442                         MMX_FLAGS=""
443                     fi
444                 else 
445                     SSE_FLAGS="-msse -mfpmath=sse"
446                     MMX_FLAGS=""
447                 fi
448                 
449                 AC_MSG_RESULT(yes)
450                 ],
451             [
452                 enable_sse=no
453                 AC_MSG_RESULT(no)
454                 AC_MSG_WARN([The assembler does not support the SSE command set.]) 
455                 ])
456     fi
457     
458     AC_DEFINE(x86, 1, "Nope it's intel")
459     COMMON_X86_OPT_FLAGS="-O3 -fomit-frame-pointer -ffast-math -funroll-loops"
462 dnl its a little sad that OS X doesn't make it possible to identify 
463 dnl the target_cpu a little more precisely. on os x we always get "i386"
464 dnl as the CPU type. we miss out on some possible optimizations as 
465 dnl a result. oh well.
466 dnl     
467     
468     if test x$with_cpu_target != x ; then
469         JACK_OPT_CFLAGS="-march=$with_cpu_target"
470     else
471         if test "$target_cpu" = "i586"; then
472            JACK_OPT_CFLAGS="-march=i586 "
473         elif test "$target_cpu" = "i686"; then
474             JACK_OPT_CFLAGS="-march=i686"
475         elif test "$target_cpu" = "x86_64"; then
476             JACK_OPT_CFLAGS="-march=k8"
477         else
478             :
479         fi
480     fi
483 dnl do not add h/w specific flags if asked to let compiler
484 dnl to the optimization
485 dnl    
487     if test x$optimization_by_compiler != xyes ; then
488         JACK_OPT_CFLAGS="$COMMON_X86_OPT_FLAGS $JACK_OPT_CFLAGS $MMX_FLAGS $SSE_FLAGS"
489     else
490        JACK_OPT_CFLAGS="$COMMON_X86_OPT_FLAGS"
491     fi
495 AC_ARG_ENABLE(dynsimd,
496         AC_HELP_STRING([--enable-dynsimd],[enable dynamic SIMD selection (default=no)]),,
497     enable_dynsimd=no)
499 if test "x$enable_dynsimd" = xyes; then
500         AC_DEFINE(USE_DYNSIMD, 1, [Define to 1 to use dynamic SIMD selection.])
501         dnl This needs update once there's more than x86/x86-64 supported
502         SIMD_CFLAGS="-O -msse -msse2 -m3dnow"
503         AC_SUBST(SIMD_CFLAGS)
506 AC_ARG_ENABLE(optimize,
507     AC_HELP_STRING([--enable-optimize],
508         [optimize code, based on CPU or compiler, as separately selected (default=no)]),
509     [ if test x$enable_optimize != xno ; then
510         AC_MSG_WARN([optimization in use.........................])
511       else
512         # no optimization, so lets get debugging symbols instead
513         JACK_OPT_CFLAGS="-g"
514         AC_MSG_WARN([no optimization.........................])
515       fi 
516     ],
517     [
518         # no optimization, so lets get debugging symbols instead
519         JACK_OPT_CFLAGS="-g"
520         AC_MSG_WARN([no optimization.........................])
521     ]
524 JACK_CFLAGS="$JACK_CORE_CFLAGS $JACK_OPT_CFLAGS"
527 dnl most makefiles use JACK_CFLAGS, but simd code needs JACK_CORE_CFLAGS
530 AC_SUBST(JACK_CFLAGS)
531 AC_SUBST(JACK_CORE_CFLAGS)
534 dnl use JACK_CFLAGS for jackd compilation
535 dnl 
537 CFLAGS="$CFLAGS $JACK_CFLAGS"
539 # allow buffer resizing unless --disable-resize specified
540 buffer_resizing=yes
541 AC_ARG_ENABLE(resize,
542         AC_HELP_STRING([--enable-resize], [enable buffer resizing feature (default=yes)]),
543         [ 
544           if test x$enable_resize = xno ; then
545                 buffer_resizing=no
546           fi
547          ]
550 if test x$buffer_resizing != xno; then 
551    AC_DEFINE(DO_BUFFER_RESIZE,,[Enable buffer resizing])
555 AC_ARG_ENABLE(ensure-mlock,
556         AC_HELP_STRING([--enable-ensure-mlock], [server should fail if unable to lock memory (default=no)]),
557         [ 
558           if test x$enable_ensure_mlock != xno ; then
559                 AC_DEFINE(ENSURE_MLOCK,,[Ensure that memory locking succeeds])
560           fi
561         ]
564 AC_ARG_ENABLE(debug,
565         AC_HELP_STRING([--enable-debug],
566                 [enable debugging messages in jackd and libjack (default=no)]),
567         [ 
568           if test x$enable_debug != xno ; then
569              AC_DEFINE(DEBUG_ENABLED,,[Enable debugging messages])
570           fi
571         ]
574 AC_ARG_ENABLE(timestamps,
575         AC_HELP_STRING([--enable-timestamps],
576                 [allow clients to use the JACK timestamp API (JACK developers only) (default=no)]),
577         [ 
578           if test x$enable_timestamps != xno ; then
579                 AC_DEFINE(WITH_TIMESTAMPS,,[Enable JACK timestamp API])
580           fi
581         ]               
584 AC_ARG_ENABLE(preemption-check,
585         AC_HELP_STRING([--enable-preemption-check],
586                 [check for inappropriate realtime preemption (requires a specially built Linux kernel) (default=no)]),
587                 [
588                   if test x$enable_preemption_check != xno ; then
589                         echo checking for realtime preemption bugs
590                         AC_DEFINE(DO_PREEMPTION_CHECKING,,
591                                 [check realtime preemption])
592                   fi
593                 ])
595 USE_CAPABILITIES=false
597 AC_ARG_ENABLE(capabilities,
598         AC_HELP_STRING([--enable-capabilities],[!!! LINUX 2.4 KERNELS ONLY !!! use libcap to gain realtime scheduling priviledges]),
599               [ if test "x$enable_capabilities" != "xno" ; then
600                     AC_CHECK_LIB(cap, capgetp,
601                                  [AC_CHECK_HEADER(sys/capability.h,
602                                                   [HAVE_CAPABILITIES=true],
603                                                   [AC_MSG_WARN([*** no kernel support for capabilities])
604                                                    HAVE_CAPABILITIES=false]
605                                   )],
606                                  [AC_MSG_WARN([*** no libcap present])
607                                   HAVE_CAPABILITIES=false]
608                     )
609                     if test "x$HAVE_CAPABILITIES" = "xtrue"; then
610                         AC_CHECK_PROG(HAVE_CAPABILITIES, md5sum, true, false)
611                     fi
612                     if test "x$HAVE_CAPABILITIES" = "xfalse"; then
613                         AC_MSG_WARN([*** required program md5sum not found])
614                     fi
615                     if test "x$HAVE_CAPABILITIES" = "xfalse"; then
616                         AC_MSG_ERROR([*** Capabilities support not present. Run configure again without --enable-capabilities.])
617                     fi
618                     USE_CAPABILITIES=true
619                     AC_DEFINE(USE_CAPABILITIES,,[Enable POSIX 1.e capabilities support])
620                 fi
621               ]
624 with_oldtrans=yes
625 AC_ARG_ENABLE(oldtrans,
626         AC_HELP_STRING([--disable-oldtrans],[remove old transport interfaces (default=yes)]),
627               [ if test "x$enable_oldtrans" = "xno" ; then
628                     with_oldtrans=no
629                 fi 
630               ]
632 if test "x$with_oldtrans" != "xno" ; then
633         AC_DEFINE(OLD_TRANSPORT,,[Include old transport interfaces])
636 STRIPPED_JACKD=false
637 AC_ARG_ENABLE(stripped-jackd,
638         AC_HELP_STRING([--enable-stripped-jackd],[strip jack before computing its md5 sum (useful only with Linux 2.4 kernel)]),
639               [ if test "x$USE_CAPABILITIES" != "xtrue" ; then      
640                     AC_MSG_WARN([*** capabilities not enabled, stripped jackd has no effect])
641                 elif test "x$enable_stripped_jackd" != "xno"; then
642                     STRIPPED_JACKD=true             
643                 fi  
644               ] 
647 # plugins go in the addon dir.
649 ADDON_DIR='${libdir}/jack'
650 AC_SUBST(ADDON_DIR)
651 AS_AC_EXPAND(ADDON_DIR_EXPANDED,${libdir}/jack)
652 AC_DEFINE_UNQUOTED(ADDON_DIR,"$ADDON_DIR_EXPANDED",[Directory for plugins])
654 AC_ARG_WITH(html-dir,
655                 AC_HELP_STRING([--with-html-dir=PATH],[where to install the html documentation]))
657 if test "x$with_html_dir" = "x" ; then
658     HTML_DIR='${pkgdatadir}'
659 else
660     HTML_DIR=$with_html_dir
663 AC_SUBST(HTML_DIR)
666 # allow specifying default tmpdir
667 AC_ARG_WITH(default-tmpdir,
668             AC_HELP_STRING([--with-default-tmpdir],[where jackd and clients will put tmp files (default=/dev/shm)]))
670 if test "x$with_default_tmpdir" = "x" ; then
671         DEFAULT_TMP_DIR=$HOST_DEFAULT_TMP_DIR
672 else
673         DEFAULT_TMP_DIR=$with_default_tmpdir
676 AC_SUBST(DEFAULT_TMP_DIR)
677 AC_DEFINE_UNQUOTED(DEFAULT_TMP_DIR,"$DEFAULT_TMP_DIR",[Default tmp directory])
679 # Check for barrier functions in the pthreads library.  The default
680 # option setting may be OS-dependent, otherwise it's "yes".
681 test "x$USE_BARRIER" = "x" && USE_BARRIER="yes"
682 AC_ARG_WITH(barrier,
683         AC_HELP_STRING([--without-barrier],
684                        [avoid using pthread barrier functions (only used by OSS driver)]),
685         [ USE_BARRIER=$withval ])
686 if test "x$USE_BARRIER" = "xyes"; then
687         AC_CHECK_LIB([pthread], [pthread_barrier_init],
688                 AC_DEFINE(USE_BARRIER, 1, [Use pthread barrier functions]))
691 # some example-clients need libsndfile
692 HAVE_SNDFILE=false
693 PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0,[HAVE_SNDFILE=true], [true])
694 if test x$HAVE_SNDFILE = xfalse; then
695              AC_MSG_WARN([*** the jackrec example client will not be built])
698 # NetJack backend and internal client need libsamplerate
699 HAVE_SAMPLERATE=false
700 PKG_CHECK_MODULES(SAMPLERATE, samplerate >= 0.1.2,[HAVE_SAMPLERATE=true], [true])
701 if test x$HAVE_SAMPLERATE = xfalse; then
702         AC_MSG_WARN([*** the NetJack backend and internal client will not be built])
703         AC_DEFINE(HAVE_SAMPLERATE,0,"Whether libsamplerate is available")
704 else
705         NETJACK_CFLAGS="$NETJACK_CFLAGS $SAMPLERATE_CFLAGS"
706         NETJACK_LIBS="$NETJACK_LIBS $SAMPLERATE_LIBS"
707         AC_DEFINE(HAVE_SAMPLERATE,1,"Whether libsamplerate is available")
710 # Celt low-latency audio codec. netjack transmission via internet.
711 HAVE_CELT=false
712 PKG_CHECK_MODULES(CELT, celt >= 0.7.0,[HAVE_CELT=true], [true])
713 if test x$HAVE_CELT = xfalse; then
714         PKG_CHECK_MODULES(CELT, celt >= 0.5.0,[HAVE_CELT=true], [true])
715         if test x$HAVE_CELT = xfalse; then
716                 AC_DEFINE(HAVE_CELT,0,"Whether CELT is available")
717                 AC_MSG_RESULT(no)
718                 AC_MSG_WARN([*** NetJack will not be built with celt support])
719         else
720                 AC_DEFINE(HAVE_CELT,1,"Whether CELT is available")
721                 AC_DEFINE(HAVE_CELT_API_0_5,1,"Whether CELT API is 0.5 API")
722                 AC_DEFINE(HAVE_CELT_API_0_7,0,"Whether CELT API is 0.7 API")
723                 AC_MSG_RESULT(yes (0.5))
724                 NETJACK_LIBS="$NETJACK_LIBS $CELT_LIBS"
725         fi
726 else
727         AC_DEFINE(HAVE_CELT,1,"Whether CELT is available")
728         AC_MSG_RESULT(yes (0.7))
729         AC_DEFINE(HAVE_CELT_API_0_5,0,"Whether CELT API is 0.5 API")
730         AC_DEFINE(HAVE_CELT_API_0_7,1,"Whether CELT API is 0.7 API")
731         NETJACK_LIBS="$NETJACK_LIBS $CELT_LIBS"
734 AC_SUBST(NETJACK_LIBS)
735 AC_SUBST(NETJACK_CFLAGS)
737 # Note: A bug in pkg-config causes problems if the first occurence of
738 # PKG_CHECK_MODULES can be disabled. So, if you're going to use
739 # PKG_CHECK_MODULES inside a --disable-whatever check, you need to
740 # do it somewhere *below* this comment.
742 # Check which backend drivers can be built.  The last one successfully
743 # configured becomes the default JACK driver; so the order of
744 # precedence is: alsa, sun, oss, coreaudio, portaudio, dummy.
746 JACK_DEFAULT_DRIVER=\"dummy\"
748 AC_ARG_ENABLE(portaudio,
749         AC_HELP_STRING([--enable-portaudio],[build PortAudio driver]),
750    TRY_PORTAUDIO=$enableval , TRY_PORTAUDIO=no)
752 HAVE_PA="false"
753 if test "x$TRY_PORTAUDIO" = "xyes"
754 then
755         # check for portaudio V18
756         AC_CHECK_LIB(portaudio, Pa_Initialize,
757                 [ AC_CHECK_HEADERS(portaudio.h,
758                         [ HAVE_PA="true"
759                           PA_LIBS=-lportaudio
760                           JACK_DEFAULT_DRIVER=\"portaudio\"
761                         ])
762                 ])
763         AC_SUBST(PA_LIBS)
765 AM_CONDITIONAL(HAVE_PA, $HAVE_PA)
767 AC_ARG_ENABLE(coreaudio, AC_HELP_STRING([--disable-coreaudio], [ignore CoreAudio driver]),
768                         TRY_COREAUDIO=$enableval , TRY_COREAUDIO=yes )
769 HAVE_COREAUDIO="false"
770 if test "x$TRY_COREAUDIO" = "xyes"
771 then
772         # check for coreaudio
773         AC_CHECK_HEADERS(CoreAudio/CoreAudio.h,
774                 [ HAVE_COREAUDIO="true"
775                   JACK_DEFAULT_DRIVER=\"coreaudio\"
776                 ])
778 AM_CONDITIONAL(HAVE_COREAUDIO, $HAVE_COREAUDIO)
780 AC_ARG_ENABLE(oss, AC_HELP_STRING([--disable-oss],[ignore OSS driver ]),
781                         TRY_OSS=$enableval , TRY_OSS=yes ) 
782 HAVE_OSS="false"
783 if test "x$TRY_OSS" = "xyes"
784 then
785         # check for Open Sound System
786         AC_CHECK_HEADER([sys/soundcard.h],
787              [HAVE_OSS="true"
788               JACK_DEFAULT_DRIVER=\"oss\"])
790 AM_CONDITIONAL(HAVE_OSS, $HAVE_OSS)
792 AC_ARG_ENABLE(sun, AC_HELP_STRING([--disable-sun],[ignore Sun driver ]),
793                         TRY_SUN=$enableval , TRY_SUN=yes ) 
794 HAVE_SUN="false"
795 if test "x$TRY_SUN" = "xyes"
796 then
797         # check for Sun audio API
798         AC_CHECK_HEADER([sys/audioio.h],
799              [HAVE_SUN="true"
800               JACK_DEFAULT_DRIVER=\"sun\"])
802 AM_CONDITIONAL(HAVE_SUN, $HAVE_SUN)
804 AC_ARG_ENABLE(freebob, AC_HELP_STRING([--disable-freebob],[ignore FreeBob driver ]),
805                         TRY_FREEBOB=$enableval , TRY_FREEBOB=yes ) 
806 HAVE_FREEBOB="false"
807 if test "x$TRY_FREEBOB" = "xyes"
808 then
809         # check for FreeBob libraries
810         PKG_CHECK_MODULES(LIBFREEBOB, libfreebob >= 1.0.0,
811              [HAVE_FREEBOB="true"
812               JACK_DEFAULT_DRIVER=\"freebob\"
813              ], AC_MSG_RESULT([no]))
815         AC_SUBST([LIBFREEBOB_CFLAGS])
816         AC_SUBST([LIBFREEBOB_LIBS])
819 AM_CONDITIONAL(HAVE_FREEBOB,$HAVE_FREEBOB)
821 AC_ARG_ENABLE(firewire, AC_HELP_STRING([--disable-firewire],[ignore FireWire driver (FFADO)]),
822                         TRY_FIREWIRE=$enableval , TRY_FIREWIRE=yes ) 
823 HAVE_FIREWIRE="false"
824 if test "x$TRY_FIREWIRE" = "xyes"
825 then
826         # check for FFADO libraries
827         PKG_CHECK_MODULES(LIBFFADO, libffado >= 1.999.17,
828              [HAVE_FIREWIRE="true"
829               JACK_DEFAULT_DRIVER=\"firewire\"
830              ], AC_MSG_RESULT([no]))
832         AC_SUBST([LIBFFADO_CFLAGS])
833         AC_SUBST([LIBFFADO_LIBS])
836 AM_CONDITIONAL(HAVE_FIREWIRE,$HAVE_FIREWIRE)
838 AC_ARG_ENABLE(alsa, AC_HELP_STRING([--disable-alsa],[ignore ALSA driver ]),
839                         TRY_ALSA=$enableval , TRY_ALSA=yes ) 
840 HAVE_ALSA="false"
841 if test "x$TRY_ALSA" = "xyes"
842 then
843         # check for ALSA >= 1.0.0
844         PKG_CHECK_MODULES(ALSA, alsa >= 1.0.0,
845              [HAVE_ALSA="true"
846               ALSA_LIBS=-lasound
847               JACK_DEFAULT_DRIVER=\"alsa\"
848              ], AC_MSG_RESULT([no]), [-lm]
849         )
850         AC_SUBST(ALSA_LIBS)
852 AM_CONDITIONAL(HAVE_ALSA, $HAVE_ALSA)
854 HAVE_ALSA_MIDI=$HAVE_ALSA
855 AM_CONDITIONAL(HAVE_ALSA_MIDI, $HAVE_ALSA_MIDI)
857 if test "$JACK_DEFAULT_DRIVER" = \"dummy\"; then
858   AC_MSG_WARN([Only the dummy driver can be built])
860 AC_DEFINE_UNQUOTED(JACK_DEFAULT_DRIVER,
861         [$JACK_DEFAULT_DRIVER],
862         [Default JACK driver])
864 JACK_SEMAPHORE_KEY=0x282929
865 AC_DEFINE_UNQUOTED(JACK_SEMAPHORE_KEY,
866           [$JACK_SEMAPHORE_KEY],
867           [ an integer constant used as the semaphore and SysV SHM key. see libjack/shm.c for usage])
868 AC_SUBST(JACK_SEMAPHORE_KEY)
870 # On some systems, readline depends on termcap or ncurses.  But, the
871 # MacOSX linker complains bitterly if these libraries are explicitly
872 # referenced.  
874 # AC_CHECK_LIB() foolishly assumes that checking a library for an entry
875 # point always returns the same result regardless of any dependent
876 # libraries specified.  The `unset ac_cv_lib_readline_readline' erases
877 # the cached result to work around this problem.
878 READLINE_DEPS=""
879 HAVE_READLINE=true
880 AC_CHECK_LIB(readline, readline, [:],
881     [unset ac_cv_lib_readline_readline
882      AC_CHECK_LIB(readline, readline, [READLINE_DEPS="-ltermcap"],
883         [unset ac_cv_lib_readline_readline
884          AC_CHECK_LIB(readline, readline,
885             [READLINE_DEPS="-lncurses"], [HAVE_READLINE=false], "-lncurses")],
886         "-ltermcap")])
887 AC_CHECK_HEADER(readline/chardefs.h, [], [HAVE_READLINE=false])
888 if test x$HAVE_READLINE = xfalse; then
889         AC_MSG_WARN([*** the jack_transport example client will not be built])
891 AC_SUBST(READLINE_DEPS)
893 # you need doxygen to make dist.
894 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
895 if test $HAVE_DOXYGEN = "false"; then
896              AC_MSG_WARN([*** doxygen not found, docs will not be built])
899 AM_CONDITIONAL(HAVE_SNDFILE, $HAVE_SNDFILE)
900 AM_CONDITIONAL(HAVE_CELT, $HAVE_CELT)
901 AM_CONDITIONAL(HAVE_SAMPLERATE, $HAVE_SAMPLERATE)
902 AM_CONDITIONAL(HAVE_READLINE, $HAVE_READLINE)
903 AM_CONDITIONAL(HAVE_DOXYGEN, $HAVE_DOXYGEN)
904 AM_CONDITIONAL(USE_CAPABILITIES, $USE_CAPABILITIES)
905 AM_CONDITIONAL(STRIPPED_JACKD, $STRIPPED_JACKD)
906 AM_CONDITIONAL(HAVE_PPOLL, $HAVE_PPOLL)
908 AC_OUTPUT(
909 Makefile
910 config/Makefile
911 config/cpu/Makefile
912 config/cpu/alpha/Makefile
913 config/cpu/cris/Makefile
914 config/cpu/generic/Makefile
915 config/cpu/i386/Makefile
916 config/cpu/i486/Makefile
917 config/cpu/ia64/Makefile
918 config/cpu/m68k/Makefile
919 config/cpu/mips/Makefile
920 config/cpu/powerpc/Makefile
921 config/cpu/s390/Makefile
922 config/os/Makefile
923 config/os/generic/Makefile
924 config/os/gnu-linux/Makefile
925 config/os/macosx/Makefile
926 config/sysdeps/Makefile
927 doc/Makefile
928 doc/reference.doxygen
929 drivers/Makefile
930 drivers/alsa/Makefile
931 drivers/alsa-midi/Makefile
932 drivers/dummy/Makefile
933 drivers/oss/Makefile
934 drivers/sun/Makefile
935 drivers/portaudio/Makefile
936 drivers/coreaudio/Makefile
937 drivers/freebob/Makefile
938 drivers/firewire/Makefile
939 drivers/netjack/Makefile
940 example-clients/Makefile
941 tools/Makefile
942 man/Makefile
943 jack.pc
944 jack.spec
945 jack/Makefile
946 jack/version.h
947 jackd/Makefile
948 jackd/jackd.1
949 libjack/Makefile
953 dnl Output summary message
956 echo
957 echo $PACKAGE $VERSION :
958 echo
959 echo \| Build with ALSA support............................... : $HAVE_ALSA
960 echo \| Build with old FireWire \(FreeBob\) support............. : $HAVE_FREEBOB
961 echo \| Build with new FireWire \(FFADO\) support............... : $HAVE_FIREWIRE
962 echo \| Build with OSS support................................ : $HAVE_OSS
963 echo \| Build with Sun audio support.......................... : $HAVE_SUN
964 echo \| Build with CoreAudio support.......................... : $HAVE_COREAUDIO
965 echo \| Build with PortAudio support.......................... : $HAVE_PA
966 echo \| Build with Celt support............................... : $HAVE_CELT
967 echo \| Build with dynamic buffer size support................ : $buffer_resizing
968 echo \| Compiler optimization flags........................... : $JACK_OPT_CFLAGS
969 echo \| Compiler full flags................................... : $CFLAGS
970 echo \| Install dir for libjack + backends.................... : $libdir/jack
971 echo \|
972 echo \| Default driver backend................................ : $JACK_DEFAULT_DRIVER
973 echo \| Shared memory interface............................... : $JACK_SHM_TYPE
974 echo \| IPC Temporary directory............................... : $DEFAULT_TMP_DIR
975 echo \| Install prefix........................................ : $prefix
976 echo \| Default tmp dir....................................... : $DEFAULT_TMP_DIR
977 echo