root/branches/libffado-scons_porting_work/configure.ac

Revision 511, 11.8 kB (checked in by wagi, 17 years ago)

Don't use AC_PROG_CXX before CXXFLAGS are defined (AC_PROG_CXX sets '-O2 -g' by default if no CXXFLAGS is defined)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 # configure.ac - Configure script for FFADO.
2 # Copyright (C) 2005,06,07 by Daniel Wagner.
3 # Copyright (C) 2006,07 by Pieter Palmers.
4 #
5 # This file is part of FFADO.
6 # FFADO is based upon FreeBoB.
7 #
8 # FFADO is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 # FFADO is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with FFADO; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 #
20 #                                               -*- Autoconf -*-
21 # Process this file with autoconf to produce a configure script.
22
23 AC_PREREQ(2.57)
24
25
26 m4_define(ffado_major_version, 1)
27 m4_define(ffado_minor_version, 999)
28 m4_define(ffado_micro_version, 5)
29
30 m4_define(ffado_version, ffado_major_version.ffado_minor_version.ffado_micro_version)
31
32 AC_INIT(libffado, ffado_version, <ffado-devel@lists.sf.net>)
33
34 # Before making a release, the LT_VERSION string should be modified.
35 # The string is of the form C:R:A.
36 # - If interfaces have been changed or added, but binary compatibility has
37 #   been preserved, change to C+1:0:A+1
38 # - If binary compatibility has been broken (eg removed or changed interfaces)
39 #   change to C+1:0:0
40 # - If the interface is the same as the previous version, change to C:R+1:A
41
42
43 LT_VERSION=1:0:0
44 AC_SUBST(LT_VERSION)
45
46 AC_DEFINE(FFADO_MAJOR_VERSION, ffado_major_version,[FFADO major version])
47 AC_DEFINE(FFADO_MINOR_VERSION, ffado_minor_version,[FFADO minor version])
48 AC_DEFINE(FFADO_MICRO_VERSION, ffado_micro_version,[FFADO micro version])
49 AC_SUBST(FFADO_MINOR_VERSION, ffado_minor_version)
50 AC_SUBST(FFADO_MAJOR_VERSION, ffado_major_version)
51 AC_SUBST(FFADO_MICRO_VERSION, ffado_micro_version)
52
53 AM_INIT_AUTOMAKE([subdir-objects])
54 AM_MAINTAINER_MODE
55 AC_CONFIG_SRCDIR([src/ffado.cpp])
56 AC_CONFIG_HEADER([config.h])
57 AC_GNU_SOURCE
58 AC_LANG(C++)
59
60 # Prefix handling
61 AC_MSG_CHECKING(prefix)
62 defaultprefix=/usr/local
63 if test -z "$prefix" -o "$prefix" = "NONE"; then
64         prefix=$defaultprefix
65 fi
66 AC_PREFIX_DEFAULT($prefix)
67 AC_MSG_RESULT($prefix)
68
69 maintainer_mode=${enable_maintainer_mode-no}
70
71 # Checks for programs.
72 # AC_PROG_CC and AC_PROG_CXX will add by default "-g -O2" if
73 # CFLAGS and CXXFLAGS do not exists.  Disable this feature.
74 test ".$CFLAGS" = "." && CFLAGS=""
75 test ".$CXXFLAGS" = "." && CXXFLAGS=""
76 AC_PROG_CC
77 AC_PROG_CXX
78 AM_PROG_AS
79 AM_PROG_CC_C_O
80 AC_PROG_LIBTOOL
81 AC_CHECK_TOOL([AR], [ar], :)
82 AC_CHECK_TOOL([NM], [nm], :)
83 AC_PATH_PROG([SED], [sed], :)
84 AC_PATH_PROG([SORT], [sort], :)
85
86 # Required for building the documentation
87
88 # Checks for libraries.
89 AC_PROG_LIBTOOL
90
91 # Checks for typedefs, structures, and compiler characteristics.
92 AC_CANONICAL_HOST
93 AC_C_CONST
94 AC_C_VOLATILE
95 AC_TYPE_SIZE_T
96
97 # XXX Debian specific hack:
98 # by Marcelo Magallon <mmagallo@efis.ucr.ac.cr>
99 # Turn around -rpath problem with libtool 1.0c
100 # This define should be improbable enough to not conflict with anything
101 case ${host} in
102   *-pc-linux-gnu)
103     AC_MSG_RESULT([Fixing libtool for -rpath problems.])
104     sed < libtool > libtool-2 \
105     's/^hardcode_libdir_flag_spec.*$/hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ "/'
106     mv libtool-2 libtool
107     chmod 755 libtool
108   ;;
109 esac
110
111 AC_CHECK_LIB(pthread, pthread_create,,
112 [
113         AC_ERROR(You need the pthread library to compile ffado)
114 ])
115
116 # Check for dependencies
117 PKG_CHECK_MODULES(LIBRAW1394, libraw1394 >= 1.3.0)
118 PKG_CHECK_MODULES(LIBIEC61883, libiec61883 >= 1.1.0)
119 PKG_CHECK_MODULES(LIBAVC1394, libavc1394 >= 0.5.3)
120 PKG_CHECK_MODULES(ALSA, alsa >= 1.0.0)
121 PKG_CHECK_MODULES(LIBXMLCPP, libxml++-2.6 >= 2.14.0)
122 PKG_CHECK_MODULES(LIBLO, liblo >= 0.22)
123
124 # Setup CFLAGS and CXXFLAGS
125 AC_ARG_ENABLE(debug,
126     AC_HELP_STRING([--enable-debug],
127                    [Turn on debugging]),
128 [case "${enableval}" in
129   yes) debug=true;;
130   no)  ;;
131   *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
132 esac],[debug=false])
133
134 dnl Check for MMX assembly
135
136 AC_ARG_ENABLE(mmx,
137     AC_HELP_STRING([--enable-mmx],
138                    [enable MMX support (default=auto)]),,
139     enable_mmx=yes)
140
141 AC_ARG_ENABLE(sse,
142     AC_HELP_STRING([--enable-sse],
143                    [enable SSE support (default=auto)]),,
144     enable_sse=$enable_mmx)
145
146 if test "x$enable_mmx" = xyes; then
147    
148     AC_MSG_CHECKING(whether we can compile MMX code)
149    
150     AC_COMPILE_IFELSE([asm ("movq 0, %mm0");],
151        
152         AC_DEFINE(USE_MMX, 1, [Define to 1 if MMX assembly is available.])
153         AC_MSG_RESULT(yes)
154         MMX_FLAGS="-mmmx -DENABLE_MMX"
155        
156         if test "x$enable_sse" = xyes; then
157              
158               AC_MSG_CHECKING(whether we can compile SSE code)
159              
160               AC_COMPILE_IFELSE([asm ("movntps %xmm0, 0");],
161                   AC_DEFINE(USE_SSE, 1,
162                             [Define to 1 if SSE assembly is available.])
163                   SSE_FLAGS="-msse -mfpmath=sse -DENABLE_SSE"
164                   AC_MSG_RESULT(yes)
165                   ,
166                   enable_sse=no
167                   AC_MSG_RESULT(no)
168                   AC_MSG_WARN(
169                       [The assembler does not support the SSE command set.]
170                   )
171               )
172              
173           fi
174           ,
175           enable_mmx=no
176           AC_MSG_RESULT(no)
177           AC_MSG_WARN([The assembler does not support the MMX command set.])
178       )
179   fi
180
181   AC_DEFINE(x86, 1, "Nope it's intel")
182   COMMON_X86_OPT_FLAGS="-DREENTRANT -O3 -fomit-frame-pointer -ffast-math -funroll-loops"
183
184   if test "$target_cpu" = "i586"; then
185       FFADO_OPT_CFLAGS="-march=i586 "
186   elif test "$target_cpu" = "i686"; then
187       FFADO_OPT_CFLAGS="-march=i686"
188   else
189       :
190   fi
191
192   FFADO_OPT_CFLAGS="$COMMON_X86_OPT_FLAGS $FFADO_OPT_CFLAGS $MMX_FLAGS $SSE_FLAGS"
193
194
195 AC_ARG_ENABLE(optimize,
196     AC_HELP_STRING([--enable-optimize],
197                    [ask the compiler for its best optimizations]),
198     [ if test x$enable_optimize != xno ; then
199         CFLAGS="$CFLAGS $FFADO_OPT_CFLAGS" ;
200         CXXFLAGS="$CXXFLAGS $FFADO_OPT_CFLAGS"
201       fi
202     ]
203 )
204
205 dnl Conditional compilation of targets
206
207 dnl --- Build BeBoB code?
208
209 AC_ARG_ENABLE(bebob,
210     AC_HELP_STRING([--enable-bebob],
211                    [build BeBoB support (default=yes)]),
212 [case "${enableval}" in
213   yes) build_bebob=true;;
214   no)  build_bebob=false;;
215   *) AC_MSG_ERROR(bad value ${enableval} for --enable-bebob) ;;
216 esac],
217 [build_bebob=true])
218
219 dnl --- Build Motu code?
220
221 AC_ARG_ENABLE(motu,
222     AC_HELP_STRING([--enable-motu],
223                    [build Motu support (default=no)]),
224 [case "${enableval}" in
225   yes) build_motu=true;;
226   no)  build_motu=false;;
227   *) AC_MSG_ERROR(bad value ${enableval} for --enable-motu) ;;
228 esac],
229 [build_motu=false])
230
231 dnl --- Build DICE code?
232
233 AC_ARG_ENABLE(dice,
234     AC_HELP_STRING([--enable-dice],
235                    [build DICE support (default=no)]),
236 [case "${enableval}" in
237   yes) build_dice=true;;
238   no)  build_dice=false;;
239   *) AC_MSG_ERROR(bad value ${enableval} for --enable-dice) ;;
240 esac],
241 [build_dice=false])
242
243 dnl --- Build Metric Halo code?
244
245 AC_ARG_ENABLE(metric-halo,
246     AC_HELP_STRING([--enable-metric-halo],
247                    [build Metric Halo support (note: completely useless) (default=no)]),
248 [case "${enableval}" in
249   yes) build_metric_halo=true;;
250   no)  build_metric_halo=false;;
251   *) AC_MSG_ERROR(bad value ${enableval} for --enable-metric-halo) ;;
252 esac],
253 [build_metric_halo=false])
254
255 dnl --- Build Metric Halo code?
256
257 AC_ARG_ENABLE(rme,
258     AC_HELP_STRING([--enable-rme],
259                    [build RME support (note: completely useless) (default=no)]),
260 [case "${enableval}" in
261   yes) build_rme=true;;
262   no)  build_rme=false;;
263   *) AC_MSG_ERROR(bad value ${enableval} for --enable-rme) ;;
264 esac],
265 [build_rme=false])
266
267 dnl --- Build Bounce device code?
268
269 AC_ARG_ENABLE(bounce,
270     AC_HELP_STRING([--enable-bounce],
271                    [build Bounce device support (default=no)]),
272 [case "${enableval}" in
273   yes) build_bounce=true;;
274   no)  build_bounce=false;;
275   *) AC_MSG_ERROR(bad value ${enableval} for --enable-bounce) ;;
276 esac],
277 [build_bounce=false])
278
279 dnl --- Build support for all supported devices?
280
281 AC_ARG_ENABLE(all-devices,
282     AC_HELP_STRING([--enable-all-devices],
283                    [build support for all supported devices (default=no)]),
284 [case "${enableval}" in
285   yes) build_all=true;;
286   no)  build_all=false;;
287   *) AC_MSG_ERROR(bad value ${enableval} for --enable-all-devices) ;;
288 esac],
289 [build_all=false])
290
291 AC_ARG_ENABLE(tests,
292     AC_HELP_STRING([--enable-tests],
293                    [build programs in the tests directory (default=yes)]),
294 [case "${enableval}" in
295   yes) build_tests=true;;
296   no)  build_tests=false;;
297   *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;;
298 esac],
299 [build_tests=true])
300
301 CFLAGS="$CFLAGS -Wall -std=gnu99"
302 CXXFLAGS="$CXXFLAGS -Wall -DDATADIR=\\\"\$(datadir)\\\"  -DCACHEDIR=\\\"\$(localstatedir)\\\""
303 if test "${debug}" = true; then
304    CFLAGS="$CFLAGS -g -DDEBUG"
305    CXXFLAGS="$CXXFLAGS -g -DDEBUG"
306 else
307    CFLAGS="$CFLAGS -O2"
308    CXXFLAGS="$CXXFLAGS -O2"
309 fi;
310
311 dnl Device classes
312 if test "${build_all}" = true; then
313     build_bebob=true
314     build_motu=true
315     build_dice=true
316     build_metric_halo=true
317     build_bounce=true
318     build_rme=true
319 fi;
320
321 build_amdtp=false
322
323 if test "${build_bebob}" = true; then
324    CFLAGS="$CFLAGS -DENABLE_BEBOB"
325    CXXFLAGS="$CXXFLAGS -DENABLE_BEBOB"
326    supported_devices="${supported_devices}BeBoB  "
327    build_amdtp=true
328 fi;
329
330 if test "${build_motu}" = true; then
331    CFLAGS="$CFLAGS -DENABLE_MOTU"
332    CXXFLAGS="$CXXFLAGS -DENABLE_MOTU"
333    supported_devices="${supported_devices}Motu  "
334 fi;
335
336 if test "${build_dice}" = true; then
337    CFLAGS="$CFLAGS -DENABLE_DICE"
338    CXXFLAGS="$CXXFLAGS -DENABLE_DICE"
339    supported_devices="${supported_devices}DICE  "
340    build_amdtp=true
341 fi;
342
343 if test "${build_metric_halo}" = true; then
344    CFLAGS="$CFLAGS -DENABLE_METRIC_HALO"
345    CXXFLAGS="$CXXFLAGS -DENABLE_METRIC_HALO"
346    supported_devices="${supported_devices}Metric Halo (useless)  "
347 fi;
348
349 if test "${build_bounce}" = true; then
350    CFLAGS="$CFLAGS -DENABLE_BOUNCE"
351    CXXFLAGS="$CXXFLAGS -DENABLE_BOUNCE"
352    supported_devices="${supported_devices}Bounce  "
353    build_amdtp=true
354 fi;
355
356 if test "${build_rme}" = true; then
357    CFLAGS="$CFLAGS -DENABLE_RME"
358    CXXFLAGS="$CXXFLAGS -DENABLE_RME"
359    supported_devices="${supported_devices}RME (useless)  "
360 fi;
361
362 if test "${supported_devices}" = ""; then
363     AC_ERROR(You need to enable at least one device class to support!)
364 fi;
365
366 AM_CONDITIONAL(BUILD_BEBOB,test "${build_bebob}" = true)
367 AM_CONDITIONAL(BUILD_MOTU,test "${build_motu}" = true)
368 AM_CONDITIONAL(BUILD_DICE,test "${build_dice}" = true)
369 AM_CONDITIONAL(BUILD_METRIC_HALO,test "${build_metric_halo}" = true)
370 AM_CONDITIONAL(BUILD_BOUNCE,test "${build_bounce}" = true)
371 AM_CONDITIONAL(BUILD_RME,test "${build_rme}" = true)
372
373 AM_CONDITIONAL(BUILD_AMDTP,test "${build_amdtp}" = true)
374
375 AM_CONDITIONAL(BUILD_TESTS,test "${build_tests}" = true)
376
377 AC_SUBST([CFLAGS])
378 AC_SUBST([CXXFLAGS])
379
380 # Configure components.
381 AC_ENABLE_STATIC(yes)
382 AC_ENABLE_SHARED(yes)
383
384 AC_SUBST([LIBSIGC_CFLAGS])
385 AC_SUBST([LIBSIGC_LIBS])
386 AC_SUBST([ALSA_CFLAGS])
387 AC_SUBST([ALSA_LIBS])
388 AC_SUBST([LIBRAW1394_CFLAGS])
389 AC_SUBST([LIBRAW1394_LIBS])
390 AC_SUBST([LIBIEC61883_CFLAGS])
391 AC_SUBST([LIBIEC61883_LIBS])
392 AC_SUBST([LIBAVC1394_CFLAGS])
393 AC_SUBST([LIBAVC1394_LIBS])
394 AC_SUBST([LIBLO_LIBS])
395 AC_SUBST([LIBLO_CFLAGS])
396
397 AC_SUBST([BIN_PROGRAMS])
398
399 AC_CONFIG_FILES([Makefile
400                  doc/Makefile
401                  doc/reference.doxygen
402                  libffado/Makefile
403                  src/Makefile
404                  tests/Makefile
405                  tests/streaming/Makefile
406                  libffado.pc])
407
408 AC_OUTPUT
409
410 # Print a summary so that important information isn't missed.
411 AC_MSG_RESULT([
412
413 FFADO $VERSION is now configured for $canonical_host_type
414
415   Building support for: $supported_devices
416    build AMDTP support: $build_amdtp
417    
418   Building tests:       $build_tests
419
420   Source directory:     $srcdir
421   Installation prefix:  $prefix
422   C compiler:           $CC $CFLAGS
423   C++ compiler:         $CXX $CXXFLAGS
424
425   libraw1394 CFLAGS:    $LIBRAW1394_CFLAGS
426   libraw1394 LIBS:      $LIBRAW1394_LIBS
427   libiec61883 CFLAGS:   $LIBIEC61883_CFLAGS
428   libiec61883 LIBS:     $LIBIEC61883_LIBS
429   libavc1394 CFLAGS:    $LIBAVC1394_CFLAGS
430   libavc1394 LIBS:      $LIBAVC1394_LIBS
431 ])
Note: See TracBrowser for help on using the browser.