dnl Process this file with autoconf to produce a configure script. AC_INIT([sarg],[2.2.5]) AC_CONFIG_SRCDIR([log.c]) AC_CONFIG_AUX_DIR(cfgaux) AC_CANONICAL_HOST AC_ARG_WITH(gcc, [ --without-gcc use CC to compile]) test -n "$CC" && cc_specified=yes case ${with_gcc} in yes ) CC=gcc ;; dnl yes ) CC=g++ ;; no ) CC=cc ;; * ) AC_PROG_CC;; dnl * ) AC_PROG_CXX ;; esac if test "${CC}" = "cc" ; then CFLAGS="${CFLAGS} -Wall -g -O2 -Aa -Werror=implicit-function-declaration" else CFLAGS="${CFLAGS} -Wall -Werror=implicit-function-declaration" fi case "$host" in *-solaris*) LDFLAGS="${LDFLAGS} -lsocket -lnsl" CFLAGS="-DSOLARIS ${CFLAGS}" ;; esac #dnl Checks for programs. #AC_PROG_CC dnl Check for headers AC_HEADER_DIRENT AC_HEADER_STDC dnl Check for iconv AM_ICONV if test -n "$LIBICONV" ; then LIBS="$LIBS $LIBICONV" fi AC_CHECK_HEADERS(stdio.h stdlib.h string.h strings.h sys/time.h time.h unistd.h sys/dirent.h \ dirent.h sys/socket.h netdb.h arpa/inet.h sys/types.h netinet/in.h sys/stat.h \ ctype.h gd.h gdfontl.h gdfontt.h gdfonts.h gdfontmb.h gdfontg.h iconv.h \ errno.h sys/resource.h sys/wait.h stdarg.h inttypes.h limits.h) AC_CHECK_LIB(gd, gdImagePng,LIBS="-lgd ${LIBS}"; HAVE_GD="yes", HAVE_GD="") dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_STRUCT_TM AC_SYS_LARGEFILE # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE # needs to be defined for it AC_MSG_CHECKING([for fopen64]) AC_CACHE_VAL(bu_cv_have_fopen64, [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[FILE *f = fopen64 ("/tmp/foo","r");]])],[bu_cv_have_fopen64=yes],[saved_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE" AC_TRY_LINK([#include ], [FILE *f = fopen64 ("/tmp/foo","r");], bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE", bu_cv_have_fopen64=no) CFLAGS=$saved_CFLAGS])]) AC_MSG_RESULT($bu_cv_have_fopen64) if test "$bu_cv_have_fopen64" != no; then AC_DEFINE([HAVE_FOPEN64], 1, [Is fopen64 available?]) if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE"; then AC_DEFINE([_LARGEFILE64_SOURCE], 1, [Enable LFS]) fi fi dnl check for the off_t size AC_CHECK_SIZEOF(off_t) if test $ac_cv_sizeof_off_t = "4"; then AC_DEFINE(OFFSET_STRING, "%d", [Offset string]) elif test $ac_cv_sizeof_off_t = "8"; then AC_DEFINE(OFFSET_STRING, "%"PRId64, [Offset string]) else AC_MSG_ERROR([can not detect the size of your system\'s off_t type]) fi dnl check for the rlim_t size AC_CHECK_SIZEOF(rlim_t,1,[#if HAVE_SYS_RESOURCE_H #include #endif ]) if test $ac_cv_sizeof_rlim_t = "4"; then AC_DEFINE(RLIM_STRING, "%d", [Rlim string]) elif test $ac_cv_sizeof_rlim_t = "8"; then AC_DEFINE(RLIM_STRING, "%lli", [Rlim string]) else AC_MSG_ERROR([can not detect the size of your system\'s rlim_t type]) fi dnl Select htmldir AC_ARG_ENABLE(htmldir, [ --enable-htmldir=htmldir Select htmldir as the root of your WWW documents ], [ if test "$enableval"; then HTMLDIR=$enableval fi ],[HTMLDIR="/var/www/html"]) echo "using $HTMLDIR as the WWW Document Root dir" AC_SUBST(HTMLDIR) dnl Select languages dir AC_ARG_ENABLE(languagedir, [ --enable-languagedir=languagedir Select languagedir as the directory with the translations of sarg ], [ if test "$enableval"; then LANGDIR=$enableval fi ],[LANGDIR="${datarootdir}/sarg/languages"]) echo "using $LANGDIR as the directory of the translations" AC_SUBST(LANGDIR) dnl Select fonts dir AC_ARG_ENABLE(fontdir, [ --enable-fontdir=fontdir Select fontdir as the directory with the fonts to use in the reports ], [ if test "$enableval"; then FONTDIR=$enableval fi ],[FONTDIR="${datarootdir}/sarg/fonts"]) echo "using $FONTDIR as the directory of the fonts" AC_SUBST(FONTDIR) dnl Select images dir AC_ARG_ENABLE(imagedir, [ --enable-imagedir=imagedir Select imagedir as the directory with the images to use in the reports ], [ if test "$enableval"; then IMAGEDIR=$enableval fi ],[IMAGEDIR="${datarootdir}/sarg/images"]) echo "using $IMAGEDIR as the directory of the images" AC_SUBST(IMAGEDIR) AC_CONFIG_FILES([Makefile]) AC_OUTPUT