]> git.ipfire.org Git - thirdparty/sarg.git/blob - configure.in
Use the correct format for off_t on amd64.
[thirdparty/sarg.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT([sarg],[2.2.5])
3 AC_CONFIG_SRCDIR([log.c])
4 AC_CONFIG_AUX_DIR(cfgaux)
5
6 LDFLAGS="-g"
7
8 AC_CANONICAL_HOST
9
10 AC_ARG_WITH(gcc,
11 [ --without-gcc use CC to compile])
12
13 test -n "$CC" && cc_specified=yes
14 case ${with_gcc} in
15 yes ) CC=gcc ;;
16 dnl yes ) CC=g++ ;;
17 no ) CC=cc ;;
18 * ) AC_PROG_CC;;
19 dnl * ) AC_PROG_CXX ;;
20 esac
21
22 if test "${CC}" = "cc" ; then
23 CFLAGS="${CFLAGS} -Wall -g -O2 -Aa -Werror=implicit-function-declaration"
24 else
25 CFLAGS="${CFLAGS} -Wall -Werror=implicit-function-declaration"
26 fi
27
28 case "$host" in
29 *-solaris*)
30 LDFLAGS="${LDFLAGS} -lsocket -lnsl"
31 CFLAGS="-DSOLARIS ${CFLAGS}"
32 ;;
33 esac
34
35 #dnl Checks for programs.
36 #AC_PROG_CC
37
38 dnl Check for headers
39 AC_HEADER_DIRENT
40 AC_HEADER_STDC
41
42 dnl Check for iconv
43 AM_ICONV
44 if test -n "$LIBICONV" ; then
45 LIBS="$LIBS $LIBICONV"
46 fi
47
48 AC_CHECK_HEADERS(stdio.h stdlib.h string.h strings.h sys/time.h time.h unistd.h sys/dirent.h \
49 dirent.h sys/socket.h netdb.h arpa/inet.h sys/types.h netinet/in.h sys/stat.h \
50 ctype.h gd.h gdfontl.h gdfontt.h gdfonts.h gdfontmb.h gdfontg.h iconv.h \
51 errno.h sys/resource.h sys/wait.h stdarg.h inttypes.h)
52
53 AC_CHECK_LIB(gd, gdImagePng,LIBS="-lgd ${LIBS}"; HAVE_GD="yes", HAVE_GD="")
54
55 dnl Checks for typedefs, structures, and compiler characteristics.
56 AC_C_CONST
57 AC_STRUCT_TM
58
59 AC_SYS_LARGEFILE
60
61 # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
62 # needs to be defined for it
63 AC_MSG_CHECKING([for fopen64])
64 AC_CACHE_VAL(bu_cv_have_fopen64,
65 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[FILE *f = fopen64 ("/tmp/foo","r");]])],[bu_cv_have_fopen64=yes],[saved_CFLAGS=$CFLAGS
66 CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
67 AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
68 bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
69 bu_cv_have_fopen64=no)
70 CFLAGS=$saved_CFLAGS])])
71 AC_MSG_RESULT($bu_cv_have_fopen64)
72 if test "$bu_cv_have_fopen64" != no; then
73 AC_DEFINE([HAVE_FOPEN64], 1,
74 [Is fopen64 available?])
75 if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE"; then
76 AC_DEFINE([_LARGEFILE64_SOURCE], 1,
77 [Enable LFS])
78 fi
79 fi
80
81
82 dnl check for the off_t size
83 AC_CHECK_SIZEOF(off_t)
84 if test $ac_cv_sizeof_off_t = "4"; then
85 AC_DEFINE(OFFSET_STRING, "%d", [Offset string])
86 elif test $ac_cv_sizeof_off_t = "8"; then
87 AC_DEFINE(OFFSET_STRING, "%"PRId64, [Offset string])
88 else
89 AC_MSG_ERROR([can not detect the size of your system\'s off_t type])
90 fi
91
92 dnl check for the rlim_t size
93 AC_CHECK_SIZEOF(rlim_t,1,[#if HAVE_SYS_RESOURCE_H
94 #include <sys/resource.h>
95 #endif
96 ])
97 if test $ac_cv_sizeof_rlim_t = "4"; then
98 AC_DEFINE(RLIM_STRING, "%d", [Rlim string])
99 elif test $ac_cv_sizeof_rlim_t = "8"; then
100 AC_DEFINE(RLIM_STRING, "%lli", [Rlim string])
101 else
102 AC_MSG_ERROR([can not detect the size of your system\'s rlim_t type])
103 fi
104
105 dnl Select htmldir
106 AC_ARG_ENABLE(htmldir,
107 [ --enable-htmldir=htmldir
108 Select htmldir as the root of your WWW documents ],
109 [
110 if test "$enableval"; then
111 HTMLDIR=$enableval
112 fi
113 ],[HTMLDIR="/var/www/html"])
114 echo "using $HTMLDIR as the WWW Document Root dir"
115 AC_SUBST(HTMLDIR)
116
117 AC_CONFIG_FILES([Makefile])
118 AC_OUTPUT