]>
Commit | Line | Data |
---|---|---|
25697a35 | 1 | dnl Process this file with autoconf to produce a configure script. |
0743911c FM |
2 | AC_INIT |
3 | AC_CONFIG_SRCDIR([log.c]) | |
25697a35 GS |
4 | AC_CONFIG_AUX_DIR(cfgaux) |
5 | ||
6 | LDFLAGS="-g" | |
7 | ||
8 | AC_CANONICAL_HOST | |
9 | ||
10 | AC_ARG_WITH(gcc, | |
11 | [ --without-gcc use CC to compile]) | |
12 | ||
13 | test -n "$CC" && cc_specified=yes | |
14 | case ${with_gcc} in | |
15 | yes ) CC=gcc ;; | |
16 | dnl yes ) CC=g++ ;; | |
17 | no ) CC=cc ;; | |
18 | * ) AC_PROG_CC;; | |
19 | dnl * ) AC_PROG_CXX ;; | |
20 | esac | |
21 | ||
22 | if test "${CC}" = "cc" ; then | |
c1b9eca2 | 23 | CFLAGS="${CFLAGS} -Wall -g -O2 -Aa -Werror=implicit-function-declaration" |
25697a35 | 24 | else |
32e71fa4 | 25 | CFLAGS="${CFLAGS} -Wall -Werror=implicit-function-declaration" |
25697a35 GS |
26 | fi |
27 | ||
28 | case "$host" in | |
29 | *-solaris*) | |
30 | LDFLAGS="${LDFLAGS} -lsocket -lnsl" | |
31 | CFLAGS="-DSOLARIS ${CFLAGS}" | |
32 | ;; | |
33 | esac | |
34 | ||
35 | #dnl Checks for programs. | |
36 | #AC_PROG_CC | |
37 | ||
38 | dnl Check for headers | |
39 | AC_HEADER_DIRENT | |
40 | AC_HEADER_STDC | |
41 | ||
d6e703cc FM |
42 | dnl Check for iconv |
43 | AM_ICONV | |
44 | if test -n "$LIBICONV" ; then | |
45 | LIBS="$LIBS $LIBICONV" | |
46 | fi | |
47 | ||
25697a35 GS |
48 | AC_CHECK_HEADERS(stdio.h stdlib.h string.h strings.h sys/time.h time.h unistd.h sys/dirent.h \ |
49 | dirent.h sys/socket.h netdb.h arpa/inet.h sys/types.h netinet/in.h sys/stat.h \ | |
d6e703cc | 50 | ctype.h gd.h gdfontl.h gdfontt.h gdfonts.h gdfontmb.h gdfontg.h iconv.h \ |
d96e3ba6 | 51 | errno.h sys/resource.h sys/wait.h) |
25697a35 GS |
52 | |
53 | AC_CHECK_LIB(gd, gdImagePng,LIBS="-lgd ${LIBS}"; HAVE_GD="yes", HAVE_GD="") | |
54 | ||
55 | dnl Checks for typedefs, structures, and compiler characteristics. | |
56 | AC_C_CONST | |
57 | AC_STRUCT_TM | |
58 | ||
32e71fa4 | 59 | AC_SYS_LARGEFILE |
d6e703cc | 60 | |
25697a35 GS |
61 | # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE |
62 | # needs to be defined for it | |
63 | AC_MSG_CHECKING([for fopen64]) | |
64 | AC_CACHE_VAL(bu_cv_have_fopen64, | |
c1b9eca2 FM |
65 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[FILE *f = fopen64 ("/tmp/foo","r");]])],[bu_cv_have_fopen64=yes],[saved_CFLAGS=$CFLAGS |
66 | CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE" | |
25697a35 GS |
67 | AC_TRY_LINK([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");], |
68 | bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE", | |
69 | bu_cv_have_fopen64=no) | |
c1b9eca2 | 70 | CFLAGS=$saved_CFLAGS])]) |
25697a35 GS |
71 | AC_MSG_RESULT($bu_cv_have_fopen64) |
72 | if test "$bu_cv_have_fopen64" != no; then | |
73 | AC_DEFINE([HAVE_FOPEN64], 1, | |
74 | [Is fopen64 available?]) | |
75 | if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE"; then | |
76 | AC_DEFINE([_LARGEFILE64_SOURCE], 1, | |
77 | [Enable LFS]) | |
78 | fi | |
79 | fi | |
80 | ||
81 | ||
32e71fa4 FM |
82 | dnl check for the off_t size |
83 | AC_CHECK_SIZEOF(off_t) | |
84 | if test $ac_cv_sizeof_off_t = "4"; then | |
85 | AC_DEFINE(OFFSET_STRING, "%d", [Offset string]) | |
86 | elif test $ac_cv_sizeof_off_t = "8"; then | |
87 | AC_DEFINE(OFFSET_STRING, "%lli", [Offset string]) | |
88 | else | |
89 | AC_MSG_ERROR([can not detect the size of your system\'s off_t type]) | |
90 | fi | |
91 | ||
92 | dnl check for the rlim_t size | |
93 | AC_CHECK_SIZEOF(rlim_t,1,[#if HAVE_SYS_RESOURCE_H | |
94 | #include <sys/resource.h> | |
95 | #endif | |
96 | ]) | |
97 | if test $ac_cv_sizeof_rlim_t = "4"; then | |
98 | AC_DEFINE(RLIM_STRING, "%d", [Rlim string]) | |
99 | elif test $ac_cv_sizeof_rlim_t = "8"; then | |
100 | AC_DEFINE(RLIM_STRING, "%lli", [Rlim string]) | |
101 | else | |
102 | AC_MSG_ERROR([can not detect the size of your system\'s rlim_t type]) | |
103 | fi | |
104 | ||
25697a35 GS |
105 | dnl Select bindir |
106 | AC_ARG_ENABLE(bindir, | |
107 | [ --enable-bindir=bindir | |
108 | Select bindir ], | |
109 | [ | |
110 | if test "$enableval"; then | |
111 | BINDIR=$enableval | |
112 | fi | |
113 | ],[BINDIR="/usr/bin"]) | |
114 | echo "using $BINDIR as the SARG binary" | |
115 | AC_SUBST(BINDIR) | |
116 | ||
117 | dnl Select mandir | |
118 | AC_ARG_ENABLE(mandir, | |
119 | [ --enable-mandir=mandir | |
120 | Select mandir ], | |
121 | [ | |
122 | if test "$enableval"; then | |
123 | MANDIR=$enableval | |
124 | fi | |
125 | ],[MANDIR="/usr/local/man/man1"]) | |
126 | echo "using $MANDIR as the SARG man page" | |
127 | AC_SUBST(MANDIR) | |
128 | ||
129 | dnl Select sysconfdir | |
130 | AC_ARG_ENABLE(sysconfdir, | |
131 | [ --enable-sysconfdir=sysconfdir | |
132 | Select sysconfdir ], | |
133 | [ | |
134 | if test "$enableval"; then | |
135 | SYSCONFDIR=$enableval | |
136 | fi | |
137 | ],[SYSCONFDIR="/usr/local/sarg"]) | |
138 | echo "using $SYSCONFDIR as the SARG configuration dir" | |
139 | AC_SUBST(SYSCONFDIR) | |
140 | ||
141 | dnl Select htmldir | |
142 | AC_ARG_ENABLE(htmldir, | |
143 | [ --enable-htmldir=htmldir | |
144 | Select htmldir ], | |
145 | [ | |
146 | if test "$enableval"; then | |
147 | HTMLDIR=$enableval | |
148 | fi | |
149 | ],[HTMLDIR="/var/www/html"]) | |
150 | echo "using $HTMLDIR as the WWW Document Root dir" | |
151 | AC_SUBST(HTMLDIR) | |
152 | ||
153 | ||
0743911c FM |
154 | AC_CONFIG_FILES([Makefile]) |
155 | AC_OUTPUT |