root/branches/streaming-rework/configure.ac

Revision 400, 9.5 kB (checked in by pieterpalmers, 17 years ago)

added configure switches for enabling of device class (BeBoB, Motu, ...) support

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