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