redirect.t: Change comment
[quvi.git] / configure.ac
blob357495a80610dccef0f7135de6b5109765e59788
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ([2.68])
6 m4_include([m4/version.m4])
8 AC_INIT(
9     [quvi], [_QUVI_VERSION],
10     [http://sourceforge.net/apps/trac/quvi],
11     [],
12     [http://quvi.sourceforge.net/])
14 # Interface:
15 QUVI_CURRENT=_QUVI_CURRENT
16 QUVI_REVISION=_QUVI_REVISION
17 QUVI_AGE=_QUVI_AGE
18 AC_SUBST(QUVI_CURRENT)
19 AC_SUBST(QUVI_REVISION)
20 AC_SUBST(QUVI_AGE)
22 AC_CONFIG_SRCDIR([src/libquvi/quvi_api.c])
23 AC_CONFIG_HEADERS([config.h])
24 AC_CONFIG_AUX_DIR([config.aux])
25 AC_CONFIG_MACRO_DIR([m4])
27 AC_CANONICAL_SYSTEM
28 AC_GNU_SOURCE
30 AC_DEFINE_UNQUOTED([CANONICAL_TARGET], "$target", [...])
31 AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [...])
33 AM_INIT_AUTOMAKE([-Wall -Werror foreign dist-bzip2 dist-xz])
34 AM_SILENT_RULES([yes])
36 LT_INIT()
37 LT_PREREQ([2.2])
39 # Host specific.
40 NO_UNDEFINED=
41 case "$host" in
42     *-*-mingw32* | *-*-cygwin*)
43         AC_DEFINE([HOST_W32], [1], [...])
44         host_w32=yes
45         if [ test x"$enable_shared" != "xno" ]; then
46             NO_UNDEFINED="-no-undefined"
47         fi
48     ;;
49 esac
50 EXTRA_LIBQUVI_LDFLAGS="$NO_UNDEFINED"
51 AC_SUBST(EXTRA_LIBQUVI_LDFLAGS)
53 # Checks for programs.
54 AC_PROG_AWK
55 AC_PROG_CC
56 AC_PROG_CXX
57 AC_PROG_LN_S
58 AC_PROG_INSTALL
59 AC_PROG_MAKE_SET
60 AC_PROG_MKDIR_P
62 AC_PATH_PROG(PROVE, prove, no)
63 AM_CONDITIONAL([HAVE_PROVE], [test x"$PROVE" != "xno"])
64 AC_SUBST(PROVE)
66 AC_PATH_PROG(VALGRIND, valgrind, no)
67 AM_CONDITIONAL([HAVE_VALGRIND], [test x"$VALGRIND" != "xno"])
68 AC_SUBST(VALGRIND)
70 AC_PATH_PROG(DATE, date, no)
71 if [ test x"$DATE" != "xno" ]; then
72     build_date=`"$DATE" +%Y-%m-%d 2>/dev/null`
73     if [ test x"$build_date" != "x" ]; then
74         AC_DEFINE_UNQUOTED([BUILD_DATE], "$build_date", [We have 'date'])
75     fi
78 AC_PATH_PROG(GIT, git, no)
79 if [ test x"$GIT" != "xno" ]; then
80     QUVI_BRANCH=_QUVI_BRANCH
81     git_describe=`"$GIT" describe "$QUVI_BRANCH" 2>/dev/null`
82     if [ test x"$git_describe" != "x" ]; then
83         AC_DEFINE_UNQUOTED([GIT_DESCRIBE],
84             "$git_describe", [We have 'git describe'])
85     fi
88 AC_PATH_PROGS(ND, [naturaldocs NaturalDocs], no)
89 AM_CONDITIONAL([HAVE_ND], [test "x$ND" != "xno"])
91 # Checks for libraries.
92 AM_ICONV
93 PKG_CHECK_MODULES([libcurl], [libcurl >= 7.18.0])
94 PKG_CHECK_MODULES([liblua], [lua >= 5.1], [], [
95     PKG_CHECK_MODULES([liblua], [lua51 >= 5.1], [], [
96         PKG_CHECK_MODULES([liblua], [lua5.1 >= 5.1], [], [
97             PKG_CHECK_MODULES(liblua, [lua-5.1 >= 5.1])
98         ])
99     ])
102 AC_ARG_WITH([soup], AS_HELP_STRING([--with-soup], [Build with libsoup]))
104 AS_IF([test "x$with_soup" = "xyes"], [
105     # Either libsoup-gnome or libsoup.
106     PKG_CHECK_MODULES( [libsoup_gnome], [libsoup-gnome-2.4 >= 2.26], [
107         AC_DEFINE([HAVE_LIBSOUP_GNOME], [1], [Have libsoup-gnome])
108         libsoup_CFLAGS="$libsoup_gnome_CFLAGS"
109         libsoup_LIBS="$libsoup_gnome_LIBS"
110         ], [PKG_CHECK_MODULES([libsoup], [libsoup-2.4 >= 2.26])]
111     )
112     AC_SUBST(libsoup_CFLAGS)
113     AC_SUBST(libsoup_LIBS)
116 AM_CONDITIONAL([WITH_SOUP], [test x"$with_soup" = "xyes"])
118 ND_FORMAT=HTML
119 AC_ARG_WITH([nd-output],
120   [AS_HELP_STRING([--with-nd-output=FORMAT],
121     [NaturalDocs output format (HTML or FramedHTML)])],
122   [
123     if [ test x"$ND" = "xno" ]; then
124       AC_MSG_ERROR([NaturalDocs not found. No point in setting output format])
125     fi
126     case $withval in
127       HTML|FramedHTML)
128         ND_FORMAT=$withval
129         ;;
130       *)
131         AC_MSG_ERROR([NaturalDocs does not support $withval output format])
132         ;;
133     esac
134   ])
135 AC_SUBST(ND_FORMAT)
137 # Checks for header files.
138 AC_HEADER_STDC # `stdlib.h', `stdarg.h', `string.h', ...
139 AC_CHECK_HEADERS([memory.h stdint.h stdlib.h limits.h stddef.h])
141 # Checks for typedefs, structures, and compiler characteristics.
142 AC_TYPE_SIZE_T
143 AC_TYPE_UINT32_T
144 AC_TYPE_UINT64_T
145 AC_TYPE_UINT8_T
146 AC_CHECK_TYPES([ptrdiff_t])
148 # Checks for library functions.
149 if [ test x"$host_w32" = "xno" ]; then
150     AC_FUNC_MALLOC
151     AC_FUNC_REALLOC
153 AC_CHECK_FUNCS(
154 [memset strdup strstr strtol strerror strcspn getcwd strchr strrchr strspn])
155 AC_FUNC_STRTOD
157 have_asprintf=no
158 AC_CHECK_FUNCS([vasprintf], [
159     AC_CHECK_FUNCS([asprintf], [have_asprintf=yes])
161 AM_CONDITIONAL([NO_ASPRINTF], [test x"$have_asprintf" != "xyes"])
163 # --enable-quvi
164 AC_ARG_ENABLE([quvi],
165     [AS_HELP_STRING([--enable-quvi],
166         [build quvi command line tool@<:@default=yes@:>@])],
167     [],
168     [enable_quvi=yes])
169 AM_CONDITIONAL([ENABLE_QUVI], [test x"$enable_quvi" != "xno"])
171 # --enable-examples
172 AC_ARG_ENABLE([examples],
173     [AS_HELP_STRING([--enable-examples],
174         [build examples @<:@default=no@:>@])],
175     [],
176     [enable_examples=no])
177 AM_CONDITIONAL([ENABLE_EXAMPLES], [test x"$enable_examples" != "xno"])
179 # --enable-tests
180 AC_ARG_ENABLE([tests],
181     [AS_HELP_STRING([--enable-tests],
182         [enable tests @<:@default=no@:>@])],
183     [],
184     [enable_tests=no])
185 AM_CONDITIONAL([ENABLE_TESTS], [test x"$enable_tests" != "xno"])
187 # --enable-verbose-tests
188 AC_ARG_ENABLE([verbose-tests],
189     [AS_HELP_STRING([--enable-verbose-tests],
190         [enable verbose tests @<:@default=no@:>@])],
191     [],
192     [enable_verbose_tests=no])
193 AM_CONDITIONAL([ENABLE_VERBOSE_TESTS],
194     [test x"$enable_verbose_tests" != "xno"])
196 # --enable-nsfw
197 AC_ARG_ENABLE([nsfw],
198     [AS_HELP_STRING([--enable-nsfw],
199         [build with adult website support @<:@default=no@:>@])],
200     [],
201     [enable_nsfw=no])
202 AM_CONDITIONAL([ENABLE_NSFW], [test x"$enable_nsfw" != "xno"])
204 if [ test x"$enable_nsfw" != "xno" ]; then
205     AC_DEFINE([ENABLE_NSFW], [1], [Define to enable nsfw])
208 # --enable-todo
209 AC_ARG_ENABLE([todo],
210     [AS_HELP_STRING([--enable-todo],
211         [with website scripts marked as "todo" @<:@default=no@:>@])],
212     [],
213     [enable_todo=no])
214 AM_CONDITIONAL([ENABLE_TODO], [test x"$enable_todo" != "xno"])
216 if [ test x"$enable_todo" != "xno" ]; then
217     AC_DEFINE([ENABLE_TODO], [1], [Define to enable todo support])
220 # --enable-nlfy
221 AC_ARG_ENABLE([nlfy],
222     [AS_HELP_STRING([--enable-nlfy],
223         [test scripts marked as "nlfy" @<:@default=no@:>@])],
224     [],
225     [enable_nlfy=no])
226 AM_CONDITIONAL([ENABLE_NLFY], [test x"$enable_nlfy" != "xno"])
228 # --with-man
229 AC_ARG_WITH([man],
230     [AS_HELP_STRING([--with-man],
231         [install manual pages @<:@default=yes@:>@])],
232     [],
233     [with_man=yes])
234 AM_CONDITIONAL([WITH_MAN], [test x"$with_man" != "xno"])
236 # GNU ld?
237 AM_CONDITIONAL([HAVE_GNU_LD], [test x"$with_gnu_ld" = "xyes"])
239 AC_CONFIG_FILES([
240     Makefile
241     src/Makefile
242     src/libquvi/Makefile
243     src/libquvi/quvi/Makefile
244     src/libquvi/Overviews/Makefile
245     src/quvi/Makefile
246     examples/Makefile
247     tests/Makefile
248     doc/Makefile
249     doc/man1/Makefile
250     share/Makefile
251     scripts/Makefile
252     libquvi.pc
255 AC_OUTPUT
257 AC_MSG_NOTICE([
259  quvi version:   ${VERSION}  g:${git_describe}  b:${build_date}
260  host setup:     ${host}
261  compiler:       ${CC}
262  cflags:         ${CFLAGS}
263  prefix:         ${prefix}
265 Options:
266  build examples: ${enable_examples}
267  build libquvi:  shared=${enable_shared} static=${enable_static}
268  build quvi:     ${enable_quvi}
270  enable tests:   ${enable_tests}
271  enable todo:    ${enable_todo}
272  enable nsfw:    ${enable_nsfw}
273  enable nlfy:    ${enable_nlfy}
275  install manual: ${with_man}