Print a warning when disabling http support for dependencies.
[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   AC_CHECK_HEADER([sys/socket.h],,
45     AC_MSG_WARN([HTTP support requires a posix socket library.])
46     enable_http=no
47   )
48 )
49
50 AS_IF([test "x$enable_http" != "xno"], [
51    openssl="openssl"
52    AC_DEFINE([OP_ENABLE_HTTP], [1], [Enable HTTP support])
53 ])
54 AC_SUBST(openssl)
55
56 PKG_CHECK_MODULES([DEPS], [ogg >= 1.3 opus >= 1.0.1 ${openssl}])
57
58 AC_ARG_ENABLE([fixed-point],
59   AS_HELP_STRING([--enable-fixed-point], [Enable fixed-point calculation]),,
60   enable_fixed_point=no)
61 AC_ARG_ENABLE([float],
62   AS_HELP_STRING([--disable-float], [Disable floating-point API]),,
63   enable_float=yes)
64
65 AS_IF([test "x$enable_float" = "xno"],
66   [enable_fixed_point=yes
67    AC_DEFINE([OP_DISABLE_FLOAT_API], [1], [Disable floating-point API])
68   ]
69 )
70
71 AS_IF([test "x$enable_fixed_point" = "xyes"],
72   [AC_DEFINE([OP_FIXED_POINT], [1], [Enable fixed-point calculation])],
73   [dnl This only has to be tested for if float->fixed conversions are required
74    AC_SEARCH_LIBS([lrintf], [m], [
75       AC_DEFINE([OP_HAVE_LRINTF], [1], [Enable use of lrintf function])
76       lrintf_notice="
77     Library for lrintf() ......... ${ac_cv_search_lrintf}"
78    ])
79   ]
80 )
81 AC_SUBST(ac_cv_search_lrintf)
82
83 CC_ATTRIBUTE_VISIBILITY([default], [
84   CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"])
85 ])
86
87 CC_CHECK_CFLAGS_APPEND([-std=c89 -pedantic -Wall -Wextra -Wno-parentheses -Wno-long-long])
88
89 dnl Check for doxygen
90 AC_ARG_ENABLE([doc],
91   AS_HELP_STRING([--disable-doc], [Do not build API documentation]),,
92   [enable_doc=yes]
93 )
94 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, yes, no)
95 if test "$HAVE_DOXYGEN" != "yes" -o "$enable_doc" != "yes" ; then
96   HAVE_DOXYGEN="no"
97   enable_doc="no"
98 fi
99 AM_CONDITIONAL(HAVE_DOXYGEN, [test $HAVE_DOXYGEN = yes])
100
101 AC_OUTPUT([
102   Makefile
103   opusfile.pc
104   opusfile-uninstalled.pc
105   doc/Doxyfile
106 ])
107
108 AC_MSG_NOTICE([
109 ------------------------------------------------------------------------
110   $PACKAGE $VERSION: Automatic configuration OK.
111
112     Assertions ................... ${enable_assertions}
113
114     HTTP support ................. ${enable_http}
115     Fixed-point .................. ${enable_fixed_point}
116     Floating-point API ........... ${enable_float}${lrintf_notice}
117
118     Hidden visibility ............ ${cc_cv_flag_visibility}
119
120     API documentation ............ ${enable_doc}
121 ------------------------------------------------------------------------
122 ])