]> git.ipfire.org Git - thirdparty/sarg.git/blame - configure.in
Continue the replacement of the user info and the translation of the error messages
[thirdparty/sarg.git] / configure.in
CommitLineData
25697a35 1dnl Process this file with autoconf to produce a configure script.
e3af0ae9 2AC_INIT([sarg],[2.3])
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
05b90947 21 CFLAGS="${CFLAGS} -g -O2 -Aa"
25697a35 22fi
f6614448 23CFLAGS="${CFLAGS} -Wall -Wno-sign-compare -Wno-unused-parameter"
05b90947 24
f6614448 25dnl Check for supported compiler options
4782357f 26
f6614448
FM
27AC_MSG_CHECKING([for extra warnings flag in $CC])
28saved_CFLAGS="${CFLAGS}"
29CFLAGS="${CFLAGS} -Wextra"
30AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_extra_warnings="yes"],[have_extra_warnings="no"])
31AC_MSG_RESULT($have_extra_warnings)
32if test "$have_extra_warnings" == "no" ; then
33 CFLAGS="${saved_CFLAGS}"
34fi
35
36AC_MSG_CHECKING([for implicit-function-declaration error flag in $CC])
4782357f
FM
37saved_CFLAGS="${CFLAGS}"
38CFLAGS="${CFLAGS} -Werror=implicit-function-declaration"
39AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_implicit_function_declaration="yes"],[have_implicit_function_declaration="no"])
40AC_MSG_RESULT($have_implicit_function_declaration)
41if test "$have_implicit_function_declaration" == "no" ; then
42 CFLAGS="${saved_CFLAGS}"
43fi
44
f6614448 45AC_MSG_CHECKING([for format error flag in $CC])
4782357f
FM
46saved_CFLAGS="${CFLAGS}"
47CFLAGS="${CFLAGS} -Werror=format"
48AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_error_format="yes"],[have_error_format="no"])
49AC_MSG_RESULT($have_error_format)
50if test "$have_implicit_function_declaration" == "no" ; then
51 CFLAGS="${saved_CFLAGS}"
52fi
25697a35
GS
53
54case "$host" in
55 *-solaris*)
56 LDFLAGS="${LDFLAGS} -lsocket -lnsl"
57 CFLAGS="-DSOLARIS ${CFLAGS}"
58 ;;
59esac
60
61#dnl Checks for programs.
62#AC_PROG_CC
63
64dnl Check for headers
65AC_HEADER_DIRENT
66AC_HEADER_STDC
67
d6e703cc
FM
68dnl Check for iconv
69AM_ICONV
70if test -n "$LIBICONV" ; then
71 LIBS="$LIBS $LIBICONV"
72fi
73
25697a35 74AC_CHECK_HEADERS(stdio.h stdlib.h string.h strings.h sys/time.h time.h unistd.h sys/dirent.h \
e6414a9d
FM
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 \
8988b90d 78 execinfo.h ldap.h math.h)
25697a35
GS
79
80AC_CHECK_LIB(gd, gdImagePng,LIBS="-lgd ${LIBS}"; HAVE_GD="yes", HAVE_GD="")
e3af0ae9 81AC_CHECK_LIB(ldap, ldap_init,LIBS="-lldap ${LIBS}"; HAVE_LDAP="yes", HAVE_LDAP="")
25697a35
GS
82
83dnl Checks for typedefs, structures, and compiler characteristics.
84AC_C_CONST
85AC_STRUCT_TM
86
095bc6be
FM
87AM_GNU_GETTEXT_VERSION([0.17])
88AM_GNU_GETTEXT([external])
89
32e71fa4 90AC_SYS_LARGEFILE
d6e703cc 91
25697a35
GS
92# Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
93# needs to be defined for it
94AC_MSG_CHECKING([for fopen64])
95AC_CACHE_VAL(bu_cv_have_fopen64,
a61fe05c
FM
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);],
25697a35 101bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
a61fe05c
FM
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);],
107bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE and no -Werror"
108werror_status="fail",
109bu_cv_have_fopen64=no)]))
110 ])
111 CFLAGS=$noerror_CFLAGS])
25697a35
GS
112AC_MSG_RESULT($bu_cv_have_fopen64)
113if 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
120fi
121
40d681bc
FM
122dnl check for functions
123AC_CHECK_FUNCS(bzero)
e6414a9d 124AC_CHECK_FUNCS(backtrace)
b5f13803 125AC_CHECK_FUNCS(symlink)
d9c45e9c 126AC_CHECK_FUNCS(lstat)
32e71fa4
FM
127
128dnl check for the rlim_t size
129AC_CHECK_SIZEOF(rlim_t,1,[#if HAVE_SYS_RESOURCE_H
130#include <sys/resource.h>
131#endif
132])
133if test $ac_cv_sizeof_rlim_t = "4"; then
134 AC_DEFINE(RLIM_STRING, "%d", [Rlim string])
135elif test $ac_cv_sizeof_rlim_t = "8"; then
136 AC_DEFINE(RLIM_STRING, "%lli", [Rlim string])
137else
740f9162 138 AC_MSG_WARN([can not detect the size of your system\'s rlim_t type])
32e71fa4
FM
139fi
140
7bbc1de4
FM
141dnl Select sarg-php directory
142AC_ARG_ENABLE(sargphp,
143[ --enable-sargphp=sargphpdir
144 Select sargphpdir as the directory to install sarg-php into ],
25697a35 145[
7bbc1de4
FM
146 if test "$enableval" -a "x$enableval" != "xno" ; then
147 SARGPHPDIR=$enableval
25697a35 148 fi
b51e26ba 149],[SARGPHPDIR="/var/www/html"])
7bbc1de4 150if test "$SARGPHPDIR" ; then
2e598081 151 echo "using $SARGPHPDIR as the directory to install sarg-php"
7bbc1de4
FM
152 AC_SUBST(SARGPHPDIR)
153fi
25697a35 154
b3695c67
FM
155dnl Select languages dir
156AC_ARG_ENABLE(languagedir,
157[ --enable-languagedir=languagedir
158 Select languagedir as the directory with the translations of sarg ],
159[
160 if test "$enableval"; then
161 LANGDIR=$enableval
162 fi
163],[LANGDIR="${datarootdir}/sarg/languages"])
2e598081
FM
164if test "x$prefix" == "xNONE" ; then
165 tempfullpath=`prefix=$ac_default_prefix ; eval "echo $LANGDIR"`
166else
167 tempfullpath=`eval "echo $LANGDIR"`
168fi
3becf85c 169echo "using $tempfullpath as the directory of the translations"
b3695c67
FM
170AC_SUBST(LANGDIR)
171
172dnl Select fonts dir
173AC_ARG_ENABLE(fontdir,
174[ --enable-fontdir=fontdir
175 Select fontdir as the directory with the fonts to use in the reports ],
176[
3becf85c 177 if test "$enableval" -a "x$enableval" != "xno" ; then
b3695c67
FM
178 FONTDIR=$enableval
179 fi
180],[FONTDIR="${datarootdir}/sarg/fonts"])
3becf85c 181if test "$FONTDIR" ; then
2e598081
FM
182 if test "x$prefix" == "xNONE" ; then
183 tempfullpath=`prefix=$ac_default_prefix ; eval "echo $FONTDIR"`
184 else
185 tempfullpath=`eval "echo $FONTDIR"`
186 fi
3becf85c
FM
187 echo "using $tempfullpath as the directory of the fonts"
188 AC_SUBST(FONTDIR)
189fi
b3695c67
FM
190
191dnl Select images dir
192AC_ARG_ENABLE(imagedir,
193[ --enable-imagedir=imagedir
194 Select imagedir as the directory with the images to use in the reports ],
195[
196 if test "$enableval"; then
197 IMAGEDIR=$enableval
198 fi
199],[IMAGEDIR="${datarootdir}/sarg/images"])
2e598081
FM
200if test "x$prefix" == "xNONE" ; then
201 tempfullpath=`prefix=$ac_default_prefix ; eval "echo $IMAGEDIR"`
202else
203 tempfullpath=`eval "echo $IMAGEDIR"`
204fi
3becf85c 205echo "using $tempfullpath as the directory of the images"
b3695c67
FM
206AC_SUBST(IMAGEDIR)
207
05b90947
FM
208dnl Enable extra compile and run time protection
209AC_ARG_ENABLE(extraprotection,
210[ --enable-extraprotection
211 Enable compile and runtime extra protections ],
212[
213 if test "$enableval"; then
a61fe05c
FM
214 CFLAGS="${CFLAGS} -fstack-protector -D_FORTIFY_SOURCE=2"
215 if test "x$werror_status" != "xfail" ; then
216 CFLAGS="${CFLAGS} -Werror"
217 fi
dcb54d06 218
f6614448 219 AC_MSG_CHECKING([for format security flag in $CC])
dcb54d06 220 saved_CFLAGS="${CFLAGS}"
d9c45e9c 221 CFLAGS="${CFLAGS} -Wformat -Werror=format-security"
dcb54d06 222 AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_format_security="yes"],[have_format_security="no"])
d9c45e9c 223 AC_MSG_RESULT($have_format_security)
dcb54d06
FM
224 if test "$have_format_security" == "no" ; then
225 CFLAGS="${saved_CFLAGS}"
226 fi
05b90947 227 fi
feba7d37 228])
05b90947 229
b6b2e9a9
FM
230AC_SUBST(PACKAGE,"$PACKAGE_NAME")
231AC_SUBST(VERSION,"$PACKAGE_VERSION")
232
095bc6be 233AC_CONFIG_FILES([Makefile po/Makefile.in])
0743911c 234AC_OUTPUT