Move the vorbis channel mapping to informative references.
[opus.git] / configure.ac
index 44710d5..ce369dd 100644 (file)
@@ -1,59 +1,43 @@
 dnl Process this file with autoconf to produce a configure script. -*-m4-*-
 
-AC_INIT(src/opus_encoder.c)
-
-AM_CONFIG_HEADER([config.h])
+dnl The package_version file will be automatically synced to the git revision
+dnl by the update_version script when configured in the repository, but will
+dnl remain constant in tarball releases unless it is manually edited.
+m4_define([CURRENT_VERSION],
+          m4_esyscmd([ if test -e package_version || ./update_version; then
+                           . ./package_version
+                           printf "$PACKAGE_VERSION"
+                       else
+                           printf "unknown"
+                       fi ]))
+
+AC_INIT([opus],[CURRENT_VERSION],[opus@xiph.org])
+
+AC_CONFIG_SRCDIR(src/opus_encoder.c)
+AC_CONFIG_MACRO_DIR([m4])
 
 dnl enable silent rules on automake 1.11 and later
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
-OPUS_MAJOR_VERSION=1
-OPUS_MINOR_VERSION=0
-OPUS_MICRO_VERSION=1
-OPUS_EXTRA_VERSION=-rc
-
-OPUS_VERSION="$OPUS_MAJOR_VERSION.$OPUS_MINOR_VERSION.$OPUS_MICRO_VERSION$OPUS_EXTRA_VERSION"
-AC_MSG_CHECKING([git revision])
-GIT_VERSION=$(git describe --tags --match 'v*' 2>/dev/null | sed 's/^v//')
-if test -z "$GIT_VERSION"; then
-  AC_MSG_RESULT([no])
-else
-  AC_MSG_RESULT([$GIT_VERSION])
-  OPUS_VERSION="$GIT_VERSION"
-fi
-
-# For automake.
-VERSION=$OPUS_VERSION
-PACKAGE=opus
-
-# For our version string.
-AC_SUBST(OPUS_VERSION)
-
-# For config.h
-AC_DEFINE_UNQUOTED(OPUS_VERSION, "${OPUS_VERSION}", [Complete version string])
-AC_DEFINE_UNQUOTED(OPUS_MAJOR_VERSION, ${OPUS_MAJOR_VERSION}, [Version major])
-AC_DEFINE_UNQUOTED(OPUS_MINOR_VERSION, ${OPUS_MINOR_VERSION}, [Version minor])
-AC_DEFINE_UNQUOTED(OPUS_MICRO_VERSION, ${OPUS_MICRO_VERSION}, [Version micro])
-AC_DEFINE_UNQUOTED(OPUS_EXTRA_VERSION, "${OPUS_EXTRA_VERSION}", [Version extra])
-
 # For libtool.
-OPUS_LT_CURRENT=0
+dnl Please update these for releases.
+OPUS_LT_CURRENT=4
 OPUS_LT_REVISION=0
-OPUS_LT_AGE=0
+OPUS_LT_AGE=4
 
 AC_SUBST(OPUS_LT_CURRENT)
 AC_SUBST(OPUS_LT_REVISION)
 AC_SUBST(OPUS_LT_AGE)
 
-AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
-AM_MAINTAINER_MODE
+AM_INIT_AUTOMAKE([no-define])
+AM_MAINTAINER_MODE([enable])
 
 AC_CANONICAL_HOST
+AC_MINGW32
 AM_PROG_LIBTOOL
 AM_PROG_CC_C_O
 
 AC_PROG_CC_C99
-AC_C_BIGENDIAN
 AC_C_CONST
 AC_C_INLINE
 
@@ -137,15 +121,12 @@ has_float_approx=no
 
 ac_enable_fixed="no";
 ac_enable_float="yes";
-AC_ARG_ENABLE(fixed-point, [  --enable-fixed-point       compile without floating point],
+AC_ARG_ENABLE(fixed-point, [  --enable-fixed-point       compile without floating point (for machines without a fast enough FPU)],
 [if test "$enableval" = yes; then
   ac_enable_fixed="yes";
   ac_enable_float="no";
-  AC_DEFINE([FIXED_POINT], [1], [Compile as fixed-point])
-else
-  AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])
-fi],
-AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]))
+  AC_DEFINE([FIXED_POINT], [1], [Compile as fixed-point (for machines without a fast enough FPU)])
+fi])
 
 ac_enable_fixed_debug="no"
 AC_ARG_ENABLE(fixed-point-debug, [  --enable-fixed-point-debug debug fixed-point implementation],
@@ -174,6 +155,36 @@ if test "x${float_approx}" = "xyes"; then
     AC_DEFINE([FLOAT_APPROX], , [Float approximations])
 fi
 
+cpu_arm=no
+AC_ARG_ENABLE(asm,
+    AS_HELP_STRING([--disable-asm], [Disable assembly optimizations]),
+    [ ac_enable_asm=$enableval ], [ ac_enable_asm=yes] )
+if test "x${ac_enable_asm}" = xyes ; then
+    asm_optimization="no asm for your platform, please send patches"
+    case $host_cpu in
+    arm*)
+        cpu_arm=yes
+        AS_GCC_INLINE_ASSEMBLY([asm_optimization="ARM"],
+            [asm_optimization="disabled"])
+        if test "x${asm_optimization}" = "xARM" ; then
+            AC_DEFINE([ARMv4_ASM], 1, [Use generic ARMv4 asm optimizations])
+            AS_ASM_ARM_EDSP([ARMv5E_ASM=1],[ARMv5E_ASM=0])
+            if test "x${ARMv5E_ASM}" = "x1" ; then
+                AC_DEFINE(ARMv5E_ASM, 1, [Use ARMv5E asm optimizations])
+                asm_optimization="${asm_optimization} (EDSP)"
+            fi
+            AS_ASM_ARM_MEDIA([ARMv6_ASM=1],[ARMv6_ASM=0])
+            if test "x${ARMv6_ASM}" = "x1" ; then
+                AC_DEFINE(ARMv6_ASM, 1, [Use ARMv6 asm optimizations])
+                asm_optimization="${asm_optimization} (Media)"
+            fi
+        fi
+        ;;
+    esac
+else
+    asm_optimization="disabled"
+fi
+
 ac_enable_assertions="no"
 AC_ARG_ENABLE(assertions, [  --enable-assertions        enable additional software error checking],
 [if test "$enableval" = yes; then
@@ -209,37 +220,15 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
 CFLAGS="$saved_CFLAGS $SYMBOL_VISIBILITY"
 AC_SUBST(SYMBOL_VISIBILITY)
 
-ac_build_stack_protector=yes
-AC_ARG_ENABLE(stack-protector,
-     AS_HELP_STRING([--disable-stack-protector],[Disable compiler stack hardening]),
-     [
-       if test "x$enableval" = "xno"; then
-         ac_build_stack_protector=$enableval
-       fi
-     ], [
-       ac_build_stack_protector=yes
-     ])
-if test "x$ac_build_stack_protector" = "xyes"; then
-if test "x$ac_cv_c_compiler_gnu" = "xyes" ; then
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -fstack-protector-all"
-AC_MSG_CHECKING([if ${CC} supports -fstack-protector-all])
-AC_LINK_IFELSE([AC_LANG_SOURCE([void main(void){char foo;}])],
-      [ AC_MSG_RESULT([yes])
-        STACK_PROTECTOR="-fstack-protector-all" ],
-        AC_MSG_RESULT([no]))
-CFLAGS="$saved_CFLAGS $STACK_PROTECTOR"
-fi
-fi
-
 CFLAGS="$CFLAGS -W"
 
+warn_CFLAGS="-Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes"
 saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes"
-AC_MSG_CHECKING([if ${CC} supports -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes])
+CFLAGS="$CFLAGS $warn_CFLAGS"
+AC_MSG_CHECKING([if ${CC} supports ${warn_CFLAGS}])
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
       [ AC_MSG_RESULT([yes])
-        EXTRA_WARNS="-Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes" ],
+        EXTRA_WARNS=$warn_CFLAGS ],
         AC_MSG_RESULT([no]))
 CFLAGS="$saved_CFLAGS $EXTRA_WARNS"
 
@@ -284,13 +273,33 @@ AC_SUBST(SIZE32)
 AM_CONDITIONAL([FIXED_POINT], [test x$ac_enable_fixed = xyes])
 AM_CONDITIONAL([CUSTOM_MODES], [test x$ac_enable_custom_modes = xyes])
 
-AC_OUTPUT([Makefile opus.pc opus-uninstalled.pc
-           doc/Makefile doc/Doxyfile])
+dnl subsitutions for the pkg-config files
+if test x$ac_enable_float = xyes; then
+  PC_BUILD="floating-point"
+  PC_LIBM=$LIBM
+else
+  PC_BUILD="fixed-point"
+  PC_LIBM=
+fi
+dnl opus_custom requires libm as well
+if test x$ac_enable_custom_modes = xyes; then
+  PC_BUILD="${PC_BUILD}, custom modes"
+  PC_LIBM=$LIBM
+fi
+AC_SUBST([PC_BUILD])
+AC_SUBST([PC_LIBM])
+
+
+AC_CONFIG_FILES([Makefile opus.pc opus-uninstalled.pc
+                 doc/Makefile doc/Doxyfile])
+AC_CONFIG_HEADERS([config.h])
+
+AC_OUTPUT
 
 AC_MSG_RESULT([
 ------------------------------------------------------------------------
-  $PACKAGE $VERSION:  Automatic configuration OK.
-  
+  $PACKAGE_NAME $PACKAGE_VERSION:  Automatic configuration OK.
+
     Compiler support:
 
       C99 var arrays: ................ ${has_var_arrays}
@@ -302,6 +311,7 @@ AC_MSG_RESULT([
       Floating point support: ........ ${ac_enable_float}
       Fast float approximations: ..... ${float_approx}
       Fixed point debugging: ......... ${ac_enable_fixed_debug}
+      Assembly optimization: ......... ${asm_optimization}
       Custom modes: .................. ${ac_enable_custom_modes}
       Assertion checking: ............ ${ac_enable_assertions}
       Fuzzing: ....................... ${ac_enable_fuzzing}