Keep the continuous integration build scripts in the repo.
[opusfile.git] / configure.ac
1 AC_INIT([opusfile], [0.0])
2
3 AC_USE_SYSTEM_EXTENSIONS
4 AC_SYS_LARGEFILE
5
6 AM_INIT_AUTOMAKE([1.11 foreign])
7 LT_INIT
8
9 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
10
11 AC_CONFIG_MACRO_DIR([m4])
12
13 dnl Library versioning for libtool.
14 dnl Please update these for releases.
15 dnl CURRENT, REVISION, AGE
16 dnl - library source changed -> increment REVISION
17 dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
18 dnl - interfaces added -> increment AGE
19 dnl - interfaces removed -> AGE = 0
20
21 OP_LT_CURRENT=0
22 OP_LT_REVISION=0
23 OP_LT_AGE=0
24
25 AC_SUBST(OP_LT_CURRENT)
26 AC_SUBST(OP_LT_REVISION)
27 AC_SUBST(OP_LT_AGE)
28
29 AC_ARG_ENABLE([assertions],
30   AS_HELP_STRING([--enable-assertions], [Enable assertions in code]),,
31   enable_assertions=no)
32
33 AS_IF([test "x$enable_assertions" = "xyes"], [
34   AC_DEFINE([OP_ENABLE_ASSERTIONS], [1], [Enable assertions in code])
35 ])
36
37 AC_ARG_ENABLE([http],
38   AS_HELP_STRING([--disable-http], [Disable HTTP support]),,
39   enable_http=yes)
40
41 AS_IF([test "x$enable_http" != "xno"],
42   [openssl="openssl"
43    AC_DEFINE([OP_ENABLE_HTTP], [1], [Enable HTTP support])
44 ])
45 AC_SUBST(openssl)
46
47 PKG_CHECK_MODULES([DEPS], [ogg >= 1.3 opus >= 1.0.1 ]${openssl})
48
49 AC_ARG_ENABLE([fixed-point],
50   AS_HELP_STRING([--enable-fixed-point], [Enable fixed-point calculation]),,
51   enable_fixed_point=no)
52 AC_ARG_ENABLE([float],
53   AS_HELP_STRING([--disable-float], [Disable floating-point API]),,
54   enable_float=yes)
55
56 AS_IF([test "x$enable_float" = "xno"],
57   [enable_fixed_point=yes
58    AC_DEFINE([OP_DISABLE_FLOAT_API], [1], [Disable floating-point API])
59   ]
60 )
61
62 AS_IF([test "x$enable_fixed_point" = "xyes"],
63   [AC_DEFINE([OP_FIXED_POINT], [1], [Enable fixed-point calculation])],
64   [dnl This only has to be tested for if float->fixed conversions are required
65    AC_SEARCH_LIBS([lrintf], [m], [
66       AC_DEFINE([OP_HAVE_LRINTF], [1], [Enable use of lrintf function])
67       lrintf_notice="
68     Library for lrintf() ......... ${ac_cv_search_lrintf}"
69    ])
70   ]
71 )
72 AC_SUBST(ac_cv_search_lrintf)
73
74 CC_ATTRIBUTE_VISIBILITY([default], [
75   CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"])
76 ])
77
78 CC_CHECK_CFLAGS_APPEND([-std=c89 -pedantic -Wall -Wextra -Wno-parentheses -Wno-long-long])
79
80 dnl Check for doxygen
81 AC_ARG_ENABLE([doc],
82   AS_HELP_STRING([--disable-doc], [Do not build API documentation]),,
83   [enable_doc=yes]
84 )
85
86 if test "x$enable_doc" != "xno"; then
87   AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
88   if test "x$HAVE_DOXYGEN" = "xfalse" -a "x$enable_doc" = "xyes" ; then
89     AC_MSG_ERROR([*** Doxygen not found. Cannot build API documentation. ***])
90   fi
91 else
92   HAVE_DOXYGEN=false
93 fi
94 AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
95
96 AC_OUTPUT([
97   Makefile
98   opusfile.pc
99   opusfile-uninstalled.pc
100   doc/Doxyfile
101 ])
102
103 AC_MSG_NOTICE([
104 ------------------------------------------------------------------------
105   $PACKAGE $VERSION: Automatic configuration OK.
106
107     Assertions ................... ${enable_assertions}
108
109     HTTP support ................. ${enable_http}
110     Fixed-point .................. ${enable_fixed_point}
111     Floating-point API ........... ${enable_float}${lrintf_notice}
112
113     Hidden visibility ............ ${cc_cv_flag_visibility}
114
115     API documentation ............ ${enable_doc}
116 ------------------------------------------------------------------------
117 ])