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