Chris@69: # autoconf source script for generating configure Chris@69: Chris@69: dnl The package_version file will be automatically synced to the git revision Chris@69: dnl by the update_version script when configured in the repository, but will Chris@69: dnl remain constant in tarball releases unless it is manually edited. Chris@69: m4_define([CURRENT_VERSION], Chris@69: m4_esyscmd([ ./update_version 2>/dev/null || true Chris@69: if test -e package_version; then Chris@69: . ./package_version Chris@69: printf "$PACKAGE_VERSION" Chris@69: else Chris@69: printf "unknown" Chris@69: fi ])) Chris@69: Chris@69: AC_INIT([opusfile],[CURRENT_VERSION],[opus@xiph.org]) Chris@69: AC_CONFIG_SRCDIR([src/opusfile.c]) Chris@69: AC_CONFIG_MACRO_DIR([m4]) Chris@69: Chris@69: AC_USE_SYSTEM_EXTENSIONS Chris@69: AC_SYS_LARGEFILE Chris@69: Chris@69: AM_INIT_AUTOMAKE([1.11 foreign no-define dist-zip subdir-objects]) Chris@69: AM_MAINTAINER_MODE([enable]) Chris@69: LT_INIT Chris@69: Chris@69: m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) Chris@69: Chris@69: dnl Library versioning for libtool. Chris@69: dnl Please update these for releases. Chris@69: dnl CURRENT, REVISION, AGE Chris@69: dnl - library source changed -> increment REVISION Chris@69: dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0 Chris@69: dnl - interfaces added -> increment AGE Chris@69: dnl - interfaces removed -> AGE = 0 Chris@69: Chris@69: OP_LT_CURRENT=4 Chris@69: OP_LT_REVISION=2 Chris@69: OP_LT_AGE=4 Chris@69: Chris@69: AC_SUBST(OP_LT_CURRENT) Chris@69: AC_SUBST(OP_LT_REVISION) Chris@69: AC_SUBST(OP_LT_AGE) Chris@69: Chris@69: CC_CHECK_CFLAGS_APPEND( Chris@69: [-std=c89 -pedantic -Wall -Wextra -Wno-parentheses -Wno-long-long]) Chris@69: Chris@69: # Platform-specific tweaks Chris@69: case $host in Chris@69: *-mingw*) Chris@69: # -std=c89 causes some warnings under mingw. Chris@69: CC_CHECK_CFLAGS_APPEND([-U__STRICT_ANSI__]) Chris@69: # We need WINNT>=0x501 (WindowsXP) for getaddrinfo/freeaddrinfo. Chris@69: # It's okay to define this even when HTTP support is disabled, as it only Chris@69: # affects header declarations, not linking (unless we actually use some Chris@69: # XP-only functions). Chris@69: AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x501, Chris@69: [We need at least WindowsXP for getaddrinfo/freeaddrinfo]) Chris@69: host_mingw=true Chris@69: ;; Chris@69: esac Chris@69: AM_CONDITIONAL(OP_WIN32, test "$host_mingw" = "true") Chris@69: Chris@69: AC_ARG_ENABLE([assertions], Chris@69: AS_HELP_STRING([--enable-assertions], [Enable assertions in code]),, Chris@69: enable_assertions=no) Chris@69: Chris@69: AS_IF([test "$enable_assertions" = "yes"], [ Chris@69: AC_DEFINE([OP_ENABLE_ASSERTIONS], [1], [Enable assertions in code]) Chris@69: ]) Chris@69: Chris@69: AC_ARG_ENABLE([http], Chris@69: AS_HELP_STRING([--disable-http], [Disable HTTP support]),, Chris@69: enable_http=yes) Chris@69: Chris@69: AM_COND_IF(OP_WIN32, Chris@69: AS_IF([test "$enable_http" != "no"], Chris@69: AC_CHECK_HEADER([winsock2.h],, Chris@69: AC_MSG_WARN([HTTP support requires a Winsock socket library.]) Chris@69: enable_http=no Chris@69: ) Chris@69: ), Chris@69: AS_IF([test "$enable_http" != "no"], Chris@69: AC_CHECK_HEADER([sys/socket.h],, Chris@69: AC_MSG_WARN([HTTP support requires a POSIX socket library.]) Chris@69: enable_http=no Chris@69: ) Chris@69: ) Chris@69: ) Chris@69: AC_SEARCH_LIBS(ftime, [compat], , [enable_http=no]) Chris@69: Chris@69: m4_ifndef([PKG_PROG_PKG_CONFIG], Chris@69: [m4_fatal([Could not locate the pkg-config autoconf macros. Chris@69: Please make sure pkg-config is installed and, if necessary, set the environment Chris@69: variable ACLOCAL="aclocal -I/path/to/pkg.m4".])]) Chris@69: Chris@69: AS_IF([test "$enable_http" != "no"], [ Chris@69: openssl="openssl" Chris@69: AC_DEFINE([OP_ENABLE_HTTP], [1], [Enable HTTP support]) Chris@69: PKG_CHECK_MODULES([URL_DEPS], [openssl]) Chris@69: ]) Chris@69: AM_CONDITIONAL(OP_ENABLE_HTTP, [test "$enable_http" != "no"]) Chris@69: AC_SUBST([openssl]) Chris@69: Chris@69: PKG_CHECK_MODULES([DEPS], [ogg >= 1.3 opus >= 1.0.1]) Chris@69: Chris@69: AC_ARG_ENABLE([fixed-point], Chris@69: AS_HELP_STRING([--enable-fixed-point], [Enable fixed-point calculation]),, Chris@69: enable_fixed_point=no) Chris@69: AC_ARG_ENABLE([float], Chris@69: AS_HELP_STRING([--disable-float], [Disable floating-point API]),, Chris@69: enable_float=yes) Chris@69: Chris@69: AS_IF([test "$enable_float" = "no"], Chris@69: [enable_fixed_point=yes Chris@69: AC_DEFINE([OP_DISABLE_FLOAT_API], [1], [Disable floating-point API]) Chris@69: ] Chris@69: ) Chris@69: Chris@69: AS_IF([test "$enable_fixed_point" = "yes"], Chris@69: [AC_DEFINE([OP_FIXED_POINT], [1], [Enable fixed-point calculation])], Chris@69: [dnl This only has to be tested for if float->fixed conversions are required Chris@69: saved_LIBS="$LIBS" Chris@69: AC_SEARCH_LIBS([lrintf], [m], [ Chris@69: AC_DEFINE([OP_HAVE_LRINTF], [1], [Enable use of lrintf function]) Chris@69: lrintf_notice=" Chris@69: Library for lrintf() ......... ${ac_cv_search_lrintf}" Chris@69: ]) Chris@69: LIBS="$saved_LIBS" Chris@69: ] Chris@69: ) Chris@69: Chris@69: AC_ARG_ENABLE([examples], Chris@69: AS_HELP_STRING([--disable-examples], [Do not build example applications]),, Chris@69: enable_examples=yes) Chris@69: AM_CONDITIONAL([OP_ENABLE_EXAMPLES], [test "$enable_examples" = "yes"]) Chris@69: Chris@69: AS_CASE(["$ac_cv_search_lrintf"], Chris@69: ["no"],[], Chris@69: ["none required"],[], Chris@69: [lrintf_lib="$ac_cv_search_lrintf"]) Chris@69: Chris@69: AC_SUBST([lrintf_lib]) Chris@69: Chris@69: CC_ATTRIBUTE_VISIBILITY([default], [ Chris@69: CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"]) Chris@69: ]) Chris@69: Chris@69: dnl Check for doxygen Chris@69: AC_ARG_ENABLE([doc], Chris@69: AS_HELP_STRING([--disable-doc], [Do not build API documentation]),, Chris@69: [enable_doc=yes] Chris@69: ) Chris@69: Chris@69: AS_IF([test "$enable_doc" = "yes"], [ Chris@69: AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [yes], [no]) Chris@69: AC_CHECK_PROG([HAVE_DOT], [dot], [yes], [no]) Chris@69: ],[ Chris@69: HAVE_DOXYGEN=no Chris@69: ]) Chris@69: Chris@69: AM_CONDITIONAL([HAVE_DOXYGEN], [test "$HAVE_DOXYGEN" = "yes"]) Chris@69: Chris@69: AC_CONFIG_FILES([ Chris@69: Makefile Chris@69: opusfile.pc Chris@69: opusurl.pc Chris@69: opusfile-uninstalled.pc Chris@69: opusurl-uninstalled.pc Chris@69: doc/Doxyfile Chris@69: ]) Chris@69: AC_CONFIG_HEADERS([config.h]) Chris@69: AC_OUTPUT Chris@69: Chris@69: AC_MSG_NOTICE([ Chris@69: ------------------------------------------------------------------------ Chris@69: $PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK. Chris@69: Chris@69: Assertions ................... ${enable_assertions} Chris@69: Chris@69: HTTP support ................. ${enable_http} Chris@69: Fixed-point .................. ${enable_fixed_point} Chris@69: Floating-point API ........... ${enable_float}${lrintf_notice} Chris@69: Chris@69: Hidden visibility ............ ${cc_cv_flag_visibility} Chris@69: Chris@69: API code examples ............ ${enable_examples} Chris@69: API documentation ............ ${enable_doc} Chris@69: ------------------------------------------------------------------------ Chris@69: ])