File: configure.in

package info (click to toggle)
audacity 2.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 44,240 kB
  • sloc: cpp: 182,841; ansic: 120,375; sh: 26,421; lisp: 7,495; makefile: 1,606; python: 240; xml: 104; perl: 31
file content (757 lines) | stat: -rw-r--r-- 27,243 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
dnl
dnl audacity configure.in script
dnl
dnl Joshua Haberman
dnl Dominic Mazzoni
dnl

dnl
dnl Instructions: to create "configure" from "configure.in", run:
dnl
dnl aclocal
dnl autoconf
dnl
dnl Note: you need pkgconfig installed for this to work.  If pkg.m4 is
dnl not in the standard place, like /usr/share/aclocal, use the -I option
dnl to aclocal, for example on Mac OS X when pkgconfig was installed by
dnl fink:
dnl  aclocal -I /sw/share/aclocal
dnl

dnl TODO:
dnl
dnl automatically choose whether or not to make some libs
dnl based on:
dnl
dnl AC_CHECK_LIB(z, compress2, build_libz=false, build_libz=true)
dnl AM_CONDITIONAL(BUILD_LIBZ, test "$build_libz" = true)
dnl
dnl

dnl Process this file with autoconf to produce a configure script.

dnl Require autoconf >= 2.59
AC_PREREQ(2.59)

dnl Init autoconf
AC_INIT
dnl Check for existence of Audacity.h
AC_CONFIG_SRCDIR([src/Audacity.h])
dnl we have some extra macros in m4/
AC_CONFIG_MACRO_DIR([m4])

dnl -------------------------------------------------------
dnl Checks for programs.
dnl -------------------------------------------------------
dnl save $CFLAGS etc. since AC_PROG_CC likes to insert "-g -O2"
dnl if $CFLAGS is blank and it finds GCC
cflags_save="$CFLAGS"
cppflags_save="$CPPFLAGS"
cxxflags_save="$CXXFLAGS"
AX_COMPILER_VENDOR
AC_PROG_CC
AC_LANG([C++])
AC_PROG_CXX
AC_PROG_CXXCPP
CFLAGS="$cflags_save"
CPPFLAGS="$cppflags_save"
CXXFLAGS="$cxxflags_save"

AC_PROG_INSTALL
dnl pkg-config is required for lots of things
AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes, no)
if test x$HAVE_PKG_CONFIG = xno ; then
   AC_MSG_ERROR([pkg-config is required to compile audacity!])
fi

dnl extra variables
dnl list of static link libraries to link in, with paths relative to lib-src
AC_SUBST(LOCAL_LIBS)
dnl optional object files (from audacity itself) depending on options enabled
AC_SUBST(EXTRAOBJS)
dnl Extra things that need to be built during make (makefile targets)
AC_SUBST(EXTRATARGETS)
dnl extra things to install during make install (makefile targets)
AC_SUBST(EXTRAINSTALLTARGETS)
dnl extra things to remove during uninstall (makefile targets)
AC_SUBST(EXTRAUNINSTALLTARGETS)
AC_SUBST(OPTOBJS)
AC_SUBST(CDEPEND)
AC_SUBST(PRECOMP_CFLAGS)
AC_SUBST(AFTERBUILD)
AC_SUBST(INSTALL_PREFIX)
dnl the header file with #defines from configure in it
AC_SUBST(CONFIGHEADER)
dnl LDFLAGS that will be valid for the build, but aren't yet valid so shouldn't
dnl be used for configure script tests (they are needed for main build).
AC_SUBST(BUILD_LDFLAGS)
dnl List of libraries in lib-src that need to be compiled before building
dnl audacity. Each name in the list should be a _target_ in lib-src/Makefile
AC_SUBST(LIBSRC_BUILD)

AC_SUBST(MIMETYPES)

dnl allow the user to specify options to configure that change the
dnl name "audacity" anywhere it appears in a pathname.   This allows
dnl multiple versions of Audacity to be installed concurrently
dnl without collision

AC_ARG_PROGRAM
AC_SUBST(AUDACITY_NAME)

dnl autoconf's program_transform_name is set to spit out a sed expression --
dnl however it's "helpfully" already escaped for make.   Since we want to use
dnl it in shell and not make, we have to unescape this: this translates into
dnl turning two dollar signs into one.
dnl
dnl I feign at this monstrosity, but no one depends on this particular
dnl feature but me, as Debian package maintainer, so no one else should
dnl need to worry about understanding it...
program_transform_name=`echo $program_transform_name | sed 's/\\$\\$/$/'`
AUDACITY_NAME=`echo audacity | sed $program_transform_name`

if [[ "$AUDACITY_NAME" = "audacity" ]] ; then
    AC_DEFINE(AUDACITY_NAME, "audacity",
        [define if Audacity is being installed under a name other than "audacity",
         so it can find the files it needs at runtime])
else
    AC_DEFINE_UNQUOTED(AUDACITY_NAME, "$AUDACITY_NAME")
fi

dnl
dnl Make the install prefix available to the program so that it
dnl knows where to look for help files, plug-ins, etc.
dnl

AC_PREFIX_DEFAULT(/usr/local)
if test x$prefix = "xNONE" ; then
   prefix="/usr/local/"
fi
AC_DEFINE_UNQUOTED(INSTALL_PREFIX, "$prefix", [define as prefix where Audacity is installed])

### Configuration of Audacity module support ###
################################################
dnl Some code (headers) can be built either as part of audacity, or as part of
dnl audacity plug-ins. In order to tell this code what is going on, we need to
dnl define BUILDING_AUDACITY during the audacity build, and not during the
dnl plug-in build. This code puts the relevant content into configunix.h
AC_DEFINE(BUILDING_AUDACITY, 1,
   [Define we are compiling Audacity itself, not an Audacity plug-in])
# Add -rdynamic to linker flags so the right symbols are exported for
# plug-ins. This might not work on all architectures / compilers, so we need
# to check if it does or not.
AX_LD_CHECK_FLAG([-rdynamic],[],[],
               have_dynamic_link=yes,have_dynamic_link=no)
if test "x$have_dynamic_link" = "xyes" ; then
   BUILD_LDFLAGS="${BUILD_LDFLAGS} -rdynamic "
else
   AC_MSG_WARN(["Linker does not support -rdynamic. Could not enable exporting all symbols"])
   AC_MSG_WARN(["Audacity module support will probably not work"])
fi

### Build Options ###
#####################

AC_ARG_ENABLE(static,
            [AS_HELP_STRING([--enable-static],
                            [link wx statically [default=no]])],
            static_preference="--static=$enableval",
            static_preference="")

AC_ARG_ENABLE(unicode,
            [AS_HELP_STRING([--enable-unicode],
                            [enable unicode support [default=yes]])],   
            unicode_preference="--unicode=$enableval",
            unicode_preference="--unicode=yes")

AC_ARG_ENABLE(debug,
            [AS_HELP_STRING([--enable-debug],
                            [enable debug support [default=no]])],
            debug_preference="$enableval",
            debug_preference="no")

AC_ARG_WITH(lib-preference,
            [AS_HELP_STRING([--with-lib-preference],
                            [whether to use local and/or system libraries, in order of preference (default="system local")])],
            lib_preference=$withval,
            lib_preference="system local")

AC_ARG_ENABLE(sse, [AC_HELP_STRING([--enable-sse],[enable SSE optimizations])], enable_sse=$enableval, enable_sse=yes)

AC_ARG_ENABLE(universal_binary,[  --enable-universal_binary enable universal binary build: (default: disable)],[enable_universal_binary=$enableval],[enable_universal_binary=no])

AC_ARG_ENABLE(dynamic-loading,
            [AS_HELP_STRING([--enable-dynamic-loading],
                            [enable dynamic loading of lame and FFmpeg [default=yes]])],
            [dynamic_loading="$enableval"],
            [dynamic_loading="yes"])

dnl AC_ARG_WITH(wx-version,
dnl            [AS_HELP_STRING([--with-wx-version],
dnl                            [select wxWidgets version (if both installed) [2.8,]])],
dnl            wx_preference="--version=$withval",
dnl            wx_preference="")
dnl At the moment we only support wx2.8. If we start supporting 3.0 when it
dnl comes out, we'll want it back again.

dnl ----------------------------------------------------
dnl If user asked for debug, put debug in compiler flags
dnl ----------------------------------------------------

if test x$enable_universal_binary = xyes; then
   case "$target_os" in
     darwin*)
        CPPFLAGS="${CPPFLAGS} -mmacosx-version-min=10.4 -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -Xarch_i386 -DAPPLE_I386 -Xarch_ppc -DAPPLE_PPC"
	;;
     *)
	;;
   esac
fi

if test x$enable_sse = xyes; then

   if test "${ax_cv_cxx_compiler_vendor}" = "gnu"; then
      AX_CHECK_COMPILER_FLAGS(-msse, [SBSMS_CFLAGS="$SBSMS_CFLAGS -msse"],[AC_MSG_ERROR([Need a version of gcc with -msse])])
   fi

   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <xmmintrin.h>]], [[__m128 v,w; float p[8]; v = _mm_loadu_ps(p); _mm_storeu_ps(p,v); w = _mm_loadl_pi(w,(const __m64*)p); w = _mm_loadh_pi(w,(const __m64*)p); _mm_storel_pi((__m64 *)p, w); _mm_storeh_pi((__m64 *)p, w); v = _mm_add_ps(v,w); v = _mm_sub_ps(v,w); v = _mm_mul_ps(v,w); v = _mm_shuffle_ps(v,w,_MM_SHUFFLE(0,1,2,3)); w = _mm_set1_ps(0.0f);]])], [sse_ok=yes], [sse_ok=no])

   if test x$sse_ok = xyes; then
      AC_DEFINE(ENABLE_SSE,1,[Define to enable sse])
   fi
fi

if test x"$debug_preference" = "xyes" ; then
   dnl we want debuging on
   AC_MSG_NOTICE([Adding -g for debugging to CFLAGS and CXXFLAGS ...])
   CFLAGS="${CFLAGS} -g "
   CXXFLAGS="${CXXFLAGS} -g "
fi

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T

dnl check if alloca.h exists. If it does, we need to include it for 
dnl Solaris builds, by defining HAVE_ALLOCA_H
AC_CHECK_HEADERS_ONCE(alloca.h)

dnl --------------------------------------------------------------------------
dnl We would like warnings enabled on the builds, but different compilers need
dnl different options for these. This bit tries to work out what flags we 
dnl should add to the compiler we are using.
dnl --------------------------------------------------------------------------

dnl Strict prototypes flags for C (only C because doesn't work for C++)
AX_CFLAGS_STRICT_PROTOTYPES(CFLAGS)

dnl Sensible warnings for C
AX_CFLAGS_WARN_ALL(wall_flags)
CFLAGS="${CFLAGS} $wall_flags"
dnl try and use it on C++ as well
AX_CXX_CHECK_FLAG([$wall_flags], [[int foo;]], [[foo = 1;]], cxx_does_wall="yes", cxx_does_wall="no")
if test "x$cxx_does_wall" = "xyes" ; then
   dnl can use all warnings flag on the C++ compiler
   CXXFLAGS="${CXXFLAGS} $wall_flags"
fi
AX_CXXCPP_CHECK_FLAG([$wall_flags], [[int foo;]], [[foo = 1;]], cpp_does_wall="yes", cpp_does_wall="no")
if test "x$cpp_does_wall" = "xyes" ; then
   dnl can use all warnings flag on the C++ pre-processor
   CPPFLAGS="${CPPFLAGS} $wall_flags"
fi

dnl-------------------------------------------------------------------------
dnl If the C++ compiler supports making symbols within audacity hidden then
dnl we would like to do so. This means that only the required symbols for
dnl plug-in functionality are exposed, rather than everything in the program.
dnl-------------------------------------------------------------------------
gl_VISIBILITY

dnl-------------------------------------------------------------
dnl Configure the libraries which are essential to audacity.
dnl These are mostly only libraries for licensing flexibility, so
dnl there isn't a way to turn them off.
dnl-------------------------------------------------------------

dnl wxWidgets -- we assume that if wx-config is found, wxWidgets is successfully installed.
AC_PATH_PROG(WX_CONFIG, wx-config, no, $PATH:/usr/local/bin )
if [[ "$WX_CONFIG" = "no" ]] ; then
   AC_MSG_ERROR("Could not find wx-config: is wxWidgets installed? is wx-config in your path?")
fi

if test "x$debug_preference" = "xyes"; then
   dnl want debug wx as well
   wxconfigargs="--debug=yes"
else
   dnl normal wx
   wxconfigargs=""
fi

dnl more things we always pass to wx-config
wxconfigargs="$static_preference $unicode_preference  $wxconfigargs $wx_preference"
wx_version=`${WX_CONFIG} $wxconfigargs --version`

AC_MSG_NOTICE([Checking that the chosen version of wxWidgets is 2.8.x])

case "${wx_version}" in
  2.8.*)
    echo "Great, you're using wxWidgets ${wx_version}!"
    ;;
  *)
  wx_list=`${WX_CONFIG} --list`
  AC_MSG_ERROR([Unable to locate a suitable configuration of wxWidgets v2.8.x or higher.
The currently available configurations are listed below.  If necessary, either
install the package for your distribution or download the latest version of
wxWidgets
from http://wxwidgets.org.
${wx_list}])
esac

dnl Pass wx config path to lower levels
ac_configure_args="$ac_configure_args --with-wx-config=\"$WX_CONFIG\""

dnl Gather wx arguments
LIBS="$LIBS `$WX_CONFIG $wxconfigargs --libs`"
CXXFLAGS="$CXXFLAGS `$WX_CONFIG $wxconfigargs --cxxflags`"

dnl-----------------------------------------------------------------
dnl Pull in library Cflags and so on for the non-optional libraries

dnl TODO enable/disable allegro
dnl LOCAL_LIBS="$LOCAL_LIBS allegro.a"
dnl CXXFLAGS="$CXXFLAGS -I\$(top_srcdir)/lib-src/allegro"

dnl Include FileDialog
AC_CONFIG_SUBDIRS([lib-src/FileDialog])
LOCAL_LIBS="$LOCAL_LIBS FileDialog.a"
CXXFLAGS="$CXXFLAGS -I\$(top_srcdir)/lib-src/FileDialog"

dnl Include lib-widget-extra (via pkg-config). Doing this gets it configured as
dnl well, because it has to be configured in order to be found
AUDACITY_CHECKLIB_WIDGETEXTRA
dnl pull in flags for the library
BUILD_LDFLAGS="$BUILD_LDFLAGS $WIDGETEXTRA_LIBS"
CXXFLAGS="$CXXFLAGS $WIDGETEXTRA_CFLAGS"
dnl Add the library to the list of libraries that need to be compiled
LIBSRC_BUILD="$LIBSRC_BUILD widgetextra"

dnl-------------------------------------------------------------
dnl Optional library support. Lots of things we could use, but 
dnl can do without if they aren't available.
dnl-------------------------------------------------------------
dnl LIBRARIES="LIBVORBIS LIBMAD LIBSNDFILE LIBFLAC LIBID3TAG LIBSAMPLERATE LIBRESAMPLE LIBSBSMS LIBSOUNDTOUCH LIBNYQUIST LIBVAMP LIBEXPAT LIBTWOLAME FFMPEG LIBLRDF SLV2 REDLAND PORTSMF TAGLIB"
dnl disable plugin categorisation and LV2 libs for 1.3.7 release
LIBRARIES="LIBVORBIS LIBMAD LIBSNDFILE LIBFLAC LIBID3TAG LIBSAMPLERATE LIBRESAMPLE LIBSBSMS LIBSOUNDTOUCH LIBNYQUIST LIBVAMP LIBEXPAT LIBTWOLAME FFMPEG PORTSMF PORTAUDIO LAME"

AC_MSG_NOTICE([Determining what libraries are available in this tree and on the system])

AUDACITY_CHECKLIB_LIBSNDFILE
AUDACITY_CHECKLIB_LIBEXPAT
AUDACITY_CHECKLIB_LIBSAMPLERATE
AUDACITY_CHECKLIB_LIBRESAMPLE
AUDACITY_CHECKLIB_LIBVORBIS
AUDACITY_CHECKLIB_LIBMAD
AUDACITY_CHECKLIB_LIBFLAC
AUDACITY_CHECKLIB_LIBID3TAG
AUDACITY_CHECKLIB_LIBSBSMS
AUDACITY_CHECKLIB_LIBSOUNDTOUCH
AUDACITY_CHECKLIB_LIBNYQUIST
AUDACITY_CHECKLIB_LIBVAMP
AUDACITY_CHECKLIB_LIBTWOLAME
AUDACITY_CHECKLIB_FFMPEG
dnl AUDACITY_CHECKLIB_REDLAND
dnl AUDACITY_CHECKLIB_SLV2
dnl AUDACITY_CHECKLIB_LIBLRDF
AUDACITY_CHECKLIB_PORTSMF
dnl AUDACITY_CHECKLIB_TAGLIB
AUDACITY_CHECKLIB_PORTAUDIO
AUDACITY_CHECKLIB_LAME

dnl Decide what libraries to build with, and whether to use system or local libraries
dnl Set variables based on choices.

AC_MSG_NOTICE([Figuring out what libraries to enable])

lib_preference=`echo $lib_preference | tr [[:lower:]], "[[:upper:]] "`

for lib in $LIBRARIES ; do
   eval LIB_ARGUMENT="\$${lib}_ARGUMENT"
   eval LIB_SYSTEM_AVAILABLE="\$${lib}_SYSTEM_AVAILABLE"
   eval LIB_LOCAL_AVAILABLE="\$${lib}_LOCAL_AVAILABLE"
   if test x"$LIB_ARGUMENT" = x"unspecified" -o x"$LIB_ARGUMENT" = x"yes" ; then
      lib_activated="no"
      for sys_or_local in $lib_preference ; do
         # example: LIBMAD_SYSTEM_AVAILABLE
         eval AVAILABLE="\$${lib}_${sys_or_local}_AVAILABLE"
         if test "$AVAILABLE" = "yes" ; then
            eval ${lib}_USE_${sys_or_local}="yes"
            lib_activated="yes"
            AC_MSG_NOTICE([Using $sys_or_local libraries for $lib])
            break
         fi
      done
      if test "$lib_activated" = no ; then
         AC_MSG_NOTICE([disabling $lib])
      fi
   else
      dnl lib_ARGUMENT is something other than "unspecified"
      if test "$LIB_ARGUMENT" = local ; then
         if test "$LIB_LOCAL_AVAILABLE" = yes ; then
            eval ${lib}_USE_LOCAL="yes"
            AC_MSG_NOTICE([Using the LOCAL libraries for $lib because you specifically requested this])
         else
            AC_MSG_ERROR([You requested using the local libraries for $lib but they are not available])
         fi
      elif test "$LIB_ARGUMENT" = system ; then
         if test "$LIB_SYSTEM_AVAILABLE" = yes ; then
            eval ${lib}_USE_SYSTEM="yes"
            AC_MSG_NOTICE([Using the SYSTEM libraries for $lib because you specifically requested this])
         else
            AC_MSG_ERROR([You requested using the system libraries for $lib but they are not available])
         fi
      elif test "$LIB_ARGUMENT" = no ; then
         AC_MSG_NOTICE([disabling $lib at your request])
      else
         AC_MSG_ERROR(I didn't understand the argument $LIB_ARGUMENT for $lib)
      fi
   fi
done

# In some cases the choices made above might be inappropriate.
#   * we need to have libsndfile one way or another
#   * we can only use one of libsamplerate and libresample
#   * we should not use the local Redland if we're not using local SLV2 or 
#     liblrdf

if test "$LIBSNDFILE_USE_LOCAL" != "yes" && test "$LIBSNDFILE_USE_SYSTEM" != "yes" ; then
   AC_MSG_ERROR([Audacity requires libsndfile to be enabled])
fi

if test "$LIBEXPAT_USE_LOCAL" != "yes" && test "$LIBEXPAT_USE_SYSTEM" != "yes" ; then
   AC_MSG_ERROR([Audacity requires expat to be enabled])
else
   if test "$LIBEXPAT_USE_SYSTEM" = "yes" ; then
      AC_DEFINE(USE_SYSTEM_EXPAT, 1, [Use system Expat library])
   fi
fi

if test "$PORTAUDIO_USE_LOCAL" != "yes" && test "$PORTAUDIO_USE_SYSTEM" != "yes" ; then
   AC_MSG_ERROR([Audacity requires portaudio to be enabled])
fi

dnl we can only have one sample rate conversion library used.
dnl by now we will have both enabled if they are present, regardless of whether
dnl they were requested, unless one was specifically disabled.
dnl we would like to honour requests at this stage, so need to know about
dnl the original options, not just which LIB_USE variables have been set.
if ( test "$LIBRESAMPLE_USE_LOCAL" = "yes" || test "$LIBRESAMPLE_USE_SYSTEM" = "yes") && ( test "$LIBSAMPLERATE_USE_LOCAL" = "yes" || test "$LIBSAMPLERATE_USE_SYSTEM" = "yes"); then
   dnl if we get here, both libraries are available to us.
   AC_MSG_NOTICE([Both libresample and libsamplerate are available])
   AC_MSG_NOTICE([deciding which to use based on arguments ...])
   if test x"$LIBSAMPLERATE_ARGUMENT" = x"unspecified" ; then
      dnl they didn't ask for libsamplerate, they don't get it
      LIBSAMPLERATE_USE_LOCAL="no"
      LIBSAMPLERATE_USE_SYSTEM="no"
      dnl done - we are using libresample
      AC_MSG_NOTICE([Libsamplerate not explicity requested, using libresample])
   else
      dnl if we get here, then libsample rate has been explicity specified.
      dnl could that be disabling it? No, because it wouldn't then have been
      dnl enabled above.
      LIBRESAMPLE_USE_LOCAL="no"
      LIBRESAMPLE_USE_SYSTEM="no"
      dnl done - we are using libsamplerate
      AC_MSG_NOTICE([Using libsamplerate as requested])
   fi
fi

dnl if ( test "$SLV2_USE_LOCAL" != "yes" && test "$LIBLRDF_USE_LOCAL" != "yes") && test "$REDLAND_USE_LOCAL" = "yes" ; then
dnl   AC_MSG_NOTICE([Not building local Redland library since we don't use the local SLV2 or liblrdf libraries])
dnl   REDLAND_USE_LOCAL=no
dnl   REDLAND_USE_SYSTEM=no
dnl fi

dnl If we are using a local copy of liblrdf then some extra files need to be
dnl installed on the system, so we need to add the targets to
dnl EXTRAINSTALLTARGETS and EXTRAUNINSTALLTARGETS
if [[ "x$LIBLRDF_USE_LOCAL" = "xyes" ]]; then
   EXTRAINSTALLTARGETS="$EXTRAINSTALLTARGETS install-lrdf-data"
   EXTRAUNINSTALLTARGETS="$EXTRAUNINSTALLTARGETS uninstall-lrdf-data"
fi

dnl-----------------------------------------------------------------
dnl Based on the optional lib selections, modify LOCAL_LIBS, CXXFLAGS, etc
for lib in $LIBRARIES ; do
   eval LIB_USE_LOCAL=\$${lib}_USE_LOCAL
   eval LIB_USE_SYSTEM=\$${lib}_USE_SYSTEM
   if test "$LIB_USE_LOCAL" = yes -o "$LIB_USE_SYSTEM" = yes; then
      eval MIMETYPES=\"${MIMETYPES}\$${lib}_MIMETYPES\"
   fi
   if test "x$LIB_USE_LOCAL" = "xyes" ; then
      eval LIBSRC_BUILD=\"$LIBSRC_BUILD \$${lib}_LOCAL_BUILD\"
      eval LOCAL_LIBS=\"$LOCAL_LIBS \$${lib}_LOCAL_LIBS\"
      eval BUILD_LDFLAGS=\"\$BUILD_LDFLAGS \$${lib}_LOCAL_LDFLAGS\"
      eval OPTOBJS=\"$OPTOBJS \$${lib}_LOCAL_OPTOBJS\"
      eval CXXFLAGS=\"\$CXXFLAGS \$${lib}_LOCAL_CXXFLAGS\"
      eval CONFIG_SUBDIRS=\"\$${lib}_LOCAL_CONFIG_SUBDIRS\"
      eval ac_configure_args=\"\$ac_configure_args \$${lib}_LOCAL_CONFIGURE_ARGS\"
      AC_CONFIG_SUBDIRS($CONFIG_SUBDIRS)

      eval CPPSYMBOLS=\"\$${lib}_LOCAL_CPPSYMBOLS\"
      for symbol in $CPPSYMBOLS ; do
         AC_DEFINE_UNQUOTED($symbol, 1)
      done
   elif test "$LIB_USE_SYSTEM" = "yes" ; then
      eval LIBS=\"$LIBS \$${lib}_SYSTEM_LIBS\"
      eval OPTOBJS=\"$OPTOBJS \$${lib}_SYSTEM_OPTOBJS\"
      #LIBS="$LIBS $THESE_LIBS"
      eval CXXFLAGS=\"\$CXXFLAGS \$${lib}_SYSTEM_CXXFLAGS\"

      eval CPPSYMBOLS=\"\$${lib}_SYSTEM_CPPSYMBOLS\"
      for symbol in $CPPSYMBOLS ; do
         AC_DEFINE_UNQUOTED($symbol, 1)
      done
   fi
done

dnl " This is included purely to close an otherwise endless string in vim


dnl--------------------------------------------------------------------------
dnl Optional features (which don't use libraries - just compile-time on/off)
dnl--------------------------------------------------------------------------

AC_ARG_ENABLE(audiounits,
   [AS_HELP_STRING([--enable-audiounits],
      [enable audio unit plug-in support (Mac OS X only) 
       [default=auto]])], use_audiounits=$enableval,
   use_audiounits="auto")

AC_ARG_ENABLE(ladspa,
   [AS_HELP_STRING([--enable-ladspa],
      [enable LADSPA plug-in support [default=yes]])],
   use_ladspa=$enableval,
   use_ladspa="yes")

AC_ARG_ENABLE(quicktime,
   [AS_HELP_STRING([--enable-quicktime],
      [enable QuickTime import support (Mac OS X only) [default=auto]])],
   use_quicktime=$enableval,
   use_quicktime="auto")

dnl In-tree libraries (ones we write, so only options are off and local)

AC_ARG_WITH(portmixer,
  [AS_HELP_STRING([--with-portmixer],
     [compile with PortMixer [default=yes]])],
  use_portmixer=$withval,
  use_portmixer="yes")

AC_CANONICAL_HOST

dnl OS-specific configuration

case "${host_os}" in
   darwin* | rhapsody*)
      dnl Mac OS X configuration
      CDEPEND="AudacityHeaders.h.gch"
      PRECOMP_CFLAGS="-include AudacityHeaders.h"
      CONFIGHEADER="configunix.h"
      CXXFLAGS="-I\$(top_srcdir)/mac $CXXFLAGS"
      AFTERBUILD=""
      EXTRATARGETS="../Audacity.app"
      if [[ "$use_audiounits" = "auto" ]] ; then
         use_audiounits="yes"
      fi
      if [[ "$use_quicktime" = "auto" ]] ; then
         use_quicktime="yes"
      fi
      ;;      

   cygwin*)
      dnl Windows/CygWin configuration
      LIBS="$LIBS -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lwsock32 -lwinmm"
      CONFIGHEADER="configwin.h"
    
      AC_DEFINE(__CYGWIN__,1,[We're using cygwin])
      dnl ' (end endless string in vim)
      AC_DEFINE(_FILE_OFFSET_BITS,32,[Placeholder for large file support])
    
      AFTERBUILD=""
      ;;

   *)
      dnl Unix configuration
      CONFIGHEADER="configunix.h"
      AFTERBUILD=""
      EXTRAINSTALLTARGETS="$EXTRAINSTALLTARGETS install-extra-data"
      EXTRAUNINSTALLTARGETS="$EXTRAUNINSTALLTARGETS uninstall-extra-data"

      dnl On Unix we always use dlopen
      AC_SEARCH_LIBS([dlopen], [dl])
      if [[ "$ac_cv_search_dlopen" = no ]]; then
         AC_MSG_ERROR(dlopen not found, required by Audacity)
      fi

      AC_SUBST(HAVE_GTK)
      PKG_CHECK_MODULES(GTK, gtk+-2.0, have_gtk=yes, have_gtk=no)
      if [[ "$have_gtk" = "yes" ]]
      then
         AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available])
         CPPFLAGS="$CPPFLAGS $GTK_CFLAGS"
         LIBS="$LIBS $GTK_LIBS"
      fi
   ;;
esac


case "${host_os}" in
   darwin* | rhapsody*)
      LIBS="-framework AudioUnit -framework AudioToolbox $LIBS"
      LIBS="-framework CoreAudio $LIBS -lz"
      ;;
   cygwin*)
      ;;
   *)
      dnl Unix
      AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no)
      if [[ $have_alsa = "yes" ]] ; then
         LIBS="$LIBS -lasound"
      fi
      PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no)
      if [[ $have_jack = "yes" ]] ; then
         LIBS="$LIBS $JACK_LIBS"
      fi
      AC_CHECK_LIB(hpi, HPI_SubSysCreate, have_asihpi=yes, have_asihpi=no, -lm)
      if [[ $have_asihpi = "yes" ]] ; then
         LIBS="$LIBS -lhpi"
      fi    
      AC_CHECK_LIB(rt, clock_gettime, [rt_libs=" -lrt"])
      LIBS="${LIBS}${rt_libs}"
      AC_CHECK_FUNCS([clock_gettime nanosleep])
      ;;
esac


if [[ "$use_portmixer" = "yes" ]] ; then
   AC_DEFINE(USE_PORTMIXER, 1,   
   [Define if PortMixer support should be enabled])

   CXXFLAGS="-I\$(top_srcdir)/lib-src/portmixer/include $CXXFLAGS"
   LOCAL_LIBS="$LOCAL_LIBS libportmixer.a"

   AC_CONFIG_SUBDIRS([lib-src/portmixer])
fi

dnl Check for lrint/lrintf
AC_C99_FUNC_LRINT
AC_C99_FUNC_LRINTF


if [[ "$use_ladspa" = "yes" ]] ; then
   OPTOBJS="$OPTOBJS effects/ladspa/LoadLadspa.o"
   OPTOBJS="$OPTOBJS effects/ladspa/LadspaEffect.o"

   AC_DEFINE(USE_LADSPA, 1,
             [Define if LADSPA plug-ins are enabled])

   dnl Special configuration for LADSPA on Mac OS X
   case "$host_os" in
      darwin7*)
         LIBS="$LIBS -ldl"
         ;;
      *)
         ;;
   esac
fi

if [[ "$use_audiounits" = "yes" ]] ; then
   OPTOBJS="$OPTOBJS effects/audiounits/LoadAudioUnits.o"
   OPTOBJS="$OPTOBJS effects/audiounits/AudioUnitEffect.o"

   AC_DEFINE(USE_AUDIO_UNITS, 1,
             [Define if Audio Unit plug-ins are enabled (Mac OS X only)])
fi

if [[ "$use_quicktime" = "yes" ]] ; then
   OPTOBJS="$OPTOBJS import/ImportQT.o"
   OPTOBJS="$OPTOBJS import/ImportQTWrapper.o"

   AC_DEFINE(USE_QUICKTIME, 1,
             [Define if QuickTime importing is enabled (Mac OS X only)])
fi



case "${host_os}" in
   cygwin*)
      AC_CONFIG_HEADER(src/configwin.h:src/configtemplate.h)
      ;;
   *)
      AC_CONFIG_HEADER(src/configunix.h:src/configtemplate.h)
      ;;
esac

# process Makefile.in's to generate Makefiles
AC_CONFIG_FILES([Makefile src/Makefile lib-src/Makefile \
                 locale/Makefile])
# Anything that depends on the name of the installed Audacity binary needs
# to be processed to set that here
AC_CONFIG_FILES([src/audacity.desktop])

dnl There are various other files we might need to process, depends on what
dnl has been enabled previously
if [[ "x$LIBEXPAT_USE_LOCAL" = "xyes" ]]; then
   AC_CONFIG_FILES([lib-src/expat/Makefile])
fi
if [[ -e tests/Makefile.in ]]; then
   AC_CONFIG_FILES([tests/Makefile])
fi

AC_OUTPUT

echo ""
echo "Finished configure:"


for lib in $LIBRARIES ; do
   eval LIB_USE_LOCAL=\$${lib}_USE_LOCAL
   eval LIB_USE_SYSTEM=\$${lib}_USE_SYSTEM
   if test "$LIB_USE_LOCAL" = "yes" ; then
      echo "$lib: using LOCAL libraries"
   elif test "$LIB_USE_SYSTEM" = "yes" ; then
      echo "$lib: using SYSTEM libraries"
   else
      echo "$lib: disabled"
   fi
done

if [[ "$use_ladspa" = "yes" ]] ; then
   echo "ladspa: enabled"
else
   echo "ladspa: disabled"        
fi

if [[ "$use_audiounits" = "yes" ]] ; then
   echo "audiounits: enabled"
else
   echo "audiounits: disabled"        
fi

echo "prefix=$prefix";

echo ""
echo "Run 'configure --help' for an explanation of these options,"
echo "otherwise run 'make' to build Audacity."

dnl Indentation settings for Vim and Emacs and unique identifier for Arch, a
dnl version control system. Please do not modify past this point.

dnl arch-tag: aba52141-47c0-40c6-8629-aa61e7bee0c7

# Local Variables:
# c-basic-offset: 3
# indent-tabs-mode: nil
# End:
#
# vim: et sts=3 sw=3