if test "${CC}" = "cc" ; then
CFLAGS="${CFLAGS} -g -O2 -Aa"
fi
-CFLAGS="${CFLAGS} -Wall -Wextra -Werror=implicit-function-declaration -Werror=format -Wno-sign-compare -Wno-unused-parameter"
+CFLAGS="${CFLAGS} -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter"
+dnl Check for supported gcc options
+
+AC_MSG_CHECKING([for implicit-function-declaration error flag in gcc])
+saved_CFLAGS="${CFLAGS}"
+CFLAGS="${CFLAGS} -Werror=implicit-function-declaration"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_implicit_function_declaration="yes"],[have_implicit_function_declaration="no"])
+AC_MSG_RESULT($have_implicit_function_declaration)
+if test "$have_implicit_function_declaration" == "no" ; then
+ CFLAGS="${saved_CFLAGS}"
+fi
+
+AC_MSG_CHECKING([for format error flag in gcc])
+saved_CFLAGS="${CFLAGS}"
+CFLAGS="${CFLAGS} -Werror=format"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_error_format="yes"],[have_error_format="no"])
+AC_MSG_RESULT($have_error_format)
+if test "$have_implicit_function_declaration" == "no" ; then
+ CFLAGS="${saved_CFLAGS}"
+fi
case "$host" in
*-solaris*)
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 ldap.h math.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 locale.h \
+ execinfo.h ldap.h math.h)
AC_CHECK_LIB(gd, gdImagePng,LIBS="-lgd ${LIBS}"; HAVE_GD="yes", HAVE_GD="")
AC_CHECK_LIB(ldap, ldap_init,LIBS="-lldap ${LIBS}"; HAVE_LDAP="yes", HAVE_LDAP="")
# 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 <stdio.h>]], [[FILE *f = fopen64 ("/tmp/foo","r");]])],[bu_cv_have_fopen64=yes],[saved_CFLAGS=$CFLAGS
- CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
- AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
+[noerror_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS -Werror"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[FILE *f = fopen64 ("/tmp/foo","r");fclose(f);]])],[bu_cv_have_fopen64=yes],
+ [CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
+ AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");fclose(f);],
bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
-bu_cv_have_fopen64=no)
- CFLAGS=$saved_CFLAGS])])
+ CFLAGS=$noerror_CFLAGS
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[FILE *f = fopen64 ("/tmp/foo","r");fclose(f);]])],[bu_cv_have_fopen64="yes without -Werror"
+ werror_status="fail"],
+ [CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
+ AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");fclose(f);],
+bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE and no -Werror"
+werror_status="fail",
+bu_cv_have_fopen64=no)]))
+ ])
+ CFLAGS=$noerror_CFLAGS])
AC_MSG_RESULT($bu_cv_have_fopen64)
if test "$bu_cv_have_fopen64" != no; then
AC_DEFINE([HAVE_FOPEN64], 1,
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 functions
+AC_CHECK_FUNCS(bzero)
+AC_CHECK_FUNCS(backtrace)
+AC_CHECK_FUNCS(symlink)
+AC_CHECK_FUNCS(lstat)
dnl check for the rlim_t size
AC_CHECK_SIZEOF(rlim_t,1,[#if HAVE_SYS_RESOURCE_H
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])
+ AC_MSG_WARN([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 ],
+dnl Select sarg-php directory
+AC_ARG_ENABLE(sargphp,
+[ --enable-sargphp=sargphpdir
+ Select sargphpdir as the directory to install sarg-php into ],
[
- if test "$enableval"; then
- HTMLDIR=$enableval
+ if test "$enableval" -a "x$enableval" != "xno" ; then
+ SARGPHPDIR=$enableval
fi
-],[HTMLDIR="/var/www/html"])
-echo "using $HTMLDIR as the WWW Document Root dir"
-AC_SUBST(HTMLDIR)
+],[SARGPHP="/var/www/html"])
+if test "$SARGPHPDIR" ; then
+ echo "using $SARGPHPDIR as the directory to install sarg-php"
+ AC_SUBST(SARGPHPDIR)
+fi
dnl Select languages dir
AC_ARG_ENABLE(languagedir,
Enable compile and runtime extra protections ],
[
if test "$enableval"; then
- CFLAGS="${CFLAGS} -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=2 -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter"
+ CFLAGS="${CFLAGS} -fstack-protector -D_FORTIFY_SOURCE=2"
+ if test "x$werror_status" != "xfail" ; then
+ CFLAGS="${CFLAGS} -Werror"
+ fi
+
+ AC_MSG_CHECKING([for format security flag in gcc])
+ saved_CFLAGS="${CFLAGS}"
+ CFLAGS="${CFLAGS} -Wformat -Werror=format-security"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_format_security="yes"],[have_format_security="no"])
+ AC_MSG_RESULT($have_format_security)
+ if test "$have_format_security" == "no" ; then
+ CFLAGS="${saved_CFLAGS}"
+ fi
fi
-],[CFLAGS="${CFLAGS}"])
-AC_SUBST(CFLAGS)
+])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT