]> git.ipfire.org Git - thirdparty/sarg.git/blob - configure.in
Update po files
[thirdparty/sarg.git] / configure.in
1 dnl Process this file with autoconf or autoreconf to produce a configure script.
2 AC_INIT([sarg],[2.3.3-pre1])
3 AC_CONFIG_SRCDIR([log.c])
4 AC_CONFIG_AUX_DIR(cfgaux)
5
6 AC_CANONICAL_HOST
7
8 AC_ARG_WITH(gcc,
9 AS_HELP_STRING([--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 dnl The purpose of the following condition is unknown but it is obsolete as it is.
21 dnl The -Aa option produces an error claiming that some argument are missing.
22 dnl if test "${CC}" = "cc" ; then
23 dnl CFLAGS="${CFLAGS} -g -O2 -Aa"
24 dnl fi
25
26 dnl C99 support is required to define LLONG_MAX (at least on CentOS 5.7)
27 AC_PROG_CC_C99
28
29 # Report more warnings to improve code quality.
30 CFLAGS="${CFLAGS} -Wall -Wno-sign-compare"
31
32 dnl Check for supported compiler options
33
34 AC_MSG_CHECKING([for extra warnings flag in $CC])
35 saved_CFLAGS="${CFLAGS}"
36 CFLAGS="${CFLAGS} -Wextra -Wno-unused-parameter"
37 AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_extra_warnings="yes"],[have_extra_warnings="no"])
38 AC_MSG_RESULT($have_extra_warnings)
39 if test "$have_extra_warnings" == "no" ; then
40 CFLAGS="${saved_CFLAGS}"
41 fi
42
43 AC_MSG_CHECKING([for implicit-function-declaration error flag in $CC])
44 saved_CFLAGS="${CFLAGS}"
45 CFLAGS="${CFLAGS} -Werror=implicit-function-declaration"
46 AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_implicit_function_declaration="yes"],[have_implicit_function_declaration="no"])
47 AC_MSG_RESULT($have_implicit_function_declaration)
48 if test "$have_implicit_function_declaration" == "no" ; then
49 CFLAGS="${saved_CFLAGS}"
50 fi
51
52 AC_MSG_CHECKING([for format error flag in $CC])
53 saved_CFLAGS="${CFLAGS}"
54 CFLAGS="${CFLAGS} -Werror=format"
55 AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_error_format="yes"],[have_error_format="no"])
56 AC_MSG_RESULT($have_error_format)
57 if test "$have_error_format" == "no" ; then
58 CFLAGS="${saved_CFLAGS}"
59 fi
60
61 case "$host" in
62 *-solaris*)
63 LDFLAGS="${LDFLAGS} -lsocket -lnsl"
64 CFLAGS="-DSOLARIS ${CFLAGS}"
65 ;;
66 esac
67
68 #dnl Checks for programs.
69 #AC_PROG_CC
70
71 dnl Check for headers
72 AC_HEADER_DIRENT
73 AC_HEADER_STDC
74
75
76 AC_CHECK_HEADERS(stdio.h stdlib.h string.h strings.h sys/time.h time.h unistd.h sys/dirent.h \
77 dirent.h sys/types.h sys/socket.h netdb.h arpa/inet.h netinet/in.h sys/stat.h \
78 ctype.h errno.h sys/resource.h sys/wait.h stdarg.h inttypes.h limits.h locale.h \
79 execinfo.h math.h libintl.h libgen.h stdbool.h getopt.h fcntl.h)
80
81 if test $ac_cv_header_getopt_h = "no" ; then
82 AC_MSG_ERROR("getopt.h is required to compile sarg")
83 fi
84
85 # Build with gd
86 AC_ARG_WITH([gd],
87 AS_HELP_STRING([--with-gd],[Compile with support for the graphical gd library]),
88 [],[with_gd=check])
89 if ( test "x$with_gd" != "xno" ) ; then
90 AC_CHECK_HEADERS(gd.h gdfontl.h gdfontt.h gdfonts.h gdfontmb.h gdfontg.h)
91 if ( test "x$ac_cv_header_gd_h" == "xyes" ) ; then
92 AC_CHECK_LIB(gd, gdImagePng,LIBS="-lgd ${LIBS}"; HAVE_GD_LIB="yes", HAVE_GD_LIB="")
93 if ( test "x$HAVE_GD_LIB" != "xyes" ) ; then
94 AC_MSG_ERROR([ligbd is required to compile sarg with gd])
95 fi
96 else
97 gd_status="not found"
98 fi
99 else
100 gd_status="disabled"
101 fi
102
103 # Build with LDAP
104 AC_ARG_WITH([ldap],
105 AS_HELP_STRING([--with-ldap],[Compile with LDAP support]),
106 [],[with_ldap=check])
107 if ( test "x$with_ldap" != "xno" ) ; then
108 AC_CHECK_HEADERS(ldap.h)
109 AC_CHECK_LIB(ldap, ldap_init,LIBS="-lldap ${LIBS}"; HAVE_LDAP="yes", HAVE_LDAP="")
110 else
111 AC_MSG_NOTICE([Not building with LDAP support as requested on the configuration command line])
112 fi
113
114 # Build with iconv
115 AC_ARG_WITH([iconv],
116 AS_HELP_STRING([--with-iconv],[Compile with support for iconv]),
117 [],[with_iconv=check])
118 if ( test "x$with_iconv" != "xno" ) ; then
119 dnl Check for iconv
120 AM_ICONV
121 if test -n "$LIBICONV" ; then
122 LIBS="$LIBS $LIBICONV"
123 fi
124 AC_CHECK_HEADERS(iconv.h)
125 else
126 AC_MSG_NOTICE([Not building with iconv as requested on the configuration command line])
127 fi
128
129 # Build with pcre
130 AC_ARG_WITH([pcre],
131 AS_HELP_STRING([--with-pcre],[Compile with support for the Perl Compatible Regular Expressions library]),
132 [],[with_pcre=check])
133 if ( test "x$with_pcre" != "xno" ) ; then
134 AC_CHECK_HEADERS(pcre.h)
135 if ( test "x$ac_cv_header_pcre_h" == "xyes" ) ; then
136 LDFLAGS="$LDFLAGS $(pcre-config --libs)"
137 CFLAGS="$CFLAGS $(pcre-config --cflags)"
138 else
139 pcre_status="not found"
140 fi
141 else
142 pcre_status="disabled"
143 fi
144
145 dnl Checks for typedefs, structures, and compiler characteristics.
146 AC_C_CONST
147 AC_STRUCT_TM
148
149 # Change the gettext version according to the available version on your system.
150 # It should not be necessary to change it unless you run autoreconf -fi.
151 AM_GNU_GETTEXT_VERSION([0.18])
152 AM_GNU_GETTEXT([external])
153
154 AC_SYS_LARGEFILE
155
156 # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
157 # needs to be defined for it
158 AC_MSG_CHECKING([for fopen64])
159 AC_CACHE_VAL(bu_cv_have_fopen64,
160 [noerror_CFLAGS=$CFLAGS
161 CFLAGS="$CFLAGS -Werror"
162 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[FILE *f = fopen64 ("/tmp/foo","r");fclose(f);]])],[bu_cv_have_fopen64=yes],
163 [CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
164 AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");fclose(f);],
165 bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
166 CFLAGS=$noerror_CFLAGS
167 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[FILE *f = fopen64 ("/tmp/foo","r");fclose(f);]])],[bu_cv_have_fopen64="yes without -Werror"
168 werror_status="fail"],
169 [CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
170 AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");fclose(f);],
171 bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE and no -Werror"
172 werror_status="fail",
173 bu_cv_have_fopen64=no)]))
174 ])
175 CFLAGS=$noerror_CFLAGS])
176 AC_MSG_RESULT($bu_cv_have_fopen64)
177 if test "$bu_cv_have_fopen64" != no; then
178 AC_DEFINE([HAVE_FOPEN64], 1,
179 [Is fopen64 available?])
180 if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE"; then
181 AC_DEFINE([_LARGEFILE64_SOURCE], 1,
182 [Enable LFS])
183 fi
184 fi
185
186 dnl check for functions
187 AC_CHECK_FUNCS(bzero)
188 AC_CHECK_FUNCS(backtrace)
189 AC_CHECK_FUNCS(symlink)
190 AC_CHECK_FUNCS(lstat)
191 AC_CHECK_FUNCS(getnameinfo)
192 AC_CHECK_FUNCS(getaddrinfo)
193 AC_CHECK_FUNCS(mkstemp)
194
195 dnl check for structure members
196 AC_CHECK_MEMBER([struct sockaddr_storage.ss_len],[AC_DEFINE([HAVE_SOCKADDR_SA_LEN],1,[ss_len in sockaddr_storage])])
197
198 dnl check for the rlim_t size
199 AC_CHECK_SIZEOF(rlim_t,1,[#if HAVE_SYS_RESOURCE_H
200 #include <sys/resource.h>
201 #endif
202 ])
203 if test $ac_cv_sizeof_rlim_t = "4"; then
204 AC_DEFINE(RLIM_STRING, "%d", [Rlim string])
205 elif test $ac_cv_sizeof_rlim_t = "8"; then
206 AC_DEFINE(RLIM_STRING, "%lli", [Rlim string])
207 else
208 AC_MSG_WARN([can not detect the size of your system\'s rlim_t type])
209 fi
210
211 dnl check for the long long int max constant
212 AC_CHECK_DECL(LLONG_MAX,HAVE_LLONG_MAX="yes",HAVE_LLONG_MAX="no",[[#include <limits.h>]])
213 if ( test "x$ac_cv_have_decl_LLONG_MAX" != "xyes" ) ; then
214 AC_MSG_ERROR([LLONG_MAX is not defined on your system.])
215 fi
216
217 dnl Select sarg-php directory
218 AC_ARG_ENABLE(sargphp,
219 AS_HELP_STRING([--enable-sargphp=sargphpdir],
220 [Select sargphpdir as the directory to install sarg-php into]),
221 [
222 if test "$enableval" -a "x$enableval" != "xno" ; then
223 SARGPHPDIR=$enableval
224 fi
225 ],[SARGPHPDIR="/var/www/html"])
226 if test "$SARGPHPDIR" ; then
227 echo "using $SARGPHPDIR as the directory to install sarg-php"
228 AC_SUBST(SARGPHPDIR)
229 fi
230
231 dnl Select fonts dir
232 AC_ARG_ENABLE(fontdir,
233 AS_HELP_STRING([--enable-fontdir=fontdir],
234 [Select fontdir as the directory with the fonts to use in the reports]),
235 [
236 if test "$enableval" -a "x$enableval" != "xno" ; then
237 FONTDIR=$enableval
238 fi
239 ],[FONTDIR="${datarootdir}/sarg/fonts"])
240 if test "$FONTDIR" ; then
241 if test "x$prefix" == "xNONE" ; then
242 tempfullpath=`prefix=$ac_default_prefix ; eval "echo $FONTDIR"`
243 else
244 tempfullpath=`eval "echo $FONTDIR"`
245 fi
246 echo "using $tempfullpath as the directory of the fonts"
247 AC_SUBST(FONTDIR)
248 fi
249
250 dnl Select images dir
251 AC_ARG_ENABLE(imagedir,
252 AS_HELP_STRING([--enable-imagedir=imagedir],
253 [Select imagedir as the directory with the images to use in the reports]),
254 [
255 if test "$enableval"; then
256 IMAGEDIR=$enableval
257 fi
258 ],[IMAGEDIR="${datarootdir}/sarg/images"])
259 if test "x$prefix" == "xNONE" ; then
260 tempfullpath=`prefix=$ac_default_prefix ; eval "echo $IMAGEDIR"`
261 else
262 tempfullpath=`eval "echo $IMAGEDIR"`
263 fi
264 echo "using $tempfullpath as the directory of the images"
265 AC_SUBST(IMAGEDIR)
266
267 dnl Enable extra compile and run time protection
268 AC_ARG_ENABLE(extraprotection,
269 AS_HELP_STRING([--enable-extraprotection],
270 [Enable compile and runtime extra protections]),
271 [
272 if test "$enableval"; then
273 CFLAGS="${CFLAGS} -fstack-protector -D_FORTIFY_SOURCE=2"
274 if test "x$werror_status" != "xfail" ; then
275 CFLAGS="${CFLAGS} -Werror"
276 fi
277
278 AC_MSG_CHECKING([for format security flag in $CC])
279 saved_CFLAGS="${CFLAGS}"
280 CFLAGS="${CFLAGS} -Wformat -Werror=format-security"
281 AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_format_security="yes"],[have_format_security="no"])
282 AC_MSG_RESULT($have_format_security)
283 if test "$have_format_security" == "no" ; then
284 CFLAGS="${saved_CFLAGS}"
285 fi
286
287 AC_MSG_CHECKING([for empty body flag in $CC])
288 saved_CFLAGS="${CFLAGS}"
289 CFLAGS="${CFLAGS} -Wempty-body"
290 AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_empty_body="yes"],[have_empty_body="no"])
291 AC_MSG_RESULT($have_empty_body)
292 if test "$have_empty_body" == "no" ; then
293 CFLAGS="${saved_CFLAGS}"
294 fi
295 fi
296 ])
297
298 dnl Enable double check of the data written in the reports
299 AC_ARG_ENABLE(doublecheck,
300 AS_HELP_STRING([--enable-doublecheck],
301 [Make sarg double check the data it manipulates and output a warning if an error is found]),
302 [
303 if test "$enableval"; then
304 AC_DEFINE(ENABLE_DOUBLE_CHECK_DATA)
305 fi
306 ])
307
308 AC_SUBST(PACKAGE,"$PACKAGE_NAME")
309 AC_SUBST(VERSION,"$PACKAGE_VERSION")
310
311 AC_CONFIG_FILES([Makefile po/Makefile.in])
312 AC_OUTPUT
313
314 if ( test "x$gd_status" == "xdisabled" ) ; then
315 AC_MSG_NOTICE([Not building with gd as requested on the configuration command line])
316 elif ( test "x$gd_status" == "xnot found" ) ; then
317 AC_MSG_NOTICE([gd.h was not found so the graphs won't be available in the report])
318 fi
319
320 if ( test "x$pcre_status" == "xdisabled" ) ; then
321 AC_MSG_NOTICE([Not building with pcre as requested on the configuration command line])
322 elif ( test "x$pcre_status" == "xnot found" ) ; then
323 AC_MSG_NOTICE([pcre.h was not found so the regexp won't be available in the hostalias])
324 fi