quvi/util.lua: Add more functions
[quvi.git] / configure.ac
blobb475221d471a05fcd55a35fff78de5e9bde522e9
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([lib/quvi.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(GENGETOPT, gengetopt, no)
63 AM_CONDITIONAL([HAVE_GENGETOPT], [test x"$GENGETOPT" != "xno"])
64 AC_SUBST(GENGETOPT)
66 AC_PATH_PROG(DOXYGEN, doxygen, no)
67 AM_CONDITIONAL([HAVE_DOXYGEN], [test x"$DOXYGEN" != "xno"])
68 AC_SUBST(DOXYGEN)
70 AC_PATH_PROG(PROVE, prove, no)
71 AM_CONDITIONAL([HAVE_PROVE], [test x"$PROVE" != "xno"])
72 AC_SUBST(PROVE)
74 AC_PATH_PROG(VALGRIND, valgrind, no)
75 AM_CONDITIONAL([HAVE_VALGRIND], [test x"$VALGRIND" != "xno"])
76 AC_SUBST(VALGRIND)
78 AC_PATH_PROG(POD2MAN, pod2man, no)
79 AM_CONDITIONAL([HAVE_POD2MAN], [test x"$POD2MAN" != "xno"])
80 AC_SUBST(POD2MAN)
82 AC_PATH_PROG(POD2HTML, pod2html, no)
83 AM_CONDITIONAL([HAVE_POD2HTML], [test x"$POD2HTML" != "xno"])
84 AC_SUBST(POD2HTML)
86 AC_PATH_PROG(DATE, date, no)
87 if [ test x"$DATE" != "xno" ]; then
88     build_date=`"$DATE" +%Y-%m-%d 2>/dev/null`
89     if [ test x"$build_date" != "x" ]; then
90         AC_DEFINE_UNQUOTED([BUILD_DATE], "$build_date", [We have 'date'])
91     fi
94 AC_PATH_PROG(GIT, git, no)
95 if [ test x"$GIT" != "xno" ]; then
96     QUVI_BRANCH=_QUVI_BRANCH
97     git_describe=`"$GIT" describe "$QUVI_BRANCH" 2>/dev/null`
98     if [ test x"$git_describe" != "x" ]; then
99         AC_DEFINE_UNQUOTED([GIT_DESCRIBE],
100             "$git_describe", [We have 'git describe'])
101     fi
104 # Checks for libraries.
105 AM_ICONV
106 PKG_CHECK_MODULES([libcurl], [libcurl >= 7.18.0])
107 PKG_CHECK_MODULES([liblua], [lua >= 5.1], [], [
108     PKG_CHECK_MODULES([liblua], [lua51 >= 5.1], [], [
109         PKG_CHECK_MODULES([liblua], [lua5.1 >= 5.1], [], [
110             PKG_CHECK_MODULES(liblua, [lua-5.1 >= 5.1])
111         ])
112     ])
115 AC_ARG_WITH([soup], AS_HELP_STRING([--with-soup], [Build with libsoup]))
117 AS_IF([test "x$with_soup" = "xyes"], [
118     # Either libsoup-gnome or libsoup.
119     PKG_CHECK_MODULES( [libsoup_gnome], [libsoup-gnome-2.4 >= 2.26], [
120         AC_DEFINE([HAVE_LIBSOUP_GNOME], [1], [Have libsoup-gnome])
121         libsoup_CFLAGS="$libsoup_gnome_CFLAGS"
122         libsoup_LIBS="$libsoup_gnome_LIBS"
123         ], [PKG_CHECK_MODULES([libsoup], [libsoup-2.4 >= 2.26])]
124     )
125     AC_SUBST(libsoup_CFLAGS)
126     AC_SUBST(libsoup_LIBS)
129 AM_CONDITIONAL([WITH_SOUP], [test x"$with_soup" = "xyes"])
131 # Checks for header files.
132 AC_HEADER_STDC # `stdlib.h', `stdarg.h', `string.h', ...
133 AC_CHECK_HEADERS([memory.h stdint.h stdlib.h limits.h stddef.h])
135 # Checks for typedefs, structures, and compiler characteristics.
136 AC_TYPE_SIZE_T
137 AC_TYPE_UINT32_T
138 AC_TYPE_UINT64_T
139 AC_TYPE_UINT8_T
140 AC_CHECK_TYPES([ptrdiff_t])
142 # Checks for library functions.
143 if [ test x"$host_w32" = "xno" ]; then
144     AC_FUNC_MALLOC
145     AC_FUNC_REALLOC
147 AC_CHECK_FUNCS(
148 [memset strdup strstr strtol strerror strcspn getcwd strchr strrchr strspn])
149 AC_FUNC_STRTOD
151 have_asprintf=no
152 AC_CHECK_FUNCS([vasprintf], [
153     AC_CHECK_FUNCS([asprintf], [have_asprintf=yes])
155 AM_CONDITIONAL([NO_ASPRINTF], [test x"$have_asprintf" != "xyes"])
157 # --enable-quvi
158 AC_ARG_ENABLE([quvi],
159     [AS_HELP_STRING([--enable-quvi],
160         [build quvi command line tool@<:@default=yes@:>@])],
161     [],
162     [enable_quvi=yes])
163 AM_CONDITIONAL([ENABLE_QUVI], [test x"$enable_quvi" != "xno"])
165 # --enable-examples
166 AC_ARG_ENABLE([examples],
167     [AS_HELP_STRING([--enable-examples],
168         [build examples @<:@default=no@:>@])],
169     [],
170     [enable_examples=no])
171 AM_CONDITIONAL([ENABLE_EXAMPLES], [test x"$enable_examples" != "xno"])
173 # --enable-tests
174 AC_ARG_ENABLE([tests],
175     [AS_HELP_STRING([--enable-tests],
176         [enable tests @<:@default=no@:>@])],
177     [],
178     [enable_tests=no])
179 AM_CONDITIONAL([ENABLE_TESTS], [test x"$enable_tests" != "xno"])
181 # --enable-verbose-tests
182 AC_ARG_ENABLE([verbose-tests],
183     [AS_HELP_STRING([--enable-verbose-tests],
184         [enable verbose tests @<:@default=no@:>@])],
185     [],
186     [enable_verbose_tests=no])
187 AM_CONDITIONAL([ENABLE_VERBOSE_TESTS],
188     [test x"$enable_verbose_tests" != "xno"])
190 # --enable-nsfw
191 AC_ARG_ENABLE([nsfw],
192     [AS_HELP_STRING([--enable-nsfw],
193         [build with adult website support @<:@default=no@:>@])],
194     [],
195     [enable_nsfw=no])
196 AM_CONDITIONAL([ENABLE_NSFW], [test x"$enable_nsfw" != "xno"])
198 if [ test x"$enable_nsfw" != "xno" ]; then
199     AC_DEFINE([ENABLE_NSFW], [1], [Define to enable nsfw])
202 # --enable-todo
203 AC_ARG_ENABLE([todo],
204     [AS_HELP_STRING([--enable-todo],
205         [with website scripts marked as "todo" @<:@default=no@:>@])],
206     [],
207     [enable_todo=no])
208 AM_CONDITIONAL([ENABLE_TODO], [test x"$enable_todo" != "xno"])
210 if [ test x"$enable_todo" != "xno" ]; then
211     AC_DEFINE([ENABLE_TODO], [1], [Define to enable todo support])
214 # --enable-nlfy
215 AC_ARG_ENABLE([nlfy],
216     [AS_HELP_STRING([--enable-nlfy],
217         [test scripts marked as "nlfy" @<:@default=no@:>@])],
218     [],
219     [enable_nlfy=no])
220 AM_CONDITIONAL([ENABLE_NLFY], [test x"$enable_nlfy" != "xno"])
222 # --with-man
223 AC_ARG_WITH([man],
224     [AS_HELP_STRING([--with-man],
225         [install manual pages @<:@default=yes@:>@])],
226     [],
227     [with_man=yes])
228 AM_CONDITIONAL([WITH_MAN], [test x"$with_man" != "xno"])
230 # --with-doc
231 AC_ARG_WITH([doc],
232     [AS_HELP_STRING([--with-doc],
233         [install documentation @<:@default=yes@:>@])],
234     [],
235     [with_doc=yes])
236 AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" != "xno"])
238 # GNU ld?
239 AM_CONDITIONAL([HAVE_GNU_LD], [test x"$with_gnu_ld" = "xyes"])
241 AC_CONFIG_FILES([
242     Makefile
243     include/Makefile
244     include/quvi/Makefile
245     include/quvi/quvi.h
246     lib/Makefile
247     man1/Makefile
248     share/Makefile
249     doc/Makefile
250     src/Makefile
251     examples/Makefile
252     tests/Makefile
253     scripts/Makefile
254     libquvi.pc
255     doxygen.conf
258 AC_OUTPUT
260 AC_MSG_NOTICE([
262 Configured:
263     quvi version:   ${VERSION}  g:${git_describe}  b:${build_date}
264     host setup:     ${host}
265     compiler:       ${CC}
266     cflags:         ${CFLAGS}
267     prefix:         ${prefix}
269 Options:
270     build libquvi:  shared=${enable_shared} static=${enable_static}
271     build examples: ${enable_examples}
272     build quvi:     ${enable_quvi}
273     --
274     enable tests:   ${enable_tests}
275     enable todo:    ${enable_todo}
276     enable nsfw:    ${enable_nsfw}
277     enable nlfy:    ${enable_nlfy}
278     --
279     install manual: ${with_man}
280     install docs:   ${with_doc}
283 #Other:
284 #    gengetopt:      ${GENGETOPT}
285 #    doxygen:        ${DOXYGEN}
286 #    prove:          ${PROVE}
287 #    pod2man:        ${POD2MAN}
288 #    pod2html:       ${POD2HTML}