47
46
AC_CHECK_HEADERS(stdio.h stdlib.h string.h strings.h sys/time.h time.h unistd.h sys/dirent.h \
48
47
dirent.h sys/socket.h netdb.h arpa/inet.h sys/types.h netinet/in.h sys/stat.h \
49
48
ctype.h gd.h gdfontl.h gdfontt.h gdfonts.h gdfontmb.h gdfontg.h iconv.h \
50
errno.h sys/resource.h)
49
errno.h sys/resource.h sys/wait.h stdarg.h inttypes.h limits.h)
52
51
AC_CHECK_LIB(gd, gdImagePng,LIBS="-lgd ${LIBS}"; HAVE_GD="yes", HAVE_GD="")
58
dnl check for the off_t size
59
AC_CHECK_SIZEOF(off_t)
60
if test $ac_cv_sizeof_off_t = "4"; then
61
AC_DEFINE(OFFSET_STRING, "%d", [Offset string])
62
elif test $ac_cv_sizeof_off_t = "8"; then
63
AC_DEFINE(OFFSET_STRING, "%lli", [Offset string])
65
AC_ERROR(can not detect the size of your system\'s off_t type)
68
59
# Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
69
60
# needs to be defined for it
70
61
AC_MSG_CHECKING([for fopen64])
71
62
AC_CACHE_VAL(bu_cv_have_fopen64,
72
[AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
73
bu_cv_have_fopen64=yes,
74
[saved_CPPFLAGS=$CPPFLAGS
75
CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
63
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[FILE *f = fopen64 ("/tmp/foo","r");]])],[bu_cv_have_fopen64=yes],[saved_CFLAGS=$CFLAGS
64
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
76
65
AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");],
77
66
bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
78
67
bu_cv_have_fopen64=no)
79
CPPFLAGS=$saved_CPPFLAGS])])
68
CFLAGS=$saved_CFLAGS])])
80
69
AC_MSG_RESULT($bu_cv_have_fopen64)
81
70
if test "$bu_cv_have_fopen64" != no; then
82
71
AC_DEFINE([HAVE_FOPEN64], 1,
93
[ --enable-bindir=bindir
96
if test "$enableval"; then
99
],[BINDIR="/usr/bin"])
100
echo "using $BINDIR as the SARG binary"
104
AC_ARG_ENABLE(mandir,
105
[ --enable-mandir=mandir
108
if test "$enableval"; then
111
],[MANDIR="/usr/local/man/man1"])
112
echo "using $MANDIR as the SARG man page"
115
dnl Select sysconfdir
116
AC_ARG_ENABLE(sysconfdir,
117
[ --enable-sysconfdir=sysconfdir
120
if test "$enableval"; then
121
SYSCONFDIR=$enableval
123
],[SYSCONFDIR="/usr/local/sarg"])
124
echo "using $SYSCONFDIR as the SARG configuration dir"
80
dnl check for the off_t size
81
AC_CHECK_SIZEOF(off_t)
82
if test $ac_cv_sizeof_off_t = "4"; then
83
AC_DEFINE(OFFSET_STRING, "%d", [Offset string])
84
elif test $ac_cv_sizeof_off_t = "8"; then
85
AC_DEFINE(OFFSET_STRING, "%"PRId64, [Offset string])
87
AC_MSG_ERROR([can not detect the size of your system\'s off_t type])
90
dnl check for the rlim_t size
91
AC_CHECK_SIZEOF(rlim_t,1,[#if HAVE_SYS_RESOURCE_H
92
#include <sys/resource.h>
95
if test $ac_cv_sizeof_rlim_t = "4"; then
96
AC_DEFINE(RLIM_STRING, "%d", [Rlim string])
97
elif test $ac_cv_sizeof_rlim_t = "8"; then
98
AC_DEFINE(RLIM_STRING, "%lli", [Rlim string])
100
AC_MSG_ERROR([can not detect the size of your system\'s rlim_t type])
127
103
dnl Select htmldir
128
104
AC_ARG_ENABLE(htmldir,
129
105
[ --enable-htmldir=htmldir
106
Select htmldir as the root of your WWW documents ],
132
108
if test "$enableval"; then
133
109
HTMLDIR=$enableval
136
112
echo "using $HTMLDIR as the WWW Document Root dir"
137
113
AC_SUBST(HTMLDIR)
115
dnl Select languages dir
116
AC_ARG_ENABLE(languagedir,
117
[ --enable-languagedir=languagedir
118
Select languagedir as the directory with the translations of sarg ],
120
if test "$enableval"; then
123
],[LANGDIR="${datarootdir}/sarg/languages"])
124
echo "using $LANGDIR as the directory of the translations"
128
AC_ARG_ENABLE(fontdir,
129
[ --enable-fontdir=fontdir
130
Select fontdir as the directory with the fonts to use in the reports ],
132
if test "$enableval"; then
135
],[FONTDIR="${datarootdir}/sarg/fonts"])
136
echo "using $FONTDIR as the directory of the fonts"
139
dnl Select images dir
140
AC_ARG_ENABLE(imagedir,
141
[ --enable-imagedir=imagedir
142
Select imagedir as the directory with the images to use in the reports ],
144
if test "$enableval"; then
147
],[IMAGEDIR="${datarootdir}/sarg/images"])
148
echo "using $IMAGEDIR as the directory of the images"
151
dnl Enable extra compile and run time protection
152
AC_ARG_ENABLE(extraprotection,
153
[ --enable-extraprotection
154
Enable compile and runtime extra protections ],
156
if test "$enableval"; then
157
CFLAGS="${CFLAGS} -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=2 -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter"
159
],[IMAGEDIR="${datarootdir}/sarg/images"])
160
echo "using $IMAGEDIR as the directory of the images"
163
AC_CONFIG_FILES([Makefile])