]>
Commit | Line | Data |
---|---|---|
25697a35 | 1 | dnl Process this file with autoconf to produce a configure script. |
2357ef77 | 2 | AC_INIT([sarg],[2.2.5]) |
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 | |
c1b9eca2 | 21 | CFLAGS="${CFLAGS} -Wall -g -O2 -Aa -Werror=implicit-function-declaration" |
25697a35 | 22 | else |
32e71fa4 | 23 | CFLAGS="${CFLAGS} -Wall -Werror=implicit-function-declaration" |
25697a35 GS |
24 | fi |
25 | ||
26 | case "$host" in | |
27 | *-solaris*) | |
28 | LDFLAGS="${LDFLAGS} -lsocket -lnsl" | |
29 | CFLAGS="-DSOLARIS ${CFLAGS}" | |
30 | ;; | |
31 | esac | |
32 | ||
33 | #dnl Checks for programs. | |
34 | #AC_PROG_CC | |
35 | ||
36 | dnl Check for headers | |
37 | AC_HEADER_DIRENT | |
38 | AC_HEADER_STDC | |
39 | ||
d6e703cc FM |
40 | dnl Check for iconv |
41 | AM_ICONV | |
42 | if test -n "$LIBICONV" ; then | |
43 | LIBS="$LIBS $LIBICONV" | |
44 | fi | |
45 | ||
25697a35 GS |
46 | AC_CHECK_HEADERS(stdio.h stdlib.h string.h strings.h sys/time.h time.h unistd.h sys/dirent.h \ |
47 | dirent.h sys/socket.h netdb.h arpa/inet.h sys/types.h netinet/in.h sys/stat.h \ | |
d6e703cc | 48 | ctype.h gd.h gdfontl.h gdfontt.h gdfonts.h gdfontmb.h gdfontg.h iconv.h \ |
4af2f8ff | 49 | errno.h sys/resource.h sys/wait.h stdarg.h inttypes.h limits.h) |
25697a35 GS |
50 | |
51 | AC_CHECK_LIB(gd, gdImagePng,LIBS="-lgd ${LIBS}"; HAVE_GD="yes", HAVE_GD="") | |
52 | ||
53 | dnl Checks for typedefs, structures, and compiler characteristics. | |
54 | AC_C_CONST | |
55 | AC_STRUCT_TM | |
56 | ||
32e71fa4 | 57 | AC_SYS_LARGEFILE |
d6e703cc | 58 | |
25697a35 GS |
59 | # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE |
60 | # needs to be defined for it | |
61 | AC_MSG_CHECKING([for fopen64]) | |
62 | AC_CACHE_VAL(bu_cv_have_fopen64, | |
c1b9eca2 FM |
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" | |
25697a35 GS |
65 | AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");], |
66 | bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE", | |
67 | bu_cv_have_fopen64=no) | |
c1b9eca2 | 68 | CFLAGS=$saved_CFLAGS])]) |
25697a35 GS |
69 | AC_MSG_RESULT($bu_cv_have_fopen64) |
70 | if test "$bu_cv_have_fopen64" != no; then | |
71 | AC_DEFINE([HAVE_FOPEN64], 1, | |
72 | [Is fopen64 available?]) | |
73 | if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE"; then | |
74 | AC_DEFINE([_LARGEFILE64_SOURCE], 1, | |
75 | [Enable LFS]) | |
76 | fi | |
77 | fi | |
78 | ||
79 | ||
32e71fa4 FM |
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 | |
2357ef77 | 85 | AC_DEFINE(OFFSET_STRING, "%"PRId64, [Offset string]) |
32e71fa4 FM |
86 | else |
87 | AC_MSG_ERROR([can not detect the size of your system\'s off_t type]) | |
88 | fi | |
89 | ||
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> | |
93 | #endif | |
94 | ]) | |
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]) | |
99 | else | |
100 | AC_MSG_ERROR([can not detect the size of your system\'s rlim_t type]) | |
101 | fi | |
102 | ||
25697a35 GS |
103 | dnl Select htmldir |
104 | AC_ARG_ENABLE(htmldir, | |
105 | [ --enable-htmldir=htmldir | |
2357ef77 | 106 | Select htmldir as the root of your WWW documents ], |
25697a35 GS |
107 | [ |
108 | if test "$enableval"; then | |
109 | HTMLDIR=$enableval | |
110 | fi | |
111 | ],[HTMLDIR="/var/www/html"]) | |
112 | echo "using $HTMLDIR as the WWW Document Root dir" | |
113 | AC_SUBST(HTMLDIR) | |
114 | ||
b3695c67 FM |
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 ], | |
119 | [ | |
120 | if test "$enableval"; then | |
121 | LANGDIR=$enableval | |
122 | fi | |
123 | ],[LANGDIR="${datarootdir}/sarg/languages"]) | |
124 | echo "using $LANGDIR as the directory of the translations" | |
125 | AC_SUBST(LANGDIR) | |
126 | ||
127 | dnl Select fonts dir | |
128 | AC_ARG_ENABLE(fontdir, | |
129 | [ --enable-fontdir=fontdir | |
130 | Select fontdir as the directory with the fonts to use in the reports ], | |
131 | [ | |
132 | if test "$enableval"; then | |
133 | FONTDIR=$enableval | |
134 | fi | |
135 | ],[FONTDIR="${datarootdir}/sarg/fonts"]) | |
136 | echo "using $FONTDIR as the directory of the fonts" | |
137 | AC_SUBST(FONTDIR) | |
138 | ||
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 ], | |
143 | [ | |
144 | if test "$enableval"; then | |
145 | IMAGEDIR=$enableval | |
146 | fi | |
147 | ],[IMAGEDIR="${datarootdir}/sarg/images"]) | |
148 | echo "using $IMAGEDIR as the directory of the images" | |
149 | AC_SUBST(IMAGEDIR) | |
150 | ||
0743911c FM |
151 | AC_CONFIG_FILES([Makefile]) |
152 | AC_OUTPUT |