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