src/libFLAC/stream_decoder.c : Fix buffer read overflow.
[platform/upstream/flac.git] / configure.ac
index 754c458..50ef80e 100644 (file)
@@ -2,7 +2,7 @@
 #  Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009  Josh Coalson
 #
 #  This file is part the FLAC project.  FLAC is comprised of several
-#  components distributed under difference licenses.  The codec libraries
+#  components distributed under different licenses.  The codec libraries
 #  are distributed under Xiph.Org's BSD-like license (see the file
 #  COPYING.Xiph in this distribution).  All other programs, libraries, and
 #  plugins are distributed under the GPL (see COPYING.GPL).  The documentation
 # instead of FLAC__ since autoconf triggers off 'AC_' in strings
 
 AC_PREREQ(2.60)
-AC_INIT([flac], [1.2.1])
+AC_INIT([flac], [1.3.0], [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 -Wall tar-pax no-dist-gzip dist-xz subdir-objects])
+AM_INIT_AUTOMAKE([foreign 1.11 -Wall tar-pax no-dist-gzip dist-xz subdir-objects])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
+user_cflags=$CFLAGS
 
 #Prefer whatever the current ISO standard is.
 AC_PROG_CC_STDC
 AC_USE_SYSTEM_EXTENSIONS
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
 LT_INIT([win32-dll disable-static pic-only])
 AM_PROG_AS
 AC_PROG_CXX
@@ -37,18 +40,17 @@ AC_PROG_MAKE_SET
 AC_SYS_LARGEFILE
 AC_FUNC_FSEEKO
 
-AC_CHECK_SIZEOF(void*,0)
+AC_CHECK_SIZEOF(off_t,1)       # Fake default value.
+AC_CHECK_SIZEOF([void*])
 AC_SEARCH_LIBS([lround],[m], [AC_DEFINE(HAVE_LROUND,1,lround support)])
-#@@@ new name is AC_CONFIG_HEADERS
-AM_CONFIG_HEADER(config.h)
 
-AC_LANG_PUSH(C++)
+AC_LANG_PUSH([C++])
 # c++ flavor first
 AC_C_VARARRAYS
 if test $ac_cv_c_vararrays = yes; then
        AC_DEFINE([HAVE_CXX_VARARRAYS], 1, [Define to 1 if C++ supports variable-length arrays.])
 fi
-AC_LANG_POP(C++)
+AC_LANG_POP([C++])
 
 # c flavor
 AC_HEADER_STDC
@@ -57,18 +59,21 @@ AC_C_INLINE
 AC_C_VARARRAYS
 AC_C_TYPEOF
 
-AC_CHECK_HEADERS(stdint.h)
-AC_SUBST(HAVE_STDINT_H)
-AC_CHECK_HEADERS(inttypes.h)
-AC_SUBST(HAVE_INTTYPES_H)
-AC_CHECK_HEADERS(byteswap.h)
-AC_SUBST(HAVE_BYTESWAP_H)
+AC_CHECK_HEADERS([stdint.h inttypes.h byteswap.h sys/param.h termios.h])
 
-AC_CHECK_HEADERS([sys/param.h])
+AC_HEADER_TIOCGWINSZ
 
 XIPH_C_BSWAP32
 
-XIPH_C_FIND_ENDIAN
+ac_cv_c_big_endian=0
+ac_cv_c_little_endian=0
+AC_C_BIGENDIAN([ac_cv_c_big_endian=1], [ac_cv_c_little_endian=1], [
+       AC_MSG_WARN([[*****************************************************************]])
+       AC_MSG_WARN([[*** Not able to determine endian-ness of target processor.       ]])
+       AC_MSG_WARN([[*** The constants CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in  ]])
+       AC_MSG_WARN([[*** config.h may need to be hand editied.                        ]])
+       AC_MSG_WARN([[*****************************************************************]])
+])
 AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian},
                                        [Target processor is big endian.])
 AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
@@ -89,7 +94,7 @@ case "$host_cpu" in
                AC_DEFINE(FLAC__CPU_IA32)
                AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
                ;;
-       powerpc)
+       powerpc|powerpc64)
                cpu_ppc=true
                AC_DEFINE(FLAC__CPU_PPC)
                AH_TEMPLATE(FLAC__CPU_PPC, [define if building for PowerPC])
@@ -121,16 +126,23 @@ case "$host" in
 esac
 AM_CONDITIONAL(FLaC__CPU_PPC_SPE, test "x$abi_spe" = xtrue)
 
+os_is_windows=no
 case "$host" in
-       *-*-cygwin|*mingw*|*emx*)
+       *-*-cygwin|*mingw*)
                # define this variable for enabling strict exports with libtool; for now, it's supported by Win32 and OS/2
                LT_NO_UNDEFINED="-no-undefined"
+               CPPFLAGS="-D__MSVCRT_VERSION__=0x0601 $CPPFLAGS"
+               os_is_windows=yes
+               ;;
+       *emx*)
+               LT_NO_UNDEFINED="-no-undefined"
                ;;
        *)
                LT_NO_UNDEFINED=
                ;;
 esac
 AC_SUBST(LT_NO_UNDEFINED)
+AM_CONDITIONAL(OS_IS_WINDOWS, test "x$os_is_windows" = xyes)
 
 case "$host" in
        *-pc-linux-gnu)
@@ -232,7 +244,10 @@ fi
 AC_SUBST(FLAC__TEST_LEVEL)
 
 AC_ARG_ENABLE(gcc-werror,
-       AC_HELP_STRING([--enable-gcc-werror], [enable -Werror in all Makefiles]))
+       AC_HELP_STRING([--enable-gcc-werror], [Enable -Werror in all Makefiles]))
+
+AC_ARG_ENABLE(stack-smash-protection,
+       AC_HELP_STRING([--enable-stack-smash-protection], [Enable GNU GCC stack smash protection]))
 
 AC_ARG_ENABLE(valgrind-testing,
 AC_HELP_STRING([--enable-valgrind-testing], [Run all tests inside Valgrind]),
@@ -297,9 +312,12 @@ fi
 
 AM_CONDITIONAL(FLaC__HAS_OGG, [test "x$have_ogg" = xyes])
 if test "x$have_ogg" = xyes ; then
-AC_DEFINE(FLAC__HAS_OGG)
-AH_TEMPLATE(FLAC__HAS_OGG, [define if you have the ogg library])
+       AC_DEFINE_UNQUOTED([FLAC__HAS_OGG],1,[define if you have the ogg library])
+       OGG_PACKAGE="ogg"
+else
+       AC_DEFINE_UNQUOTED([FLAC__HAS_OGG],0)
 fi
+AC_SUBST(OGG_PACKAGE)
 
 dnl check for i18n(internationalization); these are from libiconv/gettext
 AM_ICONV
@@ -345,20 +363,45 @@ if test "x$debug" = xtrue; then
 else
        CPPFLAGS="-DNDEBUG $CPPFLAGS"
        if test "x$GCC" = xyes; then
-    CFLAGS="-O3 -funroll-loops -Wall -W -Winline $CFLAGS"
+               if test "x$user_cflags" = x; then
+                       CFLAGS="-O3 -funroll-loops -Wall -W -Winline"
+               fi
        fi
 fi
 
 XIPH_GCC_VERSION
 
 if test x$ac_cv_c_compiler_gnu = xyes ; then
+       CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow -Wundef -Wmissing-declarations " # -Wcast-qual -Wbad-function-cast -Wwrite-strings -Winline -Wconversion
+       CXXFLAGS="$CXXFLAGS -Wcast-align -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wsign-promo -Wundef " # -Wcast-qual -Wbad-function-cast -Wwrite-strings -Woverloaded-virtual -Wmissing-declarations
+
+
        if test x$enable_gcc_werror = "xyes" ; then
-               CFLAGS="-Wall -Wextra -Werror $CFLAGS"
-               CXXFLAGS="-Wall -Wextra -Werror $CXXFLAGS"
+               CFLAGS="$CFLAGS -Wall -Wextra -Werror "
+               CXXFLAGS="$CXXFLAGS -Wall -Wextra -Werror "
+               fi
+
+       if test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = elf; then
+               CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
+               CFLAGS="$CFLAGS -fvisibility=hidden"
+               CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
+               fi
+
+       if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x42" ; then
+               XIPH_ADD_CFLAGS([-fgnu89-inline])
                fi
        fi
 
 
+XIPH_ADD_CFLAGS([-Wextra])
+XIPH_ADD_CFLAGS([-Wdeclaration-after-statement])
+XIPH_ADD_CFLAGS([-D_FORTIFY_SOURCE=2])
+
+if test x$enable_stack_smash_protection = "xyes" ; then
+       XIPH_GCC_STACK_PROTECTOR
+       XIPH_GXX_STACK_PROTECTOR
+       fi
+
 #@@@
 AM_CONDITIONAL(FLaC__HAS_AS__TEMPORARILY_DISABLED, test "yes" = "no")
 AM_CONDITIONAL(FLaC__HAS_GAS__TEMPORARILY_DISABLED, test "yes" = "no")
@@ -385,13 +428,6 @@ AC_CONFIG_FILES([ \
        src/plugin_common/Makefile \
        src/plugin_xmms/Makefile \
        src/share/Makefile \
-       src/share/getopt/Makefile \
-       src/share/grabbag/Makefile \
-       src/share/replaygain_analysis/Makefile \
-       src/share/replaygain_synthesis/Makefile \
-       src/share/replaygain_synthesis/include/Makefile \
-       src/share/replaygain_synthesis/include/private/Makefile \
-       src/share/utf8/Makefile \
        src/test_grabbag/Makefile \
        src/test_grabbag/cuesheet/Makefile \
        src/test_grabbag/picture/Makefile \
@@ -420,6 +456,7 @@ AC_CONFIG_FILES([ \
        include/share/Makefile \
        include/share/grabbag/Makefile \
        include/test_libs_common/Makefile \
+       doc/Doxyfile \
        doc/Makefile \
        doc/html/Makefile \
        doc/html/images/Makefile \
@@ -433,13 +470,13 @@ AC_CONFIG_FILES([ \
        test/metaflac-test-files/Makefile \
        test/pictures/Makefile \
        build/Makefile \
-       obj/Makefile \
-       obj/debug/Makefile \
-       obj/debug/bin/Makefile \
-       obj/debug/lib/Makefile \
-       obj/release/Makefile \
-       obj/release/bin/Makefile \
-       obj/release/lib/Makefile \
+       objs/Makefile \
+       objs/debug/Makefile \
+       objs/debug/bin/Makefile \
+       objs/debug/lib/Makefile \
+       objs/release/Makefile \
+       objs/release/bin/Makefile \
+       objs/release/lib/Makefile \
 ])
 AC_OUTPUT
 
@@ -455,7 +492,8 @@ AC_MSG_RESULT([
     Host OS : ............................. ${host_os}
 ])
 
-if test x$ac_cv_c_compiler_gnu = xyes ; then
        echo "    Compiler is GCC : ..................... ${ac_cv_c_compiler_gnu}"
+if test x$ac_cv_c_compiler_gnu = xyes ; then
        echo "    GCC version : ......................... ${GCC_VERSION}"
-       fi
+fi
+echo