1# 2# $Id$ 3# 4# See ./INSTALL for more info 5# 6 7# 8# Release numbering: even numbered dot releases are official ones, and 9# odd numbers are development ones. The svn version of this file will 10# only (ONLY!) ever (EVER!) contain odd numbers, so I'll always know if 11# a particular user has the dist or svn release. 12# 13 14AC_PREREQ(2.2) 15AC_INIT([libxo], [0.1.6], [phil@juniper.net]) 16AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability]) 17 18# Support silent build rules. Requires at least automake-1.11. 19# Disable with "configure --disable-silent-rules" or "make V=1" 20m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 21 22AC_PROG_CC 23AM_PROG_AR 24AC_PROG_INSTALL 25AC_CONFIG_MACRO_DIR([m4]) 26AC_PROG_LN_S 27 28# Must be after AC_PROG_AR 29LT_INIT([dlopen shared]) 30 31AC_PATH_PROG(BASENAME, basename, /usr/bin/basename) 32AC_PATH_PROG(BISON, bison, /usr/bin/bison) 33AC_PATH_PROG(CAT, cat, /bin/cat) 34AC_PATH_PROG(CHMOD, chmod, /bin/chmod) 35AC_PATH_PROG(CP, cp, /bin/cp) 36AC_PATH_PROG(DIFF, diff, /usr/bin/diff) 37AC_PATH_PROG(MKDIR, mkdir, /bin/mkdir) 38AC_PATH_PROG(MV, mv, /bin/mv) 39AC_PATH_PROG(RM, rm, /bin/rm) 40AC_PATH_PROG(SED, sed, /bin/sed) 41 42AC_STDC_HEADERS 43 44# Checks for typedefs, structures, and compiler characteristics. 45AC_C_INLINE 46AC_TYPE_SIZE_T 47 48# Checks for library functions. 49AC_FUNC_ALLOCA 50AC_FUNC_MALLOC 51AC_FUNC_REALLOC 52AC_CHECK_FUNCS([bzero memmove strchr strcspn strerror strspn]) 53AC_CHECK_FUNCS([sranddev srand strlcpy]) 54AC_CHECK_FUNCS([fdopen getrusage]) 55AC_CHECK_FUNCS([gettimeofday ctime]) 56AC_CHECK_FUNCS([getpass]) 57AC_CHECK_FUNCS([sysctlbyname]) 58AC_CHECK_FUNCS([flock]) 59AC_CHECK_FUNCS([asprintf]) 60 61AC_CHECK_HEADERS([dlfcn.h]) 62AC_CHECK_HEADERS([tzfile.h]) 63AC_CHECK_HEADERS([stdtime/tzfile.h]) 64AC_CHECK_FUNCS([dlfunc]) 65 66AC_CHECK_HEADERS([sys/time.h]) 67AC_CHECK_HEADERS([ctype.h errno.h stdio.h stdlib.h]) 68AC_CHECK_HEADERS([string.h sys/param.h unistd.h ]) 69AC_CHECK_HEADERS([sys/sysctl.h]) 70 71AC_CHECK_LIB([crypto], [MD5_Init]) 72AM_CONDITIONAL([HAVE_LIBCRYPTO], [test "$HAVE_LIBCRYPTO" != "no"]) 73 74dnl 75dnl Some packages need to be checked against version numbers so we 76dnl define a function here for later use 77dnl 78AC_DEFUN([VERSION_TO_NUMBER], 79[`$1 | sed -e 's/lib.* //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`]) 80 81LIBSLAX_CONFIG_PREFIX="" 82LIBSLAX_SRC="" 83 84AC_ARG_WITH(libslax-prefix, 85 [ --with-libslax-prefix=[PFX] Specify location of libslax config], 86 LIBSLAX_CONFIG_PREFIX=$withval 87) 88 89AC_MSG_CHECKING(for libslax) 90if test "x$LIBSLAX_CONFIG_PREFIX" != "x" 91then 92 SLAX_CONFIG=${LIBSLAX_CONFIG_PREFIX}/bin/slax-config 93else 94 SLAX_CONFIG=slax-config 95fi 96 97dnl 98dnl make sure slax-config is executable, 99dnl test version and init our variables 100dnl 101 102if ${SLAX_CONFIG} --libs > /dev/null 2>&1 103then 104 LIBSLAX_VERSION=`$SLAX_CONFIG --version` 105 SLAX_BINDIR="`$SLAX_CONFIG --bindir | head -1`" 106 SLAX_OXTRADOCDIR="`$SLAX_CONFIG --oxtradoc | head -1`" 107 AC_MSG_RESULT($LIBSLAX_VERSION found) 108else 109 LIBSLAX_VERSION= 110 SLAX_BINDIR= 111 SLAX_OXTRADOCDIR= 112 AC_MSG_RESULT([no]) 113fi 114 115AC_SUBST(SLAX_BINDIR) 116AC_SUBST(SLAX_OXTRADOCDIR) 117 118AC_MSG_CHECKING([whether to build with warnings]) 119AC_ARG_ENABLE([warnings], 120 [ --enable-warnings Turn on compiler warnings], 121 [LIBXO_WARNINGS=$enableval], 122 [LIBXO_WARNINGS=no]) 123AC_MSG_RESULT([$LIBXO_WARNINGS]) 124AM_CONDITIONAL([LIBXO_WARNINGS_HIGH], [test "$LIBXO_WARNINGS" != "no"]) 125 126AC_MSG_CHECKING([whether to build with debugging]) 127AC_ARG_ENABLE([debug], 128 [ --enable-debug Turn on debugging], 129 [LIBXO_DEBUG=yes; AC_DEFINE([LIBXO_DEBUG], [1], [Enable debugging])], 130 [LIBXO_DEBUG=no]) 131AC_MSG_RESULT([$LIBXO_DEBUG]) 132AM_CONDITIONAL([LIBXO_DEBUG], [test "$LIBXO_DEBUG" != "no"]) 133 134AC_CHECK_LIB([m], [lrint]) 135AM_CONDITIONAL([HAVE_LIBM], [test "$HAVE_LIBM" != "no"]) 136 137AC_MSG_CHECKING([compiler for gcc]) 138HAVE_GCC=no 139if test "${CC}" != ""; then 140 HAVE_GCC=`${CC} --version 2>&1 | grep GCC` 141 if test "${HAVE_GCC}" != ""; then 142 HAVE_GCC=yes 143 else 144 HAVE_GCC=no 145 fi 146fi 147AC_MSG_RESULT([$HAVE_GCC]) 148AM_CONDITIONAL([HAVE_GCC], [test "$HAVE_GCC" = "yes"]) 149 150AC_MSG_CHECKING([whether to build with printflike]) 151AC_ARG_ENABLE([printflike], 152 [ --enable-printflike Enable use of GCC __printflike attribute], 153 [HAVE_PRINTFLIKE=yes; 154 AC_DEFINE([HAVE_PRINTFLIKE], [1], [Support printflike])], 155 [HAVE_PRINTFLIKE=no]) 156AC_MSG_RESULT([$HAVE_PRINTFLIKE]) 157AM_CONDITIONAL([HAVE_PRINTFLIKE], [test "$HAVE_PRINTFLIKE" != ""]) 158 159AC_MSG_CHECKING([whether to build with LIBXO_OPTIONS]) 160AC_ARG_ENABLE([libxo-options], 161 [ --disable-libxo-options Turn off support for LIBXO_OPTIONS], 162 [LIBXO_OPTS=$enableval], 163 [LIBXO_OPTS=yes]) 164AC_MSG_RESULT([$LIBXO_OPTS]) 165AM_CONDITIONAL([NO_LIBXO_OPTIONS], [test "$LIBXO_OPTS" != "yes"]) 166 167 168case $host_os in 169 darwin*) 170 LIBTOOL=glibtool 171 ;; 172 Linux*|linux*) 173 CFLAGS="-D_GNU_SOURCE $CFLAGS" 174 LDFLAGS=-ldl 175 ;; 176 cygwin*|CYGWIN*) 177 LDFLAGS=-no-undefined 178 ;; 179esac 180 181case $prefix in 182 NONE) 183 prefix=/usr/local 184 ;; 185esac 186 187XO_LIBS=-lxo 188XO_SRCDIR=${srcdir} 189XO_LIBDIR=${libdir} 190XO_BINDIR=${bindir} 191XO_INCLUDEDIR=${includedir} 192 193AC_SUBST(XO_SRCDIR) 194AC_SUBST(XO_LIBDIR) 195AC_SUBST(XO_BINDIR) 196AC_SUBST(XO_INCLUDEDIR) 197 198AC_ARG_WITH(share-dir, 199 [ --with-share-dir=[DIR] Specify location of shared files], 200 [XO_SHAREDIR=$withval], 201 [XO_SHAREDIR=$datarootdir/libxo] 202) 203XO_SHAREDIR=`echo $XO_SHAREDIR | sed "s;\\${prefix};$prefix;"` 204AC_SUBST(XO_SHAREDIR) 205 206dnl for the spec file 207RELDATE=`date +'%Y-%m-%d%n'` 208AC_SUBST(RELDATE) 209 210AC_MSG_RESULT(Using configure dir $ac_abs_confdir) 211 212if test -d $ac_abs_confdir/.git ; then 213 extra=`git branch | awk '/\*/ { print $2 }'` 214 if test "$extra" != "" -a "$extra" != "master" 215 then 216 LIBXO_VERSION_EXTRA="-git-$extra" 217 fi 218fi 219 220LIBXO_VERSION=$PACKAGE_VERSION 221LIBXO_VERSION_NUMBER=VERSION_TO_NUMBER(echo $PACKAGE_VERSION) 222AC_SUBST(LIBXO_VERSION) 223AC_SUBST(LIBXO_VERSION_NUMBER) 224AC_SUBST(LIBXO_VERSION_EXTRA) 225 226AC_CONFIG_HEADERS([libxo/xoconfig.h]) 227AC_CONFIG_FILES([ 228 Makefile 229 libxo-config 230 xohtml/xohtml.sh 231 libxo/Makefile 232 libxo/xoversion.h 233 xo/Makefile 234 xolint/Makefile 235 packaging/libxo.pc 236 doc/Makefile 237 tests/Makefile 238 tests/core/Makefile 239 tests/xo/Makefile 240 packaging/libxo.spec 241]) 242AC_OUTPUT 243 244AC_MSG_NOTICE([summary of build options: 245 246 libxo version: ${VERSION} ${LIBXO_VERSION_EXTRA} 247 host type: ${host} / ${host_os} 248 install prefix: ${prefix} 249 srcdir: ${XO_SRCDIR} 250 libdir: ${XO_LIBDIR} 251 bindir: ${XO_BINDIR} 252 includedir: ${XO_INCLUDEDIR} 253 share dir: ${XO_SHAREDIR} 254 255 compiler: ${CC} (${HAVE_GCC:-no}) 256 compiler flags: ${CFLAGS} 257 library types: Shared=${enable_shared}, Static=${enable_static} 258 259 warnings: ${LIBXO_WARNINGS:-no} 260 debug: ${LIBXO_DEBUG:-no} 261 printf-like: ${HAVE_PRINTFLIKE:-no} 262 libxo-options: ${LIBXO_OPTS:-no} 263]) 264