1 # Copyright (C) 1999-2002 Erik de Castro Lopo (erikd AT zip DOT com DOT au).
3 dnl Require autoconf version
7 AC_CONFIG_SRCDIR([src/sndfile.c])
8 AC_CANONICAL_TARGET([])
9 AM_INIT_AUTOMAKE(libsndfile,1.0.5)
10 AM_CONFIG_HEADER(src/config.h)
12 #------------------------------------------------------------------------------------
13 # This is the version info according to the libtool versioning system.
15 SHARED_VERSION_INFO="1:5:0"
17 AC_CHECK_PROG(autogen, autogen, yes, no)
28 AC_CHECK_HEADERS(endian.h)
29 AC_CHECK_HEADERS(stdint.h)
31 #====================================================================================
32 # Couple of initializations here. Fill in real values later.
36 #====================================================================================
37 # Finished checking, handle options.
39 AC_ARG_ENABLE(experimental,
40 [ --enable-experimental enable experimental code ],
41 ac_arg_experimental=yes, ac_arg_experimental=no)
44 if test x$ac_arg_experimental = xyes ; then
47 AC_DEFINE_UNQUOTED([ENABLE_EXPERIMENTAL_CODE],${EXPERIMENTAL_CODE}, [Set to 1 to enable experimental code.])
49 AC_ARG_ENABLE(gcc-pipe,
50 [ --disable-gcc-pipe disable gcc -pipe option ],
51 ac_arg_gcc_pipe="N", ac_arg_gcc_pipe="Y")
53 AC_ARG_ENABLE(gcc-opt,
54 [ --disable-gcc-opt disable gcc optimisations ],
55 ac_arg_gcc_opt="N", ac_arg_gcc_opt="Y")
57 if test x$ac_cv_c_compiler_gnu = xyes ; then
58 CFLAGS="$CFLAGS -W -Wall -pedantic -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast"
59 # -Wpointer-arith -Wundef -Wmissing-declarations -Winline -Wconversion"
60 if test "$ac_arg_gcc_opt" = "N" ; then
61 temp_CFLAGS=`echo $CFLAGS | sed "s/O2/O0/"`
63 AC_MSG_WARN([[*** Compiler optimisations switched off. ***]])
66 # Disable -Wall and -pedantic for Apple Darwin/Rhapsody.
67 # System headers on these systems are broken.
70 temp_CFLAGS=`echo $CFLAGS | sed "s/-Wall -pedantic//"`
74 SHLIB_VERSION_ARG="-Wl,--version-script=Version_script"
79 if test $ac_arg_gcc_pipe != "N" ; then
80 CFLAGS="$CFLAGS -pipe"
83 AC_DEFINE([COMPILER_IS_GCC],1, [Set to 1 if the compile is GNU GCC.])
84 GCC_MAJOR_VERSION=`$CC -dumpversion | sed "s/\..*//"`
85 AC_DEFINE_UNQUOTED([GCC_MAJOR_VERSION],${GCC_MAJOR_VERSION}, [Major version of GCC or 3 otherwise.])
88 #====================================================================================
89 # Check types and their sizes.
91 AC_CHECK_SIZEOF(short,2)
92 AC_CHECK_SIZEOF(int,4)
93 AC_CHECK_SIZEOF(long,8)
94 AC_CHECK_SIZEOF(float,4)
95 AC_CHECK_SIZEOF(double,4)
96 AC_CHECK_SIZEOF(void*,8)
97 AC_CHECK_SIZEOF(size_t,4)
99 #====================================================================================
100 # Find an appropriate type for sf_count_t.
101 # On systems supporting files larger than 2 Gig, sf_count_t must be a 64 bit value.
102 # Unfortunately there is more than one way of ensuring this so need to do some
103 # pretty rigourous testing here.
105 unset ac_cv_sizeof_off_t
107 AC_CHECK_SIZEOF(off_t,1) # Fake default value.
109 if test "x$ac_cv_sizeof_off_t" = "x8" ; then
110 # If sizeof (off_t) is 8, no further checking is needed.
111 TYPEOF_SF_COUNT_T="off_t"
114 # Check for common 64 bit file offset types.
115 AC_CHECK_SIZEOF(loff_t,1) # Fake default value.
116 AC_CHECK_SIZEOF(off64_t,1) # Fake default value.
118 TYPEOF_SF_COUNT_T="unknown"
119 if test "x$ac_cv_sizeof_loff_t" = "x8" ; then
120 TYPEOF_SF_COUNT_T="loff_t"
122 elif test "x$ac_cv_sizeof_off64_t" = "x8" ; then
123 TYPEOF_SF_COUNT_T="off64_t"
127 # Save the old sizeof (off_t) value and then unset it to see if it
128 # changes when Large File Support is enabled.
130 pre_largefile_sizeof_off_t=$ac_cv_sizeof_off_t
131 unset ac_cv_sizeof_off_t
133 AC_SYS_EXTRA_LARGEFILE
135 if test "x$ac_cv_sys_largefile_CFLAGS" = "xno" ; then
136 ac_cv_sys_largefile_CFLAGS=""
138 if test "x$ac_cv_sys_largefile_LDFLAGS" = "xno" ; then
139 ac_cv_sys_largefile_LDFLAGS=""
141 if test "x$ac_cv_sys_largefile_LIBS" = "xno" ; then
142 ac_cv_sys_largefile_LIBS=""
145 AC_CHECK_SIZEOF(off_t,1) # Fake default value.
147 if test "x$ac_cv_sizeof_off_t" = "x$pre_largefile_sizeof_off_t" ; then
148 AC_MSG_WARN([[This machine does not seem to support 64 bit file offsets.]])
149 TYPEOF_SF_COUNT_T="off_t"
150 SIZEOF_SF_COUNT_T=$ac_cv_sizeof_off_t
151 elif test "x$TYPEOF_SF_COUNT_T" = "xunknown" ; then
153 echo "*** The configure process has determined that this system is capable"
154 echo "*** of Large File Support but has not been able to find a type which"
155 echo "*** is an unambiguous 64 bit file offset."
156 echo "*** Please contact the author to help resolve this problem."
158 AC_MSG_ERROR([[Bad file offset type.]])
162 AC_DEFINE_UNQUOTED([TYPEOF_SF_COUNT_T],${TYPEOF_SF_COUNT_T}, [Set to long if unknown.])
163 AC_SUBST(TYPEOF_SF_COUNT_T)
165 AC_DEFINE_UNQUOTED([SIZEOF_SF_COUNT_T],${SIZEOF_SF_COUNT_T}, [Set to sizeof (long) if unknown.])
166 AC_SUBST(SIZEOF_SF_COUNT_T)
168 #====================================================================================
169 # Determine endian-ness of target processor.
173 AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian},
174 [Target processor is big endian.])
175 AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
176 [Target processor is little endian.])
178 #====================================================================================
179 # Check for functions.
181 AC_CHECK_FUNCS(malloc calloc realloc free)
182 AC_CHECK_FUNCS(open read write lseek fstat ftruncate pread pwrite)
183 AC_CHECK_FUNCS(snprintf vsnprintf)
184 AC_CHECK_FUNCS(gmtime gmtime_r)
186 AC_CHECK_LIB([m],floor)
187 AC_CHECK_FUNCS(floor ceil fmod)
191 AC_MSG_WARN([[Not using native lrint() and lrintf() because they are missing on 10.1.]])
197 if test x$ac_cv_c99_lrint = xno || test x$ac_cv_c99_lrintf = xno ; then
198 AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]])
199 AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]])
204 #====================================================================================
205 # Find known target OS.
207 OS_SPECIFIC_INCLUDES=""
211 OS_SPECIFIC_INCLUDES="-fpascal-strings -I/Developer/Headers/FlatCarbon"
212 OS_SPECIFIC_LINKS="-framework CoreAudio"
215 OS_SPECIFIC_INCLUDES=""
220 #====================================================================================
221 # Test for sanity when cross-compiling.
223 if test $cross_compiling = yes ; then
224 AC_MSG_WARN([[******************************************************************]])
225 AC_MSG_WARN([[*** We are cross-compiling, so have to assume sizeof (short) == 2 ]])
226 AC_MSG_WARN([[*** and sizeof (int) == 4. If this is not the case there is no ]])
227 AC_MSG_WARN([[*** chance of this working. Please contact the mantainer. ]])
228 AC_MSG_WARN([[******************************************************************]])
231 if test $ac_cv_sizeof_short != 2 ; then
232 AC_MSG_WARN([[******************************************************************]])
233 AC_MSG_WARN([[*** sizeof (short) != 2. ]])
234 AC_MSG_WARN([[******************************************************************]])
237 if test $ac_cv_sizeof_int != 4 ; then
238 AC_MSG_WARN([[******************************************************************]])
239 AC_MSG_WARN([[*** sizeof (int) != 4 ]])
240 AC_MSG_WARN([[******************************************************************]])
243 if test $ac_cv_sizeof_float != 4 ; then
244 AC_MSG_WARN([[******************************************************************]])
245 AC_MSG_WARN([[*** sizeof (float) != 4. ]])
246 AC_MSG_WARN([[******************************************************************]])
249 if test $ac_cv_sizeof_double != 8 ; then
250 AC_MSG_WARN([[******************************************************************]])
251 AC_MSG_WARN([[*** sizeof (double) != 8. ]])
252 AC_MSG_WARN([[******************************************************************]])
255 if test x"$ac_cv_prog_autogen" = "xno" ; then
256 AC_MSG_WARN([[Touching files in directory tests/.]])
260 #====================================================================================
261 # Now use the information from the checking stage.
263 AC_DEFINE([OS_IS_WIN32],0, [Set to 1 if compiling for Win32])
265 if test x"$CFLAGS" = x ; then
266 echo "Error in configure script. CFLAGS has been screwed up."
270 # if test x$ac_cv_c_compiler_gnu = xyes ; then
271 # CFLAGS="$CFLAGS -Werror"
274 AC_SUBST(SHLIB_VERSION_ARG)
275 AC_SUBST(SHARED_VERSION_INFO)
276 AC_SUBST(OS_SPECIFIC_INCLUDES)
277 AC_SUBST(OS_SPECIFIC_LINKS)
278 AC_SUBST(ENABLE_EXPERIMENTAL_CODE)
280 AC_SUBST(COMPILER_IS_GCC)
281 AC_SUBST(GCC_MAJOR_VERSION)
283 AC_CONFIG_FILES([Makefile src/sndfile.h src/Version_script \
284 src/Makefile src/GSM610/Makefile src/G72x/Makefile \
285 libsndfile.spec sndfile.pc])
288 #====================================================================================
291 -=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-
293 Configuration summary :
295 Version : ..................... ${VERSION}
296 Experimental code : ........... ${ac_arg_experimental}
299 if test x$ac_cv_c_compiler_gnu = xyes ; then
301 echo " Compiler is GCC : ............. ${ac_cv_c_compiler_gnu}"
302 echo " GCC major version : ........... ${GCC_MAJOR_VERSION}"
303 if test $GCC_MAJOR_VERSION -lt 3 ; then
304 echo -e "\n ** This compiler version allows applications to write "
305 echo " ** to static strings within the library."
306 echo " ** Compile with GCC version 3.X to avoid this problem."
311 Installation directories :
313 Library directory : ........... ${prefix}/lib
314 Program directory : ........... ${prefix}/bin
315 Pkgconfig directory : ......... ${prefix}/lib/pkgconfig
318 if test x$prefix != "x/usr" ; then
319 echo "Compiling some other packages against libsndfile may require "
320 echo -e "the addition of \"${prefix}/lib/pkgconfig\" to the "
321 echo -e "PKG_CONFIG_PATH environment variable.\n"