]> git.ipfire.org Git - thirdparty/sarg.git/blame - configure.in
Use boolean to enable some options instead of string compares
[thirdparty/sarg.git] / configure.in
CommitLineData
25697a35 1dnl Process this file with autoconf to produce a configure script.
120d768c 2AC_INIT([sarg],[2.2.7rc1])
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
4782357f 23CFLAGS="${CFLAGS} -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter"
05b90947 24
4782357f
FM
25dnl Check for supported gcc options
26
27AC_MSG_CHECKING([for implicit-function-declaration error flag in gcc])
28saved_CFLAGS="${CFLAGS}"
29CFLAGS="${CFLAGS} -Werror=implicit-function-declaration"
30AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_implicit_function_declaration="yes"],[have_implicit_function_declaration="no"])
31AC_MSG_RESULT($have_implicit_function_declaration)
32if test "$have_implicit_function_declaration" == "no" ; then
33 CFLAGS="${saved_CFLAGS}"
34fi
35
36AC_MSG_CHECKING([for format error flag in gcc])
37saved_CFLAGS="${CFLAGS}"
38CFLAGS="${CFLAGS} -Werror=format"
39AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_error_format="yes"],[have_error_format="no"])
40AC_MSG_RESULT($have_error_format)
41if test "$have_implicit_function_declaration" == "no" ; then
42 CFLAGS="${saved_CFLAGS}"
43fi
25697a35
GS
44
45case "$host" in
46 *-solaris*)
47 LDFLAGS="${LDFLAGS} -lsocket -lnsl"
48 CFLAGS="-DSOLARIS ${CFLAGS}"
49 ;;
50esac
51
52#dnl Checks for programs.
53#AC_PROG_CC
54
55dnl Check for headers
56AC_HEADER_DIRENT
57AC_HEADER_STDC
58
d6e703cc
FM
59dnl Check for iconv
60AM_ICONV
61if test -n "$LIBICONV" ; then
62 LIBS="$LIBS $LIBICONV"
63fi
64
25697a35
GS
65AC_CHECK_HEADERS(stdio.h stdlib.h string.h strings.h sys/time.h time.h unistd.h sys/dirent.h \
66 dirent.h sys/socket.h netdb.h arpa/inet.h sys/types.h netinet/in.h sys/stat.h \
d6e703cc 67 ctype.h gd.h gdfontl.h gdfontt.h gdfonts.h gdfontmb.h gdfontg.h iconv.h \
a1de61fe 68 errno.h sys/resource.h sys/wait.h stdarg.h inttypes.h limits.h locale.h)
25697a35
GS
69
70AC_CHECK_LIB(gd, gdImagePng,LIBS="-lgd ${LIBS}"; HAVE_GD="yes", HAVE_GD="")
71
72dnl Checks for typedefs, structures, and compiler characteristics.
73AC_C_CONST
74AC_STRUCT_TM
75
32e71fa4 76AC_SYS_LARGEFILE
d6e703cc 77
25697a35
GS
78# Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
79# needs to be defined for it
80AC_MSG_CHECKING([for fopen64])
81AC_CACHE_VAL(bu_cv_have_fopen64,
a1de61fe 82[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[FILE *f = fopen64 ("/tmp/foo","r");fclose(f);]])],[bu_cv_have_fopen64=yes],[saved_CFLAGS=$CFLAGS
c1b9eca2 83 CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
25697a35
GS
84 AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
85bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
86bu_cv_have_fopen64=no)
c1b9eca2 87 CFLAGS=$saved_CFLAGS])])
25697a35
GS
88AC_MSG_RESULT($bu_cv_have_fopen64)
89if test "$bu_cv_have_fopen64" != no; then
90 AC_DEFINE([HAVE_FOPEN64], 1,
91 [Is fopen64 available?])
92 if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE"; then
93 AC_DEFINE([_LARGEFILE64_SOURCE], 1,
94 [Enable LFS])
95 fi
96fi
97
40d681bc
FM
98dnl check for functions
99AC_CHECK_FUNCS(bzero)
25697a35 100
32e71fa4
FM
101dnl check for the rlim_t size
102AC_CHECK_SIZEOF(rlim_t,1,[#if HAVE_SYS_RESOURCE_H
103#include <sys/resource.h>
104#endif
105])
106if test $ac_cv_sizeof_rlim_t = "4"; then
107 AC_DEFINE(RLIM_STRING, "%d", [Rlim string])
108elif test $ac_cv_sizeof_rlim_t = "8"; then
109 AC_DEFINE(RLIM_STRING, "%lli", [Rlim string])
110else
740f9162 111 AC_MSG_WARN([can not detect the size of your system\'s rlim_t type])
32e71fa4
FM
112fi
113
25697a35
GS
114dnl Select htmldir
115AC_ARG_ENABLE(htmldir,
116[ --enable-htmldir=htmldir
2357ef77 117 Select htmldir as the root of your WWW documents ],
25697a35
GS
118[
119 if test "$enableval"; then
120 HTMLDIR=$enableval
121 fi
122],[HTMLDIR="/var/www/html"])
123echo "using $HTMLDIR as the WWW Document Root dir"
124AC_SUBST(HTMLDIR)
125
b3695c67
FM
126dnl Select languages dir
127AC_ARG_ENABLE(languagedir,
128[ --enable-languagedir=languagedir
129 Select languagedir as the directory with the translations of sarg ],
130[
131 if test "$enableval"; then
132 LANGDIR=$enableval
133 fi
134],[LANGDIR="${datarootdir}/sarg/languages"])
135echo "using $LANGDIR as the directory of the translations"
136AC_SUBST(LANGDIR)
137
138dnl Select fonts dir
139AC_ARG_ENABLE(fontdir,
140[ --enable-fontdir=fontdir
141 Select fontdir as the directory with the fonts to use in the reports ],
142[
143 if test "$enableval"; then
144 FONTDIR=$enableval
145 fi
146],[FONTDIR="${datarootdir}/sarg/fonts"])
147echo "using $FONTDIR as the directory of the fonts"
148AC_SUBST(FONTDIR)
149
150dnl Select images dir
151AC_ARG_ENABLE(imagedir,
152[ --enable-imagedir=imagedir
153 Select imagedir as the directory with the images to use in the reports ],
154[
155 if test "$enableval"; then
156 IMAGEDIR=$enableval
157 fi
158],[IMAGEDIR="${datarootdir}/sarg/images"])
159echo "using $IMAGEDIR as the directory of the images"
160AC_SUBST(IMAGEDIR)
161
05b90947
FM
162dnl Enable extra compile and run time protection
163AC_ARG_ENABLE(extraprotection,
164[ --enable-extraprotection
165 Enable compile and runtime extra protections ],
166[
167 if test "$enableval"; then
dcb54d06
FM
168 CFLAGS="${CFLAGS} -fstack-protector -D_FORTIFY_SOURCE=2 -Werror"
169
170 AC_MSG_CHECKING([for format security flag in gcc])
171 saved_CFLAGS="${CFLAGS}"
172 CFLAGS="${CFLAGS} -Werror=format-security"
173 AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_format_security="yes"],[have_format_security="no"])
174 AC_MSG_RESULT(have_format_security)
175 if test "$have_format_security" == "no" ; then
176 CFLAGS="${saved_CFLAGS}"
177 fi
05b90947 178 fi
feba7d37 179])
05b90947 180
0743911c
FM
181AC_CONFIG_FILES([Makefile])
182AC_OUTPUT