| 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.2.3 |
|---|
| 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 sys/timeb.h) |
|---|
| 63 |
|
|---|
| 64 |
AC_HEADER_SYS_WAIT |
|---|
| 65 |
|
|---|
| 66 |
dnl Checks for typedefs, structures, and compiler characteristics. |
|---|
| 67 |
AC_C_CONST |
|---|
| 68 |
AC_TYPE_PID_T |
|---|
| 69 |
AC_TYPE_SIZE_T |
|---|
| 70 |
AC_STRUCT_TM |
|---|
| 71 |
|
|---|
| 72 |
dnl Checks for library functions. |
|---|
| 73 |
AC_FUNC_ALLOCA |
|---|
| 74 |
AC_FUNC_STRFTIME |
|---|
| 75 |
AC_FUNC_VPRINTF |
|---|
| 76 |
AC_FUNC_FORK |
|---|
| 77 |
AC_CHECK_FUNCS(re_comp regcomp strdup strstr lstat) |
|---|
| 78 |
AC_CHECK_LIB(m,log) |
|---|
| 79 |
|
|---|
| 80 |
AC_REPLACE_FUNCS(vsnprintf) |
|---|
| 81 |
|
|---|
| 82 |
dnl Optional building with libxml2 |
|---|
| 83 |
|
|---|
| 84 |
dnl Probably should be 2.4.5 + patches |
|---|
| 85 |
LIBXML_REQUIRED_VERSION=2.4.3 |
|---|
| 86 |
|
|---|
| 87 |
AC_ARG_WITH(libxml2,AC_HELP_STRING([--with-libxml2=DIR],[use libxml2 in DIR (YES if found)]),,withval=maybe) |
|---|
| 88 |
|
|---|
| 89 |
dnl if the user explicity asked for no libxml2 |
|---|
| 90 |
if test "$withval" != "no"; then |
|---|
| 91 |
dnl find xml2-config program |
|---|
| 92 |
XML2_CONFIG="no" |
|---|
| 93 |
if test "$withval" != "yes" && test "$withval" != "maybe" ; then |
|---|
| 94 |
XML2_CONFIG_PATH="$withval/bin" |
|---|
| 95 |
AC_PATH_PROG(XML2_CONFIG, xml2-config,"no", $XML2_CONFIG_PATH) |
|---|
| 96 |
else |
|---|
| 97 |
XML2_CONFIG_PATH=$PATH |
|---|
| 98 |
AC_PATH_PROG(XML2_CONFIG, xml2-config,"no", $XML2_CONFIG_PATH) |
|---|
| 99 |
fi |
|---|
| 100 |
|
|---|
| 101 |
dnl we can't do anything without xml2-config |
|---|
| 102 |
if test "$XML2_CONFIG" = "no"; then |
|---|
| 103 |
withval="no" |
|---|
| 104 |
else |
|---|
| 105 |
withval=`$XML2_CONFIG --prefix` |
|---|
| 106 |
fi |
|---|
| 107 |
|
|---|
| 108 |
dnl if withval still maybe then we have failed |
|---|
| 109 |
if test "$withval" = "maybe"; then |
|---|
| 110 |
withval = "no" |
|---|
| 111 |
fi |
|---|
| 112 |
fi |
|---|
| 113 |
|
|---|
| 114 |
if test "$withval" = "no"; then |
|---|
| 115 |
AC_MSG_RESULT([Not building with libxml2 - use --with-libxml2 to enable]) |
|---|
| 116 |
else |
|---|
| 117 |
|
|---|
| 118 |
AC_SUBST(LIBXML_REQUIRED_VERSION) |
|---|
| 119 |
AC_MSG_CHECKING(for libxml libraries >= $LIBXML_REQUIRED_VERSION) |
|---|
| 120 |
|
|---|
| 121 |
AC_DEFUN(VERSION_TO_NUMBER, |
|---|
| 122 |
[`$1 | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`]) |
|---|
| 123 |
|
|---|
| 124 |
dnl |
|---|
| 125 |
dnl test version and init our variables |
|---|
| 126 |
dnl |
|---|
| 127 |
|
|---|
| 128 |
vers=VERSION_TO_NUMBER($XML2_CONFIG --version) |
|---|
| 129 |
XML2_VERSION=`$XML2_CONFIG --version` |
|---|
| 130 |
|
|---|
| 131 |
if test "$vers" -ge VERSION_TO_NUMBER(echo $LIBXML_REQUIRED_VERSION);then |
|---|
| 132 |
LIBXML2_LIB="`$XML2_CONFIG --libs`" |
|---|
| 133 |
LIBXML2_CFLAGS="`$XML2_CONFIG --cflags`" |
|---|
| 134 |
AC_MSG_RESULT(found version $XML2_VERSION) |
|---|
| 135 |
else |
|---|
| 136 |
AC_MSG_ERROR(You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of swish) |
|---|
| 137 |
fi |
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
AC_DEFINE(HAVE_LIBXML2) |
|---|
| 141 |
|
|---|
| 142 |
LIBXML2_OBJS="parser.o" |
|---|
| 143 |
AC_SUBST(LIBXML2_OBJS) |
|---|
| 144 |
AC_SUBST(LIBXML2_LIB) |
|---|
| 145 |
AC_SUBST(LIBXML2_CFLAGS) |
|---|
| 146 |
fi |
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 |
|
|---|
| 150 |
dnl Checks for zlib library. -- from libxml2 configure.in |
|---|
| 151 |
_cppflags="${CPPFLAGS}" |
|---|
| 152 |
_ldflags="${LDFLAGS}" |
|---|
| 153 |
|
|---|
| 154 |
AC_ARG_WITH(zlib,AC_HELP_STRING([--with-zlib=DIR], [use zlib in DIR (YES if found)]),,withval=maybe) |
|---|
| 155 |
|
|---|
| 156 |
dnl if withval not no or and not yes |
|---|
| 157 |
if test "$withval" != "no" -a "$withval" != "yes"; then |
|---|
| 158 |
Z_DIR=$withval |
|---|
| 159 |
CPPFLAGS="${CPPFLAGS} -I$withval/include" |
|---|
| 160 |
LDFLAGS="${LDFLAGS} -L$withval/lib" |
|---|
| 161 |
fi |
|---|
| 162 |
|
|---|
| 163 |
dnl if withval is maybe |
|---|
| 164 |
if test "$withval" = "maybe"; then |
|---|
| 165 |
withval="yes" |
|---|
| 166 |
Z_DIR="" |
|---|
| 167 |
CPPFLAGS="${CPPFLAGS}" |
|---|
| 168 |
LDFLAGS="${LDFLAGS}" |
|---|
| 169 |
fi |
|---|
| 170 |
|
|---|
| 171 |
dnl if withval not no then try to enable zlib support |
|---|
| 172 |
if test "$withval" != "no"; then |
|---|
| 173 |
AC_CHECK_HEADERS(zlib.h, |
|---|
| 174 |
AC_CHECK_LIB(z, gzread,[ |
|---|
| 175 |
AC_DEFINE(HAVE_LIBZ) |
|---|
| 176 |
if test "x${Z_DIR}" != "x"; then |
|---|
| 177 |
Z_CFLAGS="-I${Z_DIR}/include" |
|---|
| 178 |
Z_LIBS="-L${Z_DIR}/lib -lz" |
|---|
| 179 |
else |
|---|
| 180 |
Z_LIBS="-lz" |
|---|
| 181 |
fi])) |
|---|
| 182 |
AC_SUBST(Z_CFLAGS) |
|---|
| 183 |
AC_SUBST(Z_LIBS) |
|---|
| 184 |
AC_DEFINE(HAVE_ZLIB) |
|---|
| 185 |
else |
|---|
| 186 |
AC_MSG_RESULT([Not building with zlib for property compression - use --with-zlib to enable]) |
|---|
| 187 |
fi |
|---|
| 188 |
|
|---|
| 189 |
CPPFLAGS=${_cppflags} |
|---|
| 190 |
LDFLAGS=${_ldflags} |
|---|
| 191 |
|
|---|
| 192 |
|
|---|
| 193 |
|
|---|
| 194 |
dnl Header file for -D defines and sets @DEFS@ to -DHAVE_CONFIG_H |
|---|
| 195 |
AC_CONFIG_HEADER(src/acconfig.h) |
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 |
AC_OUTPUT(Makefile doc/Makefile src/Makefile) |
|---|
| 199 |
|
|---|
| 200 |
|
|---|