1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.69])
5
6m4_include([m4/version.m4])
7
8AC_INIT([libquvi], m4_esyscmd([./gen-ver.sh -c | tr -d '\n']),
9        [http://quvi.sf.net/bugs/],[],[http://quvi.sf.net/])
10
11AC_DEFINE_UNQUOTED([BUILD_OPTS], "$@",
12  [Define to configure invocation command line options])
13
14# Interface
15LT_CUR=libquvi_lt_cur
16LT_REV=libquvi_lt_rev
17LT_AGE=libquvi_lt_age
18AC_SUBST([LT_CUR])
19AC_SUBST([LT_REV])
20AC_SUBST([LT_AGE])
21
22AC_CONFIG_SRCDIR([src/api/new.c])
23AC_CONFIG_HEADERS([config.h])
24AC_CONFIG_AUX_DIR([config.aux])
25AC_CONFIG_MACRO_DIR([m4])
26
27AC_CANONICAL_TARGET
28AC_USE_SYSTEM_EXTENSIONS
29
30AC_DEFINE_UNQUOTED([CANONICAL_TARGET], "$target",
31  [Define to canonical target])
32AC_DEFINE_UNQUOTED([CANONICAL_BUILD], "$build",
33  [Define to canonical build])
34AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host",
35  [Define to canonical host])
36
37# GNU Automake 1.13 spews a warning about AM_GNU_GETTEXT (0.18.1,
38# 0.18.2) using the deprecated AM_PROG_MKDIR_P macro. Do not specify
39# '-Werror` in the options to work around this.
40AM_INIT_AUTOMAKE([1.11.1 -Wall dist-xz no-dist-gzip tar-ustar])
41AM_SILENT_RULES([yes])
42
43# GNU Automake 1.12 requires this macro. Earlier versions do not
44# recognize this macro. Work around this.
45m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
46
47AM_GNU_GETTEXT_VERSION([0.18.1])
48AM_GNU_GETTEXT([external])
49# GETTEXT_PACKAGE is used by glib.
50AC_DEFINE([GETTEXT_PACKAGE], [PACKAGE], [Define to the gettext package name])
51AC_SUBST([GETTEXT_PACKAGE], [PACKAGE])
52
53LT_INIT([disable-static])
54LT_PREREQ([2.2.6])
55
56# Checks for programs.
57AC_PROG_CC
58AM_PROG_CC_C_O
59
60AC_DEFINE_UNQUOTED([CFLAGS], "$CFLAGS", [Define to compiler flags])
61AC_DEFINE_UNQUOTED([CC], "$CC", [Define to compiler])
62
63AC_PATH_PROG([DOXYGEN], [doxygen], [no])
64AM_CONDITIONAL([HAVE_DOXYGEN], [test x"$DOXYGEN" != "xno"])
65AC_SUBST([DOXYGEN])
66
67AC_PATH_PROG([A2X], [a2x], [no])
68AM_CONDITIONAL([HAVE_A2X], [test x"$A2X" != "xno"])
69AC_SUBST([A2X])
70AS_IF([test x"$A2X" = "xno" && test -d "$srcdir/.git"],
71  AC_MSG_ERROR([a2x is required to create man pages when building from git])])
72
73AC_PATH_PROG([DATE], [date], [no])
74AS_IF([test x"$DATE" != "xno"], [build_time=`$DATE +"%F %T %z"`])
75AC_DEFINE_UNQUOTED([BUILD_TIME], ["$build_time"], [We have build time])
76
77BUILD_TIME="$build_time"
78AC_SUBST([BUILD_TIME])
79
80AC_PATH_PROG([VALGRIND], [valgrind], [no])
81AM_CONDITIONAL([HAVE_VALGRIND], [test x"$VALGRIND" != "xno"])
82AC_SUBST([VALGRIND])
83
84# Checks for libraries.
85PKG_CHECK_MODULES([liblua], [lua >= 5.1], [], [
86  PKG_CHECK_MODULES([liblua], [lua51 >= 5.1], [], [
87    PKG_CHECK_MODULES([liblua], [lua5.1 >= 5.1], [], [
88      PKG_CHECK_MODULES(liblua, [lua-5.1 >= 5.1])])
89  ])
90])
91PKG_CHECK_MODULES([libproxy], [libproxy-1.0 >= 0.3.1])
92PKG_CHECK_MODULES([libcurl], [libcurl >= 7.21])
93PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.24])
94AM_PATH_LIBGCRYPT
95
96# Checks for scripts.
97pkg_scripts=libquvi-scripts-0.9
98
99AC_ARG_WITH([scriptsdir],
100  [AS_HELP_STRING([--with-scriptsdir=DIR],
101    [Set libquvi-scripts directory to DIR. This negates the
102    libquvi-scripts check.  DIR is assumed to contain the files
103    installed with libquvi-scripts to the
104      $prefix/share/libquvi-scripts/ directory.])],
105  [scriptsdir=$withval
106   versionfile=$scriptsdir/version],
107  [PKG_CHECK_MODULES([libquvi_scripts], ["$pkg_scripts" >= 0.9])
108    scriptsdir=`$PKG_CONFIG --variable scriptsdir $pkg_scripts 2>/dev/null`
109    versionfile=`$PKG_CONFIG --variable versionfile $pkg_scripts 2>/dev/null`
110    scriptsmodver=`$PKG_CONFIG --modversion $pkg_scripts 2>/dev/null`])
111
112AS_IF([test -z "$scriptsdir"], [
113  AC_MSG_ERROR([scriptsdir: variable not found])])
114
115AS_IF([ ! test -d "$scriptsdir"], [
116  AC_MSG_ERROR([$scriptsdir: does not exist or is not a directory])])
117
118AS_IF([test -z "$versionfile"], [
119  AC_MSG_ERROR([versionfile: variable not found])])
120
121AS_IF([ ! test -f "$versionfile"], [
122  AC_MSG_WARN([$versionfile: does not exist or is not not a regular file])])
123
124AC_DEFINE_UNQUOTED([SCRIPTSDIR], ["$scriptsdir"], [We have scriptsdir])
125AC_DEFINE_UNQUOTED([VERSIONFILE], ["$versionfile"], [We have versionfile])
126
127scriptsver=`grep <"$versionfile" "version ="|awk '{print $3}' 2>/dev/null`
128
129# Checks for header files.
130AC_CHECK_HEADERS([stdint.h string.h locale.h])
131
132# Checks for typedefs, structures, and compiler characteristics.
133AC_TYPE_UINT32_T
134AC_TYPE_UINT64_T
135AC_TYPE_UINT8_T
136
137# Checks for library functions.
138AC_CHECK_FUNCS([strrchr memset setlocale])
139
140# Version.
141VN=`$srcdir/gen-ver.sh`
142AC_DEFINE_UNQUOTED([VN], ["$VN"], [We have version number from gen-ver.sh])
143
144VN_C=`$srcdir/gen-ver.sh -c`
145AC_SUBST([VN_C])
146
147# Version: Major/Minor -pair, used to find the libquvi scripts.
148# e.g. $prefix/share/libquvi-scripts/$maj.$min/
149VERSION_MM=`$srcdir/gen-ver.sh -c -m`
150AC_DEFINE_UNQUOTED([VERSION_MM], "$VERSION_MM", [Version major/minor])
151
152# --with-manual
153AC_ARG_WITH([manual],
154  [AS_HELP_STRING([--with-manual],
155    [install manual pages @<:@default=yes@:>@])],
156  [],
157  [with_manual=yes])
158AM_CONDITIONAL([WITH_MANUAL], [test x"$with_manual" != "xno"])
159
160# 'quvi-object' is currently a globally accessible module. Lua 5.2
161# discourages this practice by removing the luaL_register (and adds the
162# luaL_setfuncs) call from the C API. We'll dismiss that (for now) with:
163AC_DEFINE([LUA_COMPAT_MODULE], [1],
164  [Define for backwards-compatibility with Lua 5.1])
165
166AC_CONFIG_FILES([
167  Makefile
168  doc/man3/Makefile
169  doc/man7/Makefile
170  doc/dox/Makefile
171  doc/dox/Doxyfile
172  doc/Makefile
173  examples/Makefile
174  examples/lib/Makefile
175  src/misc/Makefile
176  src/gcrypt/Makefile
177  src/curl/Makefile
178  src/net/Makefile
179  src/api/Makefile
180  src/api/doxy/main.dp
181  src/lua/Makefile
182  src/quvi-0.9/quvi/Makefile
183  src/quvi-0.9/Makefile
184  src/Makefile
185  tests/Makefile
186  tests/lib/Makefile
187  libquvi-0.9.pc
188  po/Makefile.in])
189AC_OUTPUT
190
191AC_MSG_NOTICE([
192  version         ${VERSION}
193  prefix          ${prefix}
194  compiler        ${CC}
195  cflags          ${CFLAGS}
196System types
197  target          ${target}
198  build           ${build}
199  host            ${host}
200Install options
201  with
202  - manual        ${with_manual}
203libquvi-scripts
204  .pc modversion  ${scriptsmodver}
205  versionfile     ${versionfile}
206    version       ${scriptsver}
207  scriptsdir      ${scriptsdir}])
208
209# vim: set ts=2 sw=2 tw=72 expandtab:
210