Let Makefile.lite build succeed on FreeBSD amd64
[flac.git] / configure.ac
index dae619e..46cb916 100644 (file)
 # instead of FLAC__ since autoconf triggers off 'AC_' in strings
 
 AC_PREREQ(2.60)
-AC_INIT([flac], [1.3.0], [flac-dev@xiph.org], [flac], [https://www.xiph.org/flac/])
+AC_INIT([flac], [1.3.1], [flac-dev@xiph.org], [flac], [https://www.xiph.org/flac/])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_SRCDIR([src/flac/main.c])
 AC_CONFIG_MACRO_DIR([m4])
-AM_INIT_AUTOMAKE([foreign 1.11 -Wall tar-pax no-dist-gzip dist-xz subdir-objects])
+AM_INIT_AUTOMAKE([foreign 1.10 -Wall tar-pax no-dist-gzip dist-xz subdir-objects])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 user_cflags=$CFLAGS
@@ -67,6 +67,7 @@ AC_CHECK_HEADERS([stdint.h inttypes.h byteswap.h sys/param.h termios.h x86intrin
 AC_HEADER_TIOCGWINSZ
 
 XIPH_C_BSWAP32
+XIPH_C_BSWAP16
 
 ac_cv_c_big_endian=0
 ac_cv_c_little_endian=0
@@ -103,20 +104,31 @@ AC_CHECK_SIZEOF(void*,1)
 
 asm_optimisation=no
 case "$host_cpu" in
-       x86_64)
-               if test $ac_cv_sizeof_voidp = 4 ; then
-                       # This must be a 32 bit user space running on 64 bit kernel so treat
-                       # this as ia32.
-                       cpu_ia32=true
-                       AC_DEFINE(FLAC__CPU_IA32)
-                       AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
-               else
-                       # x86_64 user space and kernel.
-                       cpu_x86_64=true
-                       AC_DEFINE(FLAC__CPU_X86_64)
-                       AH_TEMPLATE(FLAC__CPU_X86_64, [define if building for x86_64])
-                       fi
-               asm_optimisation=$asm_opt
+       amd64|x86_64)
+               case "$host" in
+                       *gnux32)
+                               # x32 user space and 64 bit kernel.
+                               cpu_x86_64=true
+                               AC_DEFINE(FLAC__CPU_X86_64)
+                               AH_TEMPLATE(FLAC__CPU_X86_64, [define if building for x86_64])
+                               asm_optimisation=$asm_opt
+                               ;;
+                       *)
+                               if test $ac_cv_sizeof_voidp = 4 ; then
+                                       # This must be a 32 bit user space running on 64 bit kernel so treat
+                                       # this as ia32.
+                                       cpu_ia32=true
+                                       AC_DEFINE(FLAC__CPU_IA32)
+                                       AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
+                       else
+                                       # x86_64 user space and kernel.
+                                       cpu_x86_64=true
+                                       AC_DEFINE(FLAC__CPU_X86_64)
+                                       AH_TEMPLATE(FLAC__CPU_X86_64, [define if building for x86_64])
+                               fi
+                               asm_optimisation=$asm_opt
+                               ;;
+               esac
                ;;
        i*86)
                cpu_ia32=true
@@ -142,7 +154,9 @@ AM_CONDITIONAL(FLaC__CPU_IA32, test "x$cpu_ia32" = xtrue)
 AM_CONDITIONAL(FLaC__CPU_PPC, test "x$cpu_ppc" = xtrue)
 AM_CONDITIONAL(FLaC__CPU_SPARC, test "x$cpu_sparc" = xtrue)
 
-AC_DEFINE_UNQUOTED([FLAC__HAS_X86INTRIN],${HAVE_X86INTRIN_H}, [Set to 1 if <x86intrin.h> is available.])
+if test "x$ac_cv_header_x86intrin_h" = xyes; then
+AC_DEFINE([FLAC__HAS_X86INTRIN], 1, [Set to 1 if <x86intrin.h> is available.])
+fi
 
 case "$host" in
        i386-*-openbsd3.[[0-3]]) OBJ_FORMAT=aoutb ;;
@@ -207,7 +221,7 @@ AC_HELP_STRING([--disable-sse], [Disable SSE if the OS does not support SSE inst
        no)  sse_os=no ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
 esac],[sse_os=yes])
-AM_CONDITIONAL(FLaC__SSE_OS, test "x$sse_os" = xtrue)
+AM_CONDITIONAL(FLaC__SSE_OS, test "x$sse_os" = xyes)
 if test "x$sse_os" = xyes ; then
 AC_DEFINE(FLAC__SSE_OS)
 AH_TEMPLATE(FLAC__SSE_OS, [define if your operating system supports SSE instructions])
@@ -347,11 +361,10 @@ fi
 
 if test "x$debug" = xtrue; then
        CPPFLAGS="-DDEBUG $CPPFLAGS"
-       CFLAGS=$(echo "$CFLAGS" | sed 's/-g//')
        CFLAGS="-g $CFLAGS"
 else
        CPPFLAGS="-DNDEBUG $CPPFLAGS"
-       CFLAGS=$(echo "$CFLAGS" | sed 's/-O2//;s/-g//')
+       CFLAGS=$(echo "$CFLAGS" | sed 's/-O2//')
        CFLAGS="-O3 -funroll-loops $CFLAGS"
 fi
 
@@ -384,12 +397,23 @@ if test x$ac_cv_c_compiler_gnu = xyes ; then
                XIPH_ADD_CFLAGS([-fgnu89-inline])
                fi
 
+       if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x47" ; then
+               XIPH_ADD_CFLAGS([-fno-inline-small-functions])
+               fi
+
        if test "x$asm_optimisation$sse_os" = "xyesyes" ; then
                XIPH_ADD_CFLAGS([-msse2])
                fi
 
        fi
 
+case "$host_os" in
+       "mingw32"|"os2")
+       if test "$host_cpu" = "i686"; then
+               XIPH_ADD_CFLAGS([-mstackrealign])
+               fi
+       esac
+
 XIPH_ADD_CFLAGS([-Wextra])
 
 if test x$enable_werror = "xyes" ; then
@@ -468,6 +492,7 @@ AC_CONFIG_FILES([ \
        objs/release/Makefile \
        objs/release/bin/Makefile \
        objs/release/lib/Makefile \
+       microbench/Makefile
 ])
 AC_OUTPUT