configure.ac 3.6 KB
Newer Older
1 2 3
# autoconf source script for generating configure

AC_INIT([opusfile], m4_esyscmd([doc/git-version.sh]))
4 5 6 7 8

AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE

AM_INIT_AUTOMAKE([1.11 foreign])
Ron's avatar
Ron committed
9
AM_MAINTAINER_MODE([enable])
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
LT_INIT

m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

AC_CONFIG_MACRO_DIR([m4])

dnl Library versioning for libtool.
dnl Please update these for releases.
dnl CURRENT, REVISION, AGE
dnl - library source changed -> increment REVISION
dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
dnl - interfaces added -> increment AGE
dnl - interfaces removed -> AGE = 0

OP_LT_CURRENT=0
25
OP_LT_REVISION=1
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
OP_LT_AGE=0

AC_SUBST(OP_LT_CURRENT)
AC_SUBST(OP_LT_REVISION)
AC_SUBST(OP_LT_AGE)

AC_ARG_ENABLE([assertions],
  AS_HELP_STRING([--enable-assertions], [Enable assertions in code]),,
  enable_assertions=no)

AS_IF([test "x$enable_assertions" = "xyes"], [
  AC_DEFINE([OP_ENABLE_ASSERTIONS], [1], [Enable assertions in code])
])

AC_ARG_ENABLE([http],
  AS_HELP_STRING([--disable-http], [Disable HTTP support]),,
  enable_http=yes)

44 45 46 47 48 49
# AS_IF([test "x$enable_http" != "xno"],
#   AC_CHECK_HEADER([sys/socket.h],,
#     AC_MSG_WARN([HTTP support requires a posix socket library.])
#     enable_http=no
#   )
# )
50 51 52

AS_IF([test "x$enable_http" != "xno"], [
   openssl="openssl"
53 54
   AC_DEFINE([OP_ENABLE_HTTP], [1], [Enable HTTP support])
])
55
AC_SUBST(openssl)
56

57
PKG_CHECK_MODULES([DEPS], [ogg >= 1.3 opus >= 1.0.1 ${openssl}])
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77

AC_ARG_ENABLE([fixed-point],
  AS_HELP_STRING([--enable-fixed-point], [Enable fixed-point calculation]),,
  enable_fixed_point=no)
AC_ARG_ENABLE([float],
  AS_HELP_STRING([--disable-float], [Disable floating-point API]),,
  enable_float=yes)

AS_IF([test "x$enable_float" = "xno"],
  [enable_fixed_point=yes
   AC_DEFINE([OP_DISABLE_FLOAT_API], [1], [Disable floating-point API])
  ]
)

AS_IF([test "x$enable_fixed_point" = "xyes"],
  [AC_DEFINE([OP_FIXED_POINT], [1], [Enable fixed-point calculation])],
  [dnl This only has to be tested for if float->fixed conversions are required
   AC_SEARCH_LIBS([lrintf], [m], [
      AC_DEFINE([OP_HAVE_LRINTF], [1], [Enable use of lrintf function])
      lrintf_notice="
78
    Library for lrintf() ......... ${ac_cv_search_lrintf}"
79 80 81
   ])
  ]
)
82
AC_SUBST(ac_cv_search_lrintf)
83 84 85 86 87 88 89

CC_ATTRIBUTE_VISIBILITY([default], [
  CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"])
])

CC_CHECK_CFLAGS_APPEND([-std=c89 -pedantic -Wall -Wextra -Wno-parentheses -Wno-long-long])

90 91 92 93 94
# Platform-specific tweaks
case $host in
  *-mingw*)
    # -std=c89 causes some warnings under mingw.
    CC_CHECK_CFLAGS_APPEND([-U__STRICT_ANSI__])
95
    host_mingw=true
96 97
    ;;
esac
Timothy B. Terriberry's avatar
Timothy B. Terriberry committed
98
AM_CONDITIONAL(OP_WIN32, test "x$host_mingw" = xtrue)
99

100 101 102 103 104
dnl Check for doxygen
AC_ARG_ENABLE([doc],
  AS_HELP_STRING([--disable-doc], [Do not build API documentation]),,
  [enable_doc=yes]
)
105 106 107 108
AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, yes, no)
if test "$HAVE_DOXYGEN" != "yes" -o "$enable_doc" != "yes" ; then
  HAVE_DOXYGEN="no"
  enable_doc="no"
109
fi
110
AM_CONDITIONAL(HAVE_DOXYGEN, [test $HAVE_DOXYGEN = yes])
111 112 113

AC_OUTPUT([
  Makefile
114 115
  opusfile.pc
  opusfile-uninstalled.pc
116 117 118 119
  doc/Doxyfile
])

AC_MSG_NOTICE([
120 121 122 123 124 125 126 127 128 129 130 131 132
------------------------------------------------------------------------
  $PACKAGE $VERSION: Automatic configuration OK.

    Assertions ................... ${enable_assertions}

    HTTP support ................. ${enable_http}
    Fixed-point .................. ${enable_fixed_point}
    Floating-point API ........... ${enable_float}${lrintf_notice}

    Hidden visibility ............ ${cc_cv_flag_visibility}

    API documentation ............ ${enable_doc}
------------------------------------------------------------------------
133
])