]> git.ipfire.org Git - thirdparty/sarg.git/blob - configure.in
Output the period as an HTML text in the HTML reports
[thirdparty/sarg.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT([sarg],[2.3-pre2])
3 AC_CONFIG_SRCDIR([log.c])
4 AC_CONFIG_AUX_DIR(cfgaux)
5
6 AC_CANONICAL_HOST
7
8 AC_ARG_WITH(gcc,
9 [ --without-gcc use CC to compile])
10
11 test -n "$CC" && cc_specified=yes
12 case ${with_gcc} in
13 yes ) CC=gcc ;;
14 dnl yes ) CC=g++ ;;
15 no ) CC=cc ;;
16 * ) AC_PROG_CC;;
17 dnl * ) AC_PROG_CXX ;;
18 esac
19
20 if test "${CC}" = "cc" ; then
21 CFLAGS="${CFLAGS} -g -O2 -Aa"
22 fi
23 CFLAGS="${CFLAGS} -Wall -Wno-sign-compare"
24
25 dnl Check for supported compiler options
26
27 AC_MSG_CHECKING([for extra warnings flag in $CC])
28 saved_CFLAGS="${CFLAGS}"
29 CFLAGS="${CFLAGS} -Wextra -Wno-unused-parameter"
30 AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_extra_warnings="yes"],[have_extra_warnings="no"])
31 AC_MSG_RESULT($have_extra_warnings)
32 if test "$have_extra_warnings" == "no" ; then
33 CFLAGS="${saved_CFLAGS}"
34 fi
35
36 AC_MSG_CHECKING([for implicit-function-declaration error flag in $CC])
37 saved_CFLAGS="${CFLAGS}"
38 CFLAGS="${CFLAGS} -Werror=implicit-function-declaration"
39 AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_implicit_function_declaration="yes"],[have_implicit_function_declaration="no"])
40 AC_MSG_RESULT($have_implicit_function_declaration)
41 if test "$have_implicit_function_declaration" == "no" ; then
42 CFLAGS="${saved_CFLAGS}"
43 fi
44
45 AC_MSG_CHECKING([for format error flag in $CC])
46 saved_CFLAGS="${CFLAGS}"
47 CFLAGS="${CFLAGS} -Werror=format"
48 AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_error_format="yes"],[have_error_format="no"])
49 AC_MSG_RESULT($have_error_format)
50 if test "$have_implicit_function_declaration" == "no" ; then
51 CFLAGS="${saved_CFLAGS}"
52 fi
53
54 case "$host" in
55 *-solaris*)
56 LDFLAGS="${LDFLAGS} -lsocket -lnsl"
57 CFLAGS="-DSOLARIS ${CFLAGS}"
58 ;;
59 esac
60
61 #dnl Checks for programs.
62 #AC_PROG_CC
63
64 dnl Check for headers
65 AC_HEADER_DIRENT
66 AC_HEADER_STDC
67
68 dnl Check for iconv
69 AM_ICONV
70 if test -n "$LIBICONV" ; then
71 LIBS="$LIBS $LIBICONV"
72 fi
73
74 AC_CHECK_HEADERS(stdio.h stdlib.h string.h strings.h sys/time.h time.h unistd.h sys/dirent.h \
75 dirent.h sys/socket.h netdb.h arpa/inet.h sys/types.h netinet/in.h sys/stat.h \
76 ctype.h gd.h gdfontl.h gdfontt.h gdfonts.h gdfontmb.h gdfontg.h iconv.h \
77 errno.h sys/resource.h sys/wait.h stdarg.h inttypes.h limits.h locale.h \
78 execinfo.h ldap.h math.h libintl.h libgen.h stdbool.h)
79
80 AC_CHECK_LIB(gd, gdImagePng,LIBS="-lgd ${LIBS}"; HAVE_GD_LIB="yes", HAVE_GD_LIB="")
81 AC_CHECK_LIB(ldap, ldap_init,LIBS="-lldap ${LIBS}"; HAVE_LDAP="yes", HAVE_LDAP="")
82
83 dnl Checks for typedefs, structures, and compiler characteristics.
84 AC_C_CONST
85 AC_STRUCT_TM
86
87 AM_GNU_GETTEXT_VERSION([0.17])
88 AM_GNU_GETTEXT([external])
89
90 AC_SYS_LARGEFILE
91
92 # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
93 # needs to be defined for it
94 AC_MSG_CHECKING([for fopen64])
95 AC_CACHE_VAL(bu_cv_have_fopen64,
96 [noerror_CFLAGS=$CFLAGS
97 CFLAGS="$CFLAGS -Werror"
98 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[FILE *f = fopen64 ("/tmp/foo","r");fclose(f);]])],[bu_cv_have_fopen64=yes],
99 [CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
100 AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");fclose(f);],
101 bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
102 CFLAGS=$noerror_CFLAGS
103 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[FILE *f = fopen64 ("/tmp/foo","r");fclose(f);]])],[bu_cv_have_fopen64="yes without -Werror"
104 werror_status="fail"],
105 [CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
106 AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");fclose(f);],
107 bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE and no -Werror"
108 werror_status="fail",
109 bu_cv_have_fopen64=no)]))
110 ])
111 CFLAGS=$noerror_CFLAGS])
112 AC_MSG_RESULT($bu_cv_have_fopen64)
113 if test "$bu_cv_have_fopen64" != no; then
114 AC_DEFINE([HAVE_FOPEN64], 1,
115 [Is fopen64 available?])
116 if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE"; then
117 AC_DEFINE([_LARGEFILE64_SOURCE], 1,
118 [Enable LFS])
119 fi
120 fi
121
122 dnl check for functions
123 AC_CHECK_FUNCS(bzero)
124 AC_CHECK_FUNCS(backtrace)
125 AC_CHECK_FUNCS(symlink)
126 AC_CHECK_FUNCS(lstat)
127 AC_CHECK_FUNCS(getnameinfo)
128
129 dnl check for the rlim_t size
130 AC_CHECK_SIZEOF(rlim_t,1,[#if HAVE_SYS_RESOURCE_H
131 #include <sys/resource.h>
132 #endif
133 ])
134 if test $ac_cv_sizeof_rlim_t = "4"; then
135 AC_DEFINE(RLIM_STRING, "%d", [Rlim string])
136 elif test $ac_cv_sizeof_rlim_t = "8"; then
137 AC_DEFINE(RLIM_STRING, "%lli", [Rlim string])
138 else
139 AC_MSG_WARN([can not detect the size of your system\'s rlim_t type])
140 fi
141
142 dnl Select sarg-php directory
143 AC_ARG_ENABLE(sargphp,
144 [ --enable-sargphp=sargphpdir
145 Select sargphpdir as the directory to install sarg-php into ],
146 [
147 if test "$enableval" -a "x$enableval" != "xno" ; then
148 SARGPHPDIR=$enableval
149 fi
150 ],[SARGPHPDIR="/var/www/html"])
151 if test "$SARGPHPDIR" ; then
152 echo "using $SARGPHPDIR as the directory to install sarg-php"
153 AC_SUBST(SARGPHPDIR)
154 fi
155
156 dnl Select fonts dir
157 AC_ARG_ENABLE(fontdir,
158 [ --enable-fontdir=fontdir
159 Select fontdir as the directory with the fonts to use in the reports ],
160 [
161 if test "$enableval" -a "x$enableval" != "xno" ; then
162 FONTDIR=$enableval
163 fi
164 ],[FONTDIR="${datarootdir}/sarg/fonts"])
165 if test "$FONTDIR" ; then
166 if test "x$prefix" == "xNONE" ; then
167 tempfullpath=`prefix=$ac_default_prefix ; eval "echo $FONTDIR"`
168 else
169 tempfullpath=`eval "echo $FONTDIR"`
170 fi
171 echo "using $tempfullpath as the directory of the fonts"
172 AC_SUBST(FONTDIR)
173 fi
174
175 dnl Select images dir
176 AC_ARG_ENABLE(imagedir,
177 [ --enable-imagedir=imagedir
178 Select imagedir as the directory with the images to use in the reports ],
179 [
180 if test "$enableval"; then
181 IMAGEDIR=$enableval
182 fi
183 ],[IMAGEDIR="${datarootdir}/sarg/images"])
184 if test "x$prefix" == "xNONE" ; then
185 tempfullpath=`prefix=$ac_default_prefix ; eval "echo $IMAGEDIR"`
186 else
187 tempfullpath=`eval "echo $IMAGEDIR"`
188 fi
189 echo "using $tempfullpath as the directory of the images"
190 AC_SUBST(IMAGEDIR)
191
192 dnl Enable extra compile and run time protection
193 AC_ARG_ENABLE(extraprotection,
194 [ --enable-extraprotection
195 Enable compile and runtime extra protections ],
196 [
197 if test "$enableval"; then
198 CFLAGS="${CFLAGS} -fstack-protector -D_FORTIFY_SOURCE=2"
199 if test "x$werror_status" != "xfail" ; then
200 CFLAGS="${CFLAGS} -Werror"
201 fi
202
203 AC_MSG_CHECKING([for format security flag in $CC])
204 saved_CFLAGS="${CFLAGS}"
205 CFLAGS="${CFLAGS} -Wformat -Werror=format-security"
206 AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_format_security="yes"],[have_format_security="no"])
207 AC_MSG_RESULT($have_format_security)
208 if test "$have_format_security" == "no" ; then
209 CFLAGS="${saved_CFLAGS}"
210 fi
211 fi
212 ])
213
214 AC_SUBST(PACKAGE,"$PACKAGE_NAME")
215 AC_SUBST(VERSION,"$PACKAGE_VERSION")
216
217 AC_CONFIG_FILES([Makefile po/Makefile.in])
218 AC_OUTPUT