1 |
adcroft |
1.1 |
dnl set version (or would AM_INIT_AUTOMAKE(package_name, package_version) be better? |
2 |
|
|
dnl to update the version, modify here and run "autoconf" to generate a new ./configure script |
3 |
|
|
|
4 |
|
|
dnl AC_INIT must be the first macro called. |
5 |
|
|
dnl Have configure make sure the source code is found |
6 |
|
|
AC_INIT(src/swish.c) |
7 |
|
|
|
8 |
|
|
dnl revision name |
9 |
|
|
AC_SUBST(VERSION) |
10 |
|
|
VERSION=2.2rc1 |
11 |
|
|
|
12 |
|
|
dnl Corresponds to NAME in src/Makefile.in |
13 |
|
|
AC_SUBST(PROJECT) |
14 |
|
|
PROJECT=swish-e |
15 |
|
|
|
16 |
|
|
dnl Check for gettimeofday() |
17 |
|
|
AC_CHECK_FUNC(BSDgettimeofday, |
18 |
|
|
[AC_DEFINE(HAVE_BSDGETTIMEOFDAY)], |
19 |
|
|
[AC_CHECK_FUNC(gettimeofday, , |
20 |
|
|
[AC_DEFINE(NO_GETTOD)])]) |
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
dnl check for #! (shebang) |
26 |
|
|
AC_SYS_INTERPRETER |
27 |
|
|
|
28 |
|
|
dnl Set the @SET_MAKE@ variable=make if $(MAKE) not set |
29 |
|
|
AC_PROG_MAKE_SET |
30 |
|
|
|
31 |
|
|
dnl Check for Perl - used for making the distribution |
32 |
|
|
AC_PATH_PROG(PERL, perl, /usr/local/bin/perl,$PATH:/usr/bin:/usr/local/bin:/opt/bin:/usr/freeware/bin) |
33 |
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
dnl -- from src/configure.in -- |
38 |
|
|
|
39 |
|
|
dnl Check for a C compiler |
40 |
|
|
AC_PROG_CC |
41 |
|
|
|
42 |
|
|
dnl Resolve ranlib dependencies |
43 |
|
|
AC_PROG_RANLIB |
44 |
|
|
|
45 |
|
|
dnl Checks for libraries. |
46 |
|
|
dnl Replace `main' with a function in -lm: |
47 |
|
|
AC_CHECK_LIB(m, main) |
48 |
|
|
|
49 |
|
|
dnl Check for vsnprintf in libsnprintf.so |
50 |
|
|
AC_CHECK_LIB(snprintf, vsnprintf) |
51 |
|
|
|
52 |
|
|
dnl Checks for header files. |
53 |
|
|
dnl looks for dirent.h and sets HAVE_DIRENT_H -- do we use? |
54 |
|
|
AC_HEADER_DIRENT |
55 |
|
|
|
56 |
|
|
dnl Looks for standard C headers |
57 |
|
|
dnl which we need and don't do anything abut if we don't have them |
58 |
|
|
dnl so why bother? |
59 |
|
|
dnl AC_HEADER_STDC |
60 |
|
|
|
61 |
|
|
dnl Again, I don't think we do any tests for these, so why bother |
62 |
|
|
AC_CHECK_HEADERS(unistd.h stdlib.h) |
63 |
|
|
|
64 |
|
|
dnl Checks for typedefs, structures, and compiler characteristics. |
65 |
|
|
AC_C_CONST |
66 |
|
|
AC_TYPE_PID_T |
67 |
|
|
AC_TYPE_SIZE_T |
68 |
|
|
AC_STRUCT_TM |
69 |
|
|
|
70 |
|
|
dnl Checks for library functions. |
71 |
|
|
AC_FUNC_ALLOCA |
72 |
|
|
AC_FUNC_STRFTIME |
73 |
|
|
AC_FUNC_VPRINTF |
74 |
|
|
AC_CHECK_FUNCS(re_comp regcomp strdup strstr) |
75 |
|
|
AC_CHECK_LIB(m,log) |
76 |
|
|
|
77 |
|
|
AC_REPLACE_FUNCS(vsnprintf) |
78 |
|
|
|
79 |
|
|
dnl Optional building with libxml2 |
80 |
|
|
|
81 |
|
|
dnl Probably should be 2.4.5 + patches |
82 |
|
|
LIBXML_REQUIRED_VERSION=2.4.3 |
83 |
|
|
|
84 |
|
|
AC_ARG_WITH(libxml2,AC_HELP_STRING([--with-libxml2=DIR],[use libxml2 in DIR (YES if found)]),,withval=maybe) |
85 |
|
|
|
86 |
|
|
dnl if the user explicity asked for no libxml2 |
87 |
|
|
if test "$withval" != "no"; then |
88 |
|
|
dnl find xml2-config program |
89 |
|
|
XML2_CONFIG="no" |
90 |
|
|
if test "$withval" != "yes" && test "$withval" != "maybe" ; then |
91 |
|
|
XML2_CONFIG_PATH="$withval/bin" |
92 |
|
|
AC_PATH_PROG(XML2_CONFIG, xml2-config,"no", $XML2_CONFIG_PATH) |
93 |
|
|
else |
94 |
|
|
XML2_CONFIG_PATH=$PATH |
95 |
|
|
AC_PATH_PROG(XML2_CONFIG, xml2-config,"no", $XML2_CONFIG_PATH) |
96 |
|
|
fi |
97 |
|
|
|
98 |
|
|
dnl we can't do anything without xml2-config |
99 |
|
|
if test "$XML2_CONFIG" = "no"; then |
100 |
|
|
withval="no" |
101 |
|
|
else |
102 |
|
|
withval=`$XML2_CONFIG --prefix` |
103 |
|
|
fi |
104 |
|
|
|
105 |
|
|
dnl if withval still maybe then we have failed |
106 |
|
|
if test "$withval" = "maybe"; then |
107 |
|
|
withval = "no" |
108 |
|
|
fi |
109 |
|
|
fi |
110 |
|
|
|
111 |
|
|
if test "$withval" = "no"; then |
112 |
|
|
AC_MSG_RESULT([Not building with libxml2 - use --with-libxml2 to enable]) |
113 |
|
|
else |
114 |
|
|
|
115 |
|
|
AC_SUBST(LIBXML_REQUIRED_VERSION) |
116 |
|
|
AC_MSG_CHECKING(for libxml libraries >= $LIBXML_REQUIRED_VERSION) |
117 |
|
|
|
118 |
|
|
AC_DEFUN(VERSION_TO_NUMBER, |
119 |
|
|
[`$1 | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`]) |
120 |
|
|
|
121 |
|
|
dnl |
122 |
|
|
dnl test version and init our variables |
123 |
|
|
dnl |
124 |
|
|
|
125 |
|
|
vers=VERSION_TO_NUMBER($XML2_CONFIG --version) |
126 |
|
|
XML2_VERSION=`$XML2_CONFIG --version` |
127 |
|
|
|
128 |
|
|
if test "$vers" -ge VERSION_TO_NUMBER(echo $LIBXML_REQUIRED_VERSION);then |
129 |
|
|
LIBXML2_LIB="`$XML2_CONFIG --libs`" |
130 |
|
|
LIBXML2_CFLAGS="`$XML2_CONFIG --cflags`" |
131 |
|
|
AC_MSG_RESULT(found version $XML2_VERSION) |
132 |
|
|
else |
133 |
|
|
AC_MSG_ERROR(You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of swish) |
134 |
|
|
fi |
135 |
|
|
|
136 |
|
|
|
137 |
|
|
AC_DEFINE(HAVE_LIBXML2) |
138 |
|
|
|
139 |
|
|
LIBXML2_OBJS="parser.o" |
140 |
|
|
AC_SUBST(LIBXML2_OBJS) |
141 |
|
|
AC_SUBST(LIBXML2_LIB) |
142 |
|
|
AC_SUBST(LIBXML2_CFLAGS) |
143 |
|
|
fi |
144 |
|
|
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
dnl Checks for zlib library. -- from libxml2 configure.in |
148 |
|
|
_cppflags="${CPPFLAGS}" |
149 |
|
|
_ldflags="${LDFLAGS}" |
150 |
|
|
|
151 |
|
|
AC_ARG_WITH(zlib,AC_HELP_STRING([--with-zlib=DIR], [use zlib in DIR (YES if found)]),,withval=maybe) |
152 |
|
|
|
153 |
|
|
dnl if withval not no or and not yes |
154 |
|
|
if test "$withval" != "no" -a "$withval" != "yes"; then |
155 |
|
|
Z_DIR=$withval |
156 |
|
|
CPPFLAGS="${CPPFLAGS} -I$withval/include" |
157 |
|
|
LDFLAGS="${LDFLAGS} -L$withval/lib" |
158 |
|
|
fi |
159 |
|
|
|
160 |
|
|
dnl if withval is maybe |
161 |
|
|
if test "$withval" == "maybe"; then |
162 |
|
|
withval="yes" |
163 |
|
|
Z_DIR="" |
164 |
|
|
CPPFLAGS="${CPPFLAGS}" |
165 |
|
|
LDFLAGS="${LDFLAGS}" |
166 |
|
|
fi |
167 |
|
|
|
168 |
|
|
dnl if withval not no then try to enable zlib support |
169 |
|
|
if test "$withval" != "no"; then |
170 |
|
|
AC_CHECK_HEADERS(zlib.h, |
171 |
|
|
AC_CHECK_LIB(z, gzread,[ |
172 |
|
|
AC_DEFINE(HAVE_LIBZ) |
173 |
|
|
if test "x${Z_DIR}" != "x"; then |
174 |
|
|
Z_CFLAGS="-I${Z_DIR}/include" |
175 |
|
|
Z_LIBS="-L${Z_DIR}/lib -lz" |
176 |
|
|
else |
177 |
|
|
Z_LIBS="-lz" |
178 |
|
|
fi])) |
179 |
|
|
AC_SUBST(Z_CFLAGS) |
180 |
|
|
AC_SUBST(Z_LIBS) |
181 |
|
|
AC_DEFINE(HAVE_ZLIB) |
182 |
|
|
else |
183 |
|
|
AC_MSG_RESULT([Not building with zlib for property compression - use --with-zlib to enable]) |
184 |
|
|
fi |
185 |
|
|
|
186 |
|
|
CPPFLAGS=${_cppflags} |
187 |
|
|
LDFLAGS=${_ldflags} |
188 |
|
|
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
dnl Header file for -D defines and sets @DEFS@ to -DHAVE_CONFIG_H |
192 |
|
|
AC_CONFIG_HEADER(src/acconfig.h) |
193 |
|
|
|
194 |
|
|
|
195 |
|
|
AC_OUTPUT(Makefile doc/Makefile src/Makefile) |