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