]>
Commit | Line | Data |
---|---|---|
25697a35 | 1 | dnl Process this file with autoconf to produce a configure script. |
120d768c | 2 | AC_INIT([sarg],[2.2.7rc1]) |
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 GS |
65 | AC_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 | |
70 | AC_CHECK_LIB(gd, gdImagePng,LIBS="-lgd ${LIBS}"; HAVE_GD="yes", HAVE_GD="") | |
71 | ||
72 | dnl Checks for typedefs, structures, and compiler characteristics. | |
73 | AC_C_CONST | |
74 | AC_STRUCT_TM | |
75 | ||
32e71fa4 | 76 | AC_SYS_LARGEFILE |
d6e703cc | 77 | |
25697a35 GS |
78 | # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE |
79 | # needs to be defined for it | |
80 | AC_MSG_CHECKING([for fopen64]) | |
81 | AC_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");], |
85 | bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE", | |
86 | bu_cv_have_fopen64=no) | |
c1b9eca2 | 87 | CFLAGS=$saved_CFLAGS])]) |
25697a35 GS |
88 | AC_MSG_RESULT($bu_cv_have_fopen64) |
89 | if 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 | |
96 | fi | |
97 | ||
40d681bc FM |
98 | dnl check for functions |
99 | AC_CHECK_FUNCS(bzero) | |
25697a35 | 100 | |
32e71fa4 FM |
101 | dnl check for the rlim_t size |
102 | AC_CHECK_SIZEOF(rlim_t,1,[#if HAVE_SYS_RESOURCE_H | |
103 | #include <sys/resource.h> | |
104 | #endif | |
105 | ]) | |
106 | if test $ac_cv_sizeof_rlim_t = "4"; then | |
107 | AC_DEFINE(RLIM_STRING, "%d", [Rlim string]) | |
108 | elif test $ac_cv_sizeof_rlim_t = "8"; then | |
109 | AC_DEFINE(RLIM_STRING, "%lli", [Rlim string]) | |
110 | else | |
740f9162 | 111 | AC_MSG_WARN([can not detect the size of your system\'s rlim_t type]) |
32e71fa4 FM |
112 | fi |
113 | ||
25697a35 GS |
114 | dnl Select htmldir |
115 | AC_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"]) | |
123 | echo "using $HTMLDIR as the WWW Document Root dir" | |
124 | AC_SUBST(HTMLDIR) | |
125 | ||
b3695c67 FM |
126 | dnl Select languages dir |
127 | AC_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"]) | |
135 | echo "using $LANGDIR as the directory of the translations" | |
136 | AC_SUBST(LANGDIR) | |
137 | ||
138 | dnl Select fonts dir | |
139 | AC_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"]) | |
147 | echo "using $FONTDIR as the directory of the fonts" | |
148 | AC_SUBST(FONTDIR) | |
149 | ||
150 | dnl Select images dir | |
151 | AC_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"]) | |
159 | echo "using $IMAGEDIR as the directory of the images" | |
160 | AC_SUBST(IMAGEDIR) | |
161 | ||
05b90947 FM |
162 | dnl Enable extra compile and run time protection |
163 | AC_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 |
181 | AC_CONFIG_FILES([Makefile]) |
182 | AC_OUTPUT |