Add autotools build system
[daala.git] / configure.ac
1 # autoconf source script for generating configure
2
3 dnl The package_version file will be automatically synced to the git revision
4 dnl by the update_version script when configured in the repository, but will
5 dnl remain constant in tarball releases unless it is manually edited.
6 m4_define([CURRENT_VERSION],
7           m4_esyscmd([ if test -e package_version || ./update_version; then
8                            . ./package_version
9                            printf "$PACKAGE_VERSION"
10                        else
11                            printf "unknown"
12                        fi ]))
13
14 AC_INIT([daala],[CURRENT_VERSION],[daala@xiph.org])
15 AC_CONFIG_SRCDIR([src/decode.c])
16
17 AC_USE_SYSTEM_EXTENSIONS
18 AC_SYS_LARGEFILE
19
20 AM_INIT_AUTOMAKE([1.11 foreign no-define])
21 AM_MAINTAINER_MODE([enable])
22 LT_INIT
23
24 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
25
26 AC_CONFIG_MACRO_DIR([m4])
27
28 dnl Library versioning for libtool.
29 dnl Please update these for releases.
30 dnl CURRENT, REVISION, AGE
31 dnl - library source changed -> increment REVISION
32 dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
33 dnl - interfaces added -> increment AGE
34 dnl - interfaces removed -> AGE = 0
35
36 OP_LT_CURRENT=0
37 OP_LT_REVISION=1
38 OP_LT_AGE=0
39
40 AC_SUBST(OP_LT_CURRENT)
41 AC_SUBST(OP_LT_REVISION)
42 AC_SUBST(OP_LT_AGE)
43
44 CC_CHECK_CFLAGS_APPEND(
45   [-std=c89 -pedantic -Wall -Wextra -Wno-parentheses -Wno-long-long])
46
47 # Platform-specific tweaks
48 case $host in
49   *-mingw*)
50     # -std=c89 causes some warnings under mingw.
51     CC_CHECK_CFLAGS_APPEND([-U__STRICT_ANSI__])
52     # We need WINNT>=0x501 (WindowsXP) for getaddrinfo/freeaddrinfo.
53     # It's okay to define this even when HTTP support is disabled, as it only
54     #  affects header declarations, not linking (unless we actually use some
55     #  XP-only functions).
56     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x501,
57      [We need at least WindowsXP for getaddrinfo/freaddrinfo])
58     host_mingw=true
59     ;;
60 esac
61 AM_CONDITIONAL(OP_WIN32, test "$host_mingw" = "true")
62
63 AC_ARG_ENABLE([assertions],
64   AS_HELP_STRING([--enable-assertions], [Enable assertions in code]),,
65   enable_assertions=no)
66
67 AS_IF([test "$enable_assertions" = "yes"], [
68   AC_DEFINE([OP_ENABLE_ASSERTIONS], [1], [Enable assertions in code])
69 ])
70
71 PKG_CHECK_MODULES([DEPS], [ogg >= 1.3 sdl])
72
73 #CC_ATTRIBUTE_VISIBILITY([default], [
74 #  CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"])
75 #])
76
77 dnl Check for doxygen
78 AC_ARG_ENABLE([doc],
79   AS_HELP_STRING([--disable-doc], [Do not build API documentation]),,
80   [enable_doc=yes]
81 )
82 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, yes, no)
83 if test "$HAVE_DOXYGEN" != "yes" -o "$enable_doc" != "yes" ; then
84   HAVE_DOXYGEN="no"
85   enable_doc="no"
86 fi
87 AM_CONDITIONAL(HAVE_DOXYGEN, [test $HAVE_DOXYGEN = yes])
88
89 AC_CHECK_PROG(HAVE_FIG2DEV, fig2dev, yes, no)
90 if test "$HAVE_FIG2DEV" != "yes" -o "$enable_doc" != "yes" ; then
91   HAVE_FIG2DEV="no"
92   enable_doc="no"
93 fi
94 AM_CONDITIONAL(HAVE_FIG2DEV, [test $HAVE_FIG2DEV = yes])
95
96 AM_CONDITIONAL(ENABLE_X86ASM, [test yes = yes])
97
98 AM_CONDITIONAL(ENABLE_DOCS, [test $enable_doc = yes])
99
100 DAALA_DEC_LIBS="\$(top_builddir)/src/libdaaladec.la \$(top_builddir)/src/libdaalabase.la -lm"
101 AC_SUBST(DAALA_DEC_LIBS)
102
103 DAALA_ENC_LIBS="\$(top_builddir)/src/libdaalaenc.la \$(top_builddir)/src/libdaalabase.la -lm"
104 AC_SUBST(DAALA_ENC_LIBS)
105
106 AC_CONFIG_FILES([
107   Makefile
108   daala.pc
109   daala-uninstalled.pc
110   src/Makefile
111   examples/Makefile
112   include/Makefile
113 ])
114 AC_OUTPUT
115
116 AC_MSG_NOTICE([
117 ------------------------------------------------------------------------
118   $PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK.
119
120     Assertions ................... ${enable_assertions}
121
122     Hidden visibility ............ ${cc_cv_flag_visibility}
123
124     API documentation ............ ${enable_doc}
125 ------------------------------------------------------------------------
126 ])