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