]> git.ipfire.org Git - thirdparty/sarg.git/blame - configure.in
Moved all the functions declarations from conf.h to defs.h for consistency.
[thirdparty/sarg.git] / configure.in
CommitLineData
25697a35 1dnl Process this file with autoconf to produce a configure script.
0743911c
FM
2AC_INIT
3AC_CONFIG_SRCDIR([log.c])
25697a35
GS
4AC_CONFIG_AUX_DIR(cfgaux)
5
6LDFLAGS="-g"
7
8AC_CANONICAL_HOST
9
10AC_ARG_WITH(gcc,
11[ --without-gcc use CC to compile])
12
13test -n "$CC" && cc_specified=yes
14case ${with_gcc} in
15 yes ) CC=gcc ;;
16dnl yes ) CC=g++ ;;
17 no ) CC=cc ;;
18 * ) AC_PROG_CC;;
19dnl * ) AC_PROG_CXX ;;
20esac
21
22if test "${CC}" = "cc" ; then
c1b9eca2 23 CFLAGS="${CFLAGS} -Wall -g -O2 -Aa -Werror=implicit-function-declaration"
25697a35 24else
32e71fa4 25 CFLAGS="${CFLAGS} -Wall -Werror=implicit-function-declaration"
25697a35
GS
26fi
27
28case "$host" in
29 *-solaris*)
30 LDFLAGS="${LDFLAGS} -lsocket -lnsl"
31 CFLAGS="-DSOLARIS ${CFLAGS}"
32 ;;
33esac
34
35#dnl Checks for programs.
36#AC_PROG_CC
37
38dnl Check for headers
39AC_HEADER_DIRENT
40AC_HEADER_STDC
41
d6e703cc
FM
42dnl Check for iconv
43AM_ICONV
44if test -n "$LIBICONV" ; then
45 LIBS="$LIBS $LIBICONV"
46fi
47
25697a35
GS
48AC_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 \
d6e703cc 50 ctype.h gd.h gdfontl.h gdfontt.h gdfonts.h gdfontmb.h gdfontg.h iconv.h \
d96e3ba6 51 errno.h sys/resource.h sys/wait.h)
25697a35
GS
52
53AC_CHECK_LIB(gd, gdImagePng,LIBS="-lgd ${LIBS}"; HAVE_GD="yes", HAVE_GD="")
54
55dnl Checks for typedefs, structures, and compiler characteristics.
56AC_C_CONST
57AC_STRUCT_TM
58
32e71fa4 59AC_SYS_LARGEFILE
d6e703cc 60
25697a35
GS
61# Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
62# needs to be defined for it
63AC_MSG_CHECKING([for fopen64])
64AC_CACHE_VAL(bu_cv_have_fopen64,
c1b9eca2
FM
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"
25697a35
GS
67 AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
68bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
69bu_cv_have_fopen64=no)
c1b9eca2 70 CFLAGS=$saved_CFLAGS])])
25697a35
GS
71AC_MSG_RESULT($bu_cv_have_fopen64)
72if 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
79fi
80
81
32e71fa4
FM
82dnl check for the off_t size
83AC_CHECK_SIZEOF(off_t)
84if test $ac_cv_sizeof_off_t = "4"; then
85 AC_DEFINE(OFFSET_STRING, "%d", [Offset string])
86elif test $ac_cv_sizeof_off_t = "8"; then
87 AC_DEFINE(OFFSET_STRING, "%lli", [Offset string])
88else
89 AC_MSG_ERROR([can not detect the size of your system\'s off_t type])
90fi
91
92dnl check for the rlim_t size
93AC_CHECK_SIZEOF(rlim_t,1,[#if HAVE_SYS_RESOURCE_H
94#include <sys/resource.h>
95#endif
96])
97if test $ac_cv_sizeof_rlim_t = "4"; then
98 AC_DEFINE(RLIM_STRING, "%d", [Rlim string])
99elif test $ac_cv_sizeof_rlim_t = "8"; then
100 AC_DEFINE(RLIM_STRING, "%lli", [Rlim string])
101else
102 AC_MSG_ERROR([can not detect the size of your system\'s rlim_t type])
103fi
104
25697a35
GS
105dnl Select bindir
106AC_ARG_ENABLE(bindir,
107[ --enable-bindir=bindir
108 Select bindir ],
109[
110 if test "$enableval"; then
111 BINDIR=$enableval
112 fi
113],[BINDIR="/usr/bin"])
114echo "using $BINDIR as the SARG binary"
115AC_SUBST(BINDIR)
116
117dnl Select mandir
118AC_ARG_ENABLE(mandir,
119[ --enable-mandir=mandir
120 Select mandir ],
121[
122 if test "$enableval"; then
123 MANDIR=$enableval
124 fi
125],[MANDIR="/usr/local/man/man1"])
126echo "using $MANDIR as the SARG man page"
127AC_SUBST(MANDIR)
128
129dnl Select sysconfdir
130AC_ARG_ENABLE(sysconfdir,
131[ --enable-sysconfdir=sysconfdir
132 Select sysconfdir ],
133[
134 if test "$enableval"; then
135 SYSCONFDIR=$enableval
136 fi
137],[SYSCONFDIR="/usr/local/sarg"])
138echo "using $SYSCONFDIR as the SARG configuration dir"
139AC_SUBST(SYSCONFDIR)
140
141dnl Select htmldir
142AC_ARG_ENABLE(htmldir,
143[ --enable-htmldir=htmldir
144 Select htmldir ],
145[
146 if test "$enableval"; then
147 HTMLDIR=$enableval
148 fi
149],[HTMLDIR="/var/www/html"])
150echo "using $HTMLDIR as the WWW Document Root dir"
151AC_SUBST(HTMLDIR)
152
153
0743911c
FM
154AC_CONFIG_FILES([Makefile])
155AC_OUTPUT