root/trunk/libffado/configure.ac

Revision 470, 11.8 kB (checked in by ppalmers, 16 years ago)

At the moment, if there is no C++ compiler installed, ./configure will
abort with an error about libpthread. This change makes the problem
more obvious.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

  • 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 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, 4)
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 LT_VERSION=1:0:0
43 AC_SUBST(LT_VERSION)
44
45 AC_DEFINE(FFADO_MAJOR_VERSION, ffado_major_version,[FFADO major version])
46 AC_DEFINE(FFADO_MINOR_VERSION, ffado_minor_version,[FFADO minor version])
47 AC_DEFINE(FFADO_MICRO_VERSION, ffado_micro_version,[FFADO micro version])
48 AC_SUBST(FFADO_MINOR_VERSION, ffado_minor_version)
49 AC_SUBST(FFADO_MAJOR_VERSION, ffado_major_version)
50 AC_SUBST(FFADO_MICRO_VERSION, ffado_micro_version)
51
52 AM_INIT_AUTOMAKE([subdir-objects])
53 AM_MAINTAINER_MODE
54 AC_CONFIG_SRCDIR([src/ffado.cpp])
55 AC_CONFIG_HEADER([config.h])
56 AC_GNU_SOURCE
57 AC_LANG(C++)
58 AC_PROG_CXX
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)\\\""
303
304 if test "${debug}" = true; then
305    CFLAGS="$CFLAGS -g -DDEBUG"
306    CXXFLAGS="$CXXFLAGS -g -DDEBUG"
307 else
308    CFLAGS="$CFLAGS -O2"
309    CXXFLAGS="$CXXFLAGS -O2"
310 fi;
311
312 dnl Device classes
313 if test "${build_all}" = true; then
314     build_bebob=true
315     build_motu=true
316     build_dice=true
317     build_metric_halo=true
318     build_bounce=true
319     build_rme=true
320 fi;
321
322 build_amdtp=false
323
324 if test "${build_bebob}" = true; then
325    CFLAGS="$CFLAGS -DENABLE_BEBOB"
326    CXXFLAGS="$CXXFLAGS -DENABLE_BEBOB"
327    supported_devices="${supported_devices}BeBoB  "
328    build_amdtp=true
329 fi;
330
331 if test "${build_motu}" = true; then
332    CFLAGS="$CFLAGS -DENABLE_MOTU"
333    CXXFLAGS="$CXXFLAGS -DENABLE_MOTU"
334    supported_devices="${supported_devices}Motu  "
335 fi;
336
337 if test "${build_dice}" = true; then
338    CFLAGS="$CFLAGS -DENABLE_DICE"
339    CXXFLAGS="$CXXFLAGS -DENABLE_DICE"
340    supported_devices="${supported_devices}DICE  "
341    build_amdtp=true
342 fi;
343
344 if test "${build_metric_halo}" = true; then
345    CFLAGS="$CFLAGS -DENABLE_METRIC_HALO"
346    CXXFLAGS="$CXXFLAGS -DENABLE_METRIC_HALO"
347    supported_devices="${supported_devices}Metric Halo (useless)  "
348 fi;
349
350 if test "${build_bounce}" = true; then
351    CFLAGS="$CFLAGS -DENABLE_BOUNCE"
352    CXXFLAGS="$CXXFLAGS -DENABLE_BOUNCE"
353    supported_devices="${supported_devices}Bounce  "
354    build_amdtp=true
355 fi;
356
357 if test "${build_rme}" = true; then
358    CFLAGS="$CFLAGS -DENABLE_RME"
359    CXXFLAGS="$CXXFLAGS -DENABLE_RME"
360    supported_devices="${supported_devices}RME (useless)  "
361 fi;
362
363 if test "${supported_devices}" = ""; then
364     AC_ERROR(You need to enable at least one device class to support!)
365 fi;
366
367 AM_CONDITIONAL(BUILD_BEBOB,test "${build_bebob}" = true)
368 AM_CONDITIONAL(BUILD_MOTU,test "${build_motu}" = true)
369 AM_CONDITIONAL(BUILD_DICE,test "${build_dice}" = true)
370 AM_CONDITIONAL(BUILD_METRIC_HALO,test "${build_metric_halo}" = true)
371 AM_CONDITIONAL(BUILD_BOUNCE,test "${build_bounce}" = true)
372 AM_CONDITIONAL(BUILD_RME,test "${build_rme}" = true)
373
374 AM_CONDITIONAL(BUILD_AMDTP,test "${build_amdtp}" = true)
375
376 AM_CONDITIONAL(BUILD_TESTS,test "${build_tests}" = true)
377
378 AC_SUBST([CFLAGS])
379 AC_SUBST([CXXFLAGS])
380
381 # Configure components.
382 AC_ENABLE_STATIC(yes)
383 AC_ENABLE_SHARED(yes)
384
385 AC_SUBST([LIBSIGC_CFLAGS])
386 AC_SUBST([LIBSIGC_LIBS])
387 AC_SUBST([ALSA_CFLAGS])
388 AC_SUBST([ALSA_LIBS])
389 AC_SUBST([LIBRAW1394_CFLAGS])
390 AC_SUBST([LIBRAW1394_LIBS])
391 AC_SUBST([LIBIEC61883_CFLAGS])
392 AC_SUBST([LIBIEC61883_LIBS])
393 AC_SUBST([LIBAVC1394_CFLAGS])
394 AC_SUBST([LIBAVC1394_LIBS])
395 AC_SUBST([LIBLO_LIBS])
396 AC_SUBST([LIBLO_CFLAGS])
397
398 AC_SUBST([BIN_PROGRAMS])
399
400 AC_CONFIG_FILES([Makefile
401                  doc/Makefile
402                  doc/reference.doxygen
403                  libffado/Makefile
404                  src/Makefile
405                  tests/Makefile
406                  tests/streaming/Makefile
407                  libffado.pc])
408
409 AC_OUTPUT
410
411 # Print a summary so that important information isn't missed.
412 AC_MSG_RESULT([
413
414 FFADO $VERSION is now configured for $canonical_host_type
415
416   Building support for: $supported_devices
417    build AMDTP support: $build_amdtp
418    
419   Building tests:       $build_tests
420
421   Source directory:     $srcdir
422   Installation prefix:  $prefix
423   C compiler:           $CC $CFLAGS
424   C++ compiler:         $CXX $CXXFLAGS
425
426   libraw1394 CFLAGS:    $LIBRAW1394_CFLAGS
427   libraw1394 LIBS:      $LIBRAW1394_LIBS
428   libiec61883 CFLAGS:   $LIBIEC61883_CFLAGS
429   libiec61883 LIBS:     $LIBIEC61883_LIBS
430   libavc1394 CFLAGS:    $LIBAVC1394_CFLAGS
431   libavc1394 LIBS:      $LIBAVC1394_LIBS
432 ])
Note: See TracBrowser for help on using the browser.