root/branches/libfreebob-1.0/configure.ac

Revision 468, 7.2 kB (checked in by ppalmers, 15 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 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 m4_define(freebob_major_version, 1)
25 m4_define(freebob_minor_version, 0)
26 m4_define(freebob_micro_version, 3)
27
28 m4_define(freebob_version, freebob_major_version.freebob_minor_version.freebob_micro_version)
29
30 AC_INIT(libfreebob, freebob_version, <freebob-devel@lists.sf.net>)
31
32 # Before making a release, the LT_VERSION string should be modified.
33 # The string is of the form C:R:A.
34 # - If interfaces have been changed or added, but binary compatibility has
35 #   been preserved, change to C+1:0:A+1
36 # - If binary compatibility has been broken (eg removed or changed interfaces)
37 #   change to C+1:0:0
38 # - If the interface is the same as the previous version, change to C:R+1:A
39
40 LT_VERSION=1:0:1
41 AC_SUBST(LT_VERSION)
42
43 AC_DEFINE(FREEBOB_MAJOR_VERSION, freebob_major_version,[Freebob major version])
44 AC_DEFINE(FREEBOB_MINOR_VERSION, freebob_minor_version,[Freebob minor version])
45 AC_DEFINE(FREEBOB_MICRO_VERSION, freebob_micro_version,[Freebob micro version])
46 AC_SUBST(FREEBOB_MINOR_VERSION, freebob_minor_version)
47 AC_SUBST(FREEBOB_MAJOR_VERSION, freebob_major_version)
48 AC_SUBST(FREEBOB_MICRO_VERSION, freebob_micro_version)
49
50 AM_INIT_AUTOMAKE([subdir-objects])
51 AM_MAINTAINER_MODE
52 AC_CONFIG_SRCDIR([src/freebob.cpp])
53 AC_CONFIG_HEADER([config.h])
54 AC_GNU_SOURCE
55 AC_LANG(C++)
56 AC_PROG_CXX
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.2.1)
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
121 # Setup CFLAGS and CXXFLAGS
122 AC_ARG_ENABLE(debug,
123 [  --enable-debug    Turn on debugging],
124 [case "${enableval}" in
125   yes) debug=true;;
126   no)  ;;
127   *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
128 esac],[debug=false])
129
130
131 dnl Check for MMX assembly
132
133 AC_ARG_ENABLE(mmx,
134     [  --enable-mmx            enable MMX support (default=auto)],,
135     enable_mmx=yes)
136
137 AC_ARG_ENABLE(sse,
138     [  --enable-sse            enable SSE support (default=auto)],,
139     enable_sse=$enable_mmx)
140
141 if test "x$enable_mmx" = xyes; then
142    
143     AC_MSG_CHECKING(whether we can compile MMX code)
144    
145     AC_COMPILE_IFELSE([asm ("movq 0, %mm0");],
146        
147         AC_DEFINE(USE_MMX, 1, [Define to 1 if MMX assembly is available.])
148         AC_MSG_RESULT(yes)
149         MMX_FLAGS="-mmmx -DENABLE_MMX"
150        
151         if test "x$enable_sse" = xyes; then
152              
153               AC_MSG_CHECKING(whether we can compile SSE code)
154              
155               AC_COMPILE_IFELSE([asm ("movntps %xmm0, 0");],
156                   AC_DEFINE(USE_SSE, 1,
157                             [Define to 1 if SSE assembly is available.])
158                   SSE_FLAGS="-msse -mfpmath=sse -DENABLE_SSE"
159                   AC_MSG_RESULT(yes)
160                   ,
161                   enable_sse=no
162                   AC_MSG_RESULT(no)
163                   AC_MSG_WARN(
164                       [The assembler does not support the SSE command set.]
165                   )
166               )
167              
168           fi
169           ,
170           enable_mmx=no
171           AC_MSG_RESULT(no)
172           AC_MSG_WARN([The assembler does not support the MMX command set.])
173       )
174   fi
175
176   AC_DEFINE(x86, 1, "Nope it's intel")
177   COMMON_X86_OPT_FLAGS="-DREENTRANT -O3 -fomit-frame-pointer -ffast-math -funroll-loops"
178
179   if test "$target_cpu" = "i586"; then
180       FREEBOB_OPT_CFLAGS="-march=i586 "
181   elif test "$target_cpu" = "i686"; then
182       FREEBOB_OPT_CFLAGS="-march=i686"
183   else
184       :
185   fi
186
187   FREEBOB_OPT_CFLAGS="$COMMON_X86_OPT_FLAGS $FREEBOB_OPT_CFLAGS $MMX_FLAGS $SSE_FLAGS"
188
189
190 AC_ARG_ENABLE(optimize,
191     AC_HELP_STRING([--enable-optimize],
192                    [ask the compiler for its best optimizations]),
193     [ if test x$enable_optimize != xno ; then
194         CFLAGS="$CFLAGS $FREEBOB_OPT_CFLAGS" ;
195         CXXFLAGS="$CXXFLAGS $FREEBOB_OPT_CFLAGS"
196       fi
197     ]
198 )
199
200
201 CFLAGS="$CFLAGS -Wall -std=gnu99"
202 CXXFLAGS="$CXXFLAGS -Wall"
203
204 if test "${debug}" = true; then
205    CFLAGS="$CFLAGS -g -DDEBUG"
206    CXXFLAGS="$CXXFLAGS -g -DDEBUG"
207 else
208    CFLAGS="$CFLAGS -O2"
209    CXXFLAGS="$CXXFLAGS -O2"
210 fi;
211
212 AC_SUBST([CFLAGS])
213 AC_SUBST([CXXFLAGS])
214
215 # Configure components.
216 AC_ENABLE_STATIC(yes)
217 AC_ENABLE_SHARED(yes)
218
219 AC_SUBST([LIBSIGC_CFLAGS])
220 AC_SUBST([LIBSIGC_LIBS])
221 AC_SUBST([ALSA_CFLAGS])
222 AC_SUBST([ALSA_LIBS])
223 AC_SUBST([LIBRAW1394_CFLAGS])
224 AC_SUBST([LIBRAW1394_LIBS])
225 AC_SUBST([LIBIEC61883_CFLAGS])
226 AC_SUBST([LIBIEC61883_LIBS])
227 AC_SUBST([LIBAVC1394_CFLAGS])
228 AC_SUBST([LIBAVC1394_LIBS])
229 AC_SUBST([LIBXML_LIBS])
230 AC_SUBST([LIBXML_CFLAGS])
231
232 AC_CONFIG_FILES([Makefile
233                  libfreebob/Makefile
234                  src/Makefile
235                  tests/Makefile
236                  tests/streaming/Makefile
237                  libfreebob.pc])
238
239 AC_OUTPUT
240
241 # Print a summary so that important information isn't missed.
242 AC_MSG_RESULT([
243
244 FreeBoB $VERSION is now configured for $canonical_host_type
245
246   Source directory:     $srcdir
247   Installation prefix:  $prefix
248   C++ compiler:         $CXX $CXXFLAGS
249
250   libraw1394 CFLAGS:    $LIBRAW1394_CFLAGS
251   libraw1394 LIBS:      $LIBRAW1394_LIBS
252   libiec61883 CFLAGS:   $LIBIEC61883_CFLAGS
253   libiec61883 LIBS:     $LIBIEC61883_LIBS
254   libavc1394 CFLAGS:    $LIBAVC1394_CFLAGS
255   libavc1394 LIBS:      $LIBAVC1394_LIBS
256 ])
Note: See TracBrowser for help on using the browser.