root/cherokee/trunk/configure.in

Revision 4255, 43.0 kB (checked in by alo, 3 weeks ago)

Cherokee 0.99.43 released

  • Property svn:keywords set to Id
Line 
1 dnl -*- mode: m4-mode -*-
2 dnl Process this file with autoconf to produce a configure script.
3
4 AC_COPYRIGHT([
5 Copyright (C) 2001-2010 Alvaro Lopez Ortega
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of version 2 of the GNU General Public
9 License as published by the Free Software Foundation.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 USA
20 ])
21
22 dnl require autoconf 2.60
23 AC_PREREQ([2.60])
24
25 dnl Version
26 m4_define([cherokee_major_version], [0])
27 m4_define([cherokee_minor_version], [99])
28 m4_define([cherokee_micro_version], [44])
29 m4_define([cherokee_version], m4_format('%s.%s.%s', cherokee_major_version, cherokee_minor_version, cherokee_micro_version))
30
31 dnl Init autoconf and automake
32 AC_INIT([cherokee], [cherokee_version], [http://bugs.cherokee-project.com/], [cherokee])
33 AC_CONFIG_SRCDIR([cherokee/server.c])
34 AC_CONFIG_MACRO_DIR([m4])
35 AM_INIT_AUTOMAKE([no-define])
36
37 dnl Define version
38 AC_DEFINE(PACKAGE_MAJOR_VERSION, "cherokee_major_version", [Version string])
39 AC_DEFINE(PACKAGE_MINOR_VERSION, "cherokee_minor_version", [Version string])
40 AC_DEFINE(PACKAGE_MICRO_VERSION, "cherokee_micro_version", [Version string])
41
42 PACKAGE_MAJOR_VERSION="cherokee_major_version"
43 PACKAGE_MINOR_VERSION="cherokee_minor_version"
44 PACKAGE_MICRO_VERSION="cherokee_micro_version"
45 AC_SUBST(PACKAGE_MAJOR_VERSION)
46 AC_SUBST(PACKAGE_MINOR_VERSION)
47 AC_SUBST(PACKAGE_MICRO_VERSION)
48
49 dnl Define library soname
50 CHEROKEE_AGE=0
51 CHEROKEE_CURRENT=0
52 CHEROKEE_REVISION=1
53 AC_SUBST(CHEROKEE_AGE)
54 AC_SUBST(CHEROKEE_CURRENT)
55 AC_SUBST(CHEROKEE_REVISION)
56
57 AC_DEFINE_UNQUOTED(CHEROKEE_CONFIG_ARGS, "$ac_configure_args", [configure arguments])
58
59 dnl Check the SVN revision
60 AC_ARG_ENABLE(beta, AC_HELP_STRING([--enable-beta], [Enable beta development]),
61                     is_beta="$enableval", is_beta="no")
62
63 if test x"$is_beta" = "xyes"; then
64   if test -d ".svn"; then
65      svn_rev="`svn info -R | grep Revision | sort | tail -1 | sed 's/Revision: //'`";
66   else
67     if test -d ".git"; then
68           svn_rev="`git svn info | grep 'Last Changed Rev' | sed 's/Last Changed Rev: //'`";
69     fi
70   fi
71
72   PACKAGE_PATCH_VERSION="b$svn_rev"
73
74   dnl Redefine versions
75   PACKAGE_VERSION="$PACKAGE_MAJOR_VERSION.$PACKAGE_MINOR_VERSION.$PACKAGE_MICRO_VERSION$PACKAGE_PATCH_VERSION"
76   AC_DEFINE_UNQUOTED(PACKAGE_VERSION, "${PACKAGE_VERSION}", [Package version])
77
78   VERSION="$PACKAGE_MAJOR_VERSION.$PACKAGE_MINOR_VERSION.$PACKAGE_MICRO_VERSION$PACKAGE_PATCH_VERSION"
79   AC_DEFINE(VERSION, $VERSION, [Software version])
80 else
81
82   PACKAGE_PATCH_VERSION=""
83 fi
84
85 dnl Path version
86 AC_SUBST(PACKAGE_PATCH_VERSION)
87 AC_DEFINE_UNQUOTED(PACKAGE_PATCH_VERSION, "${PACKAGE_PATCH_VERSION}", [Version string])
88
89 dnl Initial CFLAGS
90 AC_MSG_CHECKING(initial CFLAGS)
91 AC_MSG_RESULT($CFLAGS)
92
93 dnl Check for CPU / vendor / OS
94 AC_CANONICAL_HOST
95
96 os_string="UNIX"
97 so_suffix=so
98 mod_suffix=$so_suffix
99
100 AC_MSG_CHECKING([host platform characteristics])
101         case "$host" in
102         *-*-mingw*|*-*-cygwin*)
103                 so_suffix=DLL
104                 mod_suffix=$so_suffix
105              os_string="Win32"
106           libdl=
107           ;;
108         *-*-linux*)
109           libdl="-ldl"
110           ;;
111         *-*-solaris*)
112              AC_DEFINE(SOLARIS, 1, [It is Solaris])
113                 setenv_is_threadsafe="yes"
114           libdl="-ldl"
115           ;;
116         *-*-hpux*)
117           libdl="-ldl"
118           ;;
119         *-*-aix*)
120           libdl="-ldl"
121              ;;
122      *-*-irix6*)
123           AC_DEFINE(IRIX, 1, [It is SGI Irix])
124           setenv_is_threadsafe="yes"
125           libdl="-ldl"
126           ;;
127         *-*-*freebsd*|*-*-*openbsd*|*-*-*netbsd*|*-*-*dragonfly*)
128           libdl=
129           ;;
130         *-*-darwin*)
131                 so_suffix=dylib
132                 mod_suffix=so
133           libdl="-ldl"
134           ;;
135         *)
136                 AC_MSG_WARN([*** Please add $host to configure.in checks!])
137           libdl="-ldl"
138           ;;
139 esac
140 AC_MSG_RESULT(ok)
141
142 AC_MSG_CHECKING([L2 cache line size])
143 case "$host_cpu" in
144         i386|i486)
145                 CPU_CACHE_LINE=32
146         ;;
147         i586|i686)
148                 CPU_CACHE_LINE=64
149         ;;
150         i786)
151                 CPU_CACHE_LINE=128
152         ;;
153         athlon)
154                 CPU_CACHE_LINE=64
155         ;;
156         x86_64)
157                 CPU_CACHE_LINE=64
158         ;;
159         sparc*)
160                 CPU_CACHE_LINE=64
161         ;;
162         powerpc)
163                 CPU_CACHE_LINE=128
164         ;;
165         *)
166                 CPU_CACHE_LINE=128
167         ;;
168 esac
169 AC_DEFINE_UNQUOTED(CPU_CACHE_LINE, $CPU_CACHE_LINE, [L2 cache line size])
170 AC_MSG_RESULT($CPU_CACHE_LINE)
171
172 dnl
173 dnl OS string
174 dnl
175 AC_ARG_ENABLE(os_string, AC_HELP_STRING([--enable-os-string=STR], [Set a customized OS type string]), [os_string="$enableval"])
176 AC_DEFINE_UNQUOTED(OS_TYPE, "${os_string}", [OS type])
177
178 AM_CONDITIONAL(PLATFORM_WIN32, test x"$os_string" = "xWin32")
179
180 dnl
181 dnl Tracing
182 dnl
183 AC_ARG_ENABLE(trace, AC_HELP_STRING([--enable-trace], [Enable trace facility]),
184    [enable_trace="$enableval"
185     AC_DEFINE(TRACE_ENABLED, 1, [Trace facility])
186    ], [enable_trace="no"])
187
188 dnl
189 dnl Backtraces
190 dnl
191 AC_ARG_ENABLE(backtraces, AC_HELP_STRING([--enable-backtraces], [Enable backtraces on error]),
192    [enable_backtraces="$enableval"
193     AC_DEFINE(BACKTRACES_ENABLED, 1, [Backtracing facility])
194    ], [enable_backtraces="no"])
195
196 dnl
197 dnl Dynamic library loading library
198 dnl
199 LIBS="$LIBS $libdl"
200 AC_DEFINE_UNQUOTED(SO_SUFFIX, "${so_suffix}", [Dynamic loading libraries extension])
201 AC_DEFINE_UNQUOTED(MOD_SUFFIX, "${mod_suffix}", [Dynamic modules extension])
202
203 dnl
204 dnl Libtool options
205 dnl
206 if test "$os_string" != "Win32"; then
207     # libtool option to control which symbols are exported
208     # right now, symbols starting with _ are not exported
209     LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"'
210 else
211     LIBTOOL_EXPORT_OPTIONS=
212 fi
213 AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
214
215 dnl Set the Version
216 AM_INIT_AUTOMAKE(cherokee, $VERSION)
217 AM_MAINTAINER_MODE
218
219 AM_CONFIG_HEADER(config.h)
220 AC_SUBST(VERSION)
221
222 dnl Initialize Libtool
223 m4_ifdef([LT_INIT],
224   [LT_INIT([dlopen shared static win32-dll])],
225   [AC_LIBTOOL_DLOPEN
226    AC_LIBTOOL_WIN32_DLL
227    ])
228
229 dnl Paths
230 AC_PROG_CC
231 AC_PROG_CC_STDC
232 AC_PROG_INSTALL
233 AC_PROG_MAKE_SET
234 AM_PROG_LIBTOOL
235
236 AC_PATH_PROG(cherokeepath, cherokee)
237
238 AC_FUNC_CLOSEDIR_VOID
239 AC_FUNC_MALLOC
240 AC_FUNC_REALLOC
241 AC_FUNC_VPRINTF
242
243 AC_C_CONST
244 AC_C_BIGENDIAN
245 AC_C_INLINE
246 if test "$ac_cv_c_inline" != no; then
247   AC_DEFINE(HAVE_INLINE, 1, [Compile supports inline])
248 fi
249
250 dnl
251 dnl Check for headers
252 dnl
253 AC_HEADER_STDC
254 AC_HEADER_DIRENT
255 AC_HEADER_TIME
256 AC_HEADER_SYS_WAIT
257
258 AC_CHECK_HEADERS(endian.h machine/endian.h sys/machine.h sys/endian.h sys/isa_defs.h sys/utsname.h sys/poll.h poll.h )
259 AC_CHECK_HEADERS(sys/socket.h sys/un.h netinet/in.h arpa/inet.h netinet/tcp.h sys/ioctl.h fcntl.h sys/ofcntl.h sys/time.h)
260 AC_CHECK_HEADERS(sys/resource.h resource.h unistd.h syslog.h stdint.h inttypes.h error.h pwd.h sys/uio.h)
261 AC_CHECK_HEADERS(pthread.h netdb.h stdarg.h sys/filio.h sys/varargs.h sys/select.h sys/mman.h sys/uio.h grp.h winsock.h)
262 AC_CHECK_HEADERS(winsock.h winsock2.h sched.h execinfo.h)
263
264 AC_SYS_LARGEFILE
265
266 AC_SIZE_T
267 AC_TYPE_UID_T
268 AC_TYPE_MODE_T
269 AC_TYPE_OFF_T
270 AC_TYPE_SIZE_T
271 AC_TYPE_PID_T
272 AC_STRUCT_ST_RDEV
273 AC_CHECK_TYPE(ino_t, unsigned)
274 AC_CHECK_TYPE(loff_t, off_t)
275 AC_CHECK_TYPE(offset_t, loff_t)
276 AC_CHECK_TYPE(ssize_t, int)
277 AC_CHECK_TYPE(wchar_t, unsigned short)
278
279 AC_CHECK_SIZEOF(int)
280 AC_CHECK_SIZEOF(unsigned int)
281 AC_CHECK_SIZEOF(unsigned long)
282 AC_CHECK_SIZEOF(unsigned long long)
283 AC_CHECK_SIZEOF(unsigned int)
284 AC_CHECK_SIZEOF(off_t)
285 AC_CHECK_SIZEOF(size_t)
286 AC_CHECK_SIZEOF(sig_atomic_t)
287
288 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
289 AC_TRY_RUN([#include <stdio.h>
290 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
291 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
292 if test x"$samba_cv_have_longlong" = x"yes"; then
293     AC_DEFINE(HAVE_LONGLONG,1,[Whether the host supports long long'])
294 fi
295
296 AC_FUNC_MEMCMP
297 AC_FUNC_MMAP
298 AC_FUNC_FORK
299
300 AC_CHECK_FUNCS(gmtime gmtime_r localtime localtime_r getrlimit getdtablesize readdir readdir_r flockfile funlockfile strnstr backtrace)
301
302 FW_CHECK_PWD
303 FW_CHECK_GRP
304
305 AC_CHECK_MEMBER(struct tm.tm_gmtoff,
306                 AC_DEFINE([HAVE_STRUCT_TM_GMTOFF],[1],[gmtoff in struct tm]),,[#include <time.h>])
307
308 AH_BOTTOM([
309 /* Give us an unsigned 32-bit data type. */
310 #if SIZEOF_UNSIGNED_LONG==4
311 #define UWORD32 unsigned long
312 #elif SIZEOF_UNSIGNED_INT==4
313 #define UWORD32 unsigned int
314 #else
315 #error I do not know what to use for a UWORD32.
316 #endif
317 ])
318
319
320 dnl Find socket()
321 dnl Likely combinations:
322 dnl             -lsocket [ -lnsl_s | -lnsl ]
323 dnl             -linet
324 AC_CHECK_LIB(ws2_32, main)
325 AC_CHECK_LIB(advapi32, main)
326
327 AC_CHECK_FUNC(socket, :, [
328         AC_CHECK_LIB(socket, main)
329         AC_CHECK_LIB(net, main)
330         AC_CHECK_LIB(nsl_s, main)
331         AC_CHECK_LIB(nsl, main)
332         AC_CHECK_LIB(inet, socket)
333         AC_CHECK_LIB(gen, main)
334 ])
335
336 AC_SEARCH_LIBS(accept, socket)
337 AC_SEARCH_LIBS(bind, socket)
338 AC_SEARCH_LIBS(listen, socket)
339 AC_SEARCH_LIBS(setsockopt, socket)
340
341 dnl
342 dnl Check for fd events inspect functions
343 dnl
344 AC_CHECK_FUNC(poll, have_poll=yes)
345 AC_CHECK_FUNC(kqueue, have_kqueue=yes)
346 AC_CHECK_FUNC(select, have_select=yes)
347
348 if test "x-$have_select" != "x-yes" -a "x-$ac_cv_header_winsock2_h" = "x-yes"; then
349      AC_MSG_CHECKING([for select in ws2_32])
350      AC_TRY_LINK([#include <winsock2.h>],
351                                 [select(0,0,0,0,0)],
352                                 [AC_MSG_RESULT(yes)
353                                  have_win32_select=yes],
354                                 [AC_MSG_RESULT(no)])
355 fi
356
357 dnl
358 dnl Epoll
359 dnl
360 AC_CHECK_HEADER(sys/epoll.h, have_epoll_include=yes, have_epoll_include=no)
361
362 AC_ARG_ENABLE(epoll, AC_HELP_STRING([--disable-epoll],[Disable epoll() support]),
363                     wants_epoll="$enableval", wants_epoll="yes")
364
365 have_epoll=no
366 if test "x$have_epoll_include" = "xyes" && test "x$wants_epoll" = "xyes"; then
367         AC_MSG_CHECKING(for epoll system call)
368
369      AC_RUN_IFELSE([
370                 #include <stdint.h>
371                 #include <sys/param.h>
372                 #include <sys/types.h>
373                 #include <sys/syscall.h>
374                 #include <sys/epoll.h>
375                 #include <unistd.h>
376
377                 int epoll_create (int size) {
378                 return (syscall(__NR_epoll_create, size));
379                 }
380
381                 int main (int argc, char **argv) {
382                 int epfd;
383                 epfd = epoll_create(256);
384                    exit (epfd == -1 ? 1 : 0);
385                 }
386         ],
387         have_epoll=yes,
388         have_epoll=no,
389         have_epoll=yes)
390         AC_MSG_RESULT($have_epoll)
391 fi
392
393 dnl
394 dnl Solaris 10: Event ports
395 dnl
396 AC_CHECK_HEADER(port.h, have_port_include=yes, have_port_include=no)
397
398 have_port=no
399 if test "x$have_port_include" = "xyes"; then
400         AC_MSG_CHECKING(for event ports support)
401
402      AC_RUN_IFELSE([
403                 #include <stdint.h>
404                 #include <unistd.h>
405                 #include <port.h>
406
407                 int main (int argc, char **argv) {
408                 int port;
409                    port = port_create();
410                    exit (port < 0 ? 1 : 0);
411                 }
412         ],
413         have_port=yes,
414         have_port=no,
415         have_port=cross)
416         AC_MSG_RESULT($have_port)
417 fi
418
419
420
421 if test "$have_epoll" = yes; then
422         AC_DEFINE(HAVE_EPOLL, 1, [Have epoll])
423 fi
424 AM_CONDITIONAL(COMPILE_EPOLL, test x"$have_epoll" = "xyes")
425
426 if test "$have_kqueue" = yes; then
427         AC_DEFINE(HAVE_KQUEUE, 1, [Have kqueue])
428 fi
429 AM_CONDITIONAL(COMPILE_KQUEUE, test x"$have_kqueue" = "xyes")
430
431 if test "$have_port" = yes; then
432         AC_DEFINE(HAVE_PORT, 1, [Have event ports])
433 fi
434 AM_CONDITIONAL(COMPILE_PORT, test x"$have_port" = "xyes")
435
436 if test "$have_poll" = yes; then
437         AC_DEFINE(HAVE_POLL, 1, [Have poll])
438 fi
439 AM_CONDITIONAL(COMPILE_POLL, test x"$have_poll" = "xyes")
440
441 if test "$have_win32_select" = yes; then
442         AC_DEFINE(HAVE_WIN32_SELECT, 1, [Have Win32 select])
443 fi
444 AM_CONDITIONAL(COMPILE_WIN32_SELECT, test x"$have_win32_select" = "xyes")
445
446 if test "$have_select" = yes; then
447      AC_DEFINE(HAVE_SELECT, 1, [Have select])
448 fi
449 AM_CONDITIONAL(COMPILE_SELECT, test x"$have_select" = "xyes" -a x"$have_win32_select" != "xyes")
450
451
452 dnl
453 dnl Check for inet_pton.  We have our own, but on Solaris the version in
454 dnl libresolv is more lenient in ways that Solaris's internal DNS resolution
455 dnl code requires, so if we use our own *and* link with libresolv (which may
456 dnl be forced by Perl) DNS resolution fails.
457 dnl
458 AC_SEARCH_LIBS(inet_pton, [socket nsl resolv])
459 AC_CHECK_FUNCS(inet_pton inet_ntop inet_addr)
460
461 AC_SEARCH_LIBS(gethostbyname, [socket nsl resolv])
462 AC_CHECK_FUNCS(gethostbyname gethostbyname_r)
463
464 AC_CHECK_HEADER(sys/utsname.h)
465 AC_CHECK_FUNCS(gethostname uname)
466
467 dnl
468 dnl Check for inet_addr
469 dnl
470 AC_SEARCH_LIBS(inet_addr, xnet)
471 AC_CHECK_FUNCS(inet_addr)
472
473 dnl
474 dnl TCP_CORK
475 dnl
476 HYDRA_TCP_CORK
477 HYDRA_TCP_NOPUSH
478
479 dnl
480 dnl Check for GNU getopt_long()
481 dnl
482 AC_CHECK_HEADERS(getopt.h)
483 AC_CHECK_FUNC(getopt_long, have_getopt_long="yes")
484 AM_CONDITIONAL(HAVE_GETOPT_LONG, test "x$have_getopt_long" = "xyes")
485
486
487 dnl
488 dnl Pthread
489 dnl
490 with_pthread="yes"
491 have_pthread="no"
492 AC_ARG_ENABLE(pthread, AC_HELP_STRING([--disable-pthread],[Disable threading support]),
493                     with_pthread="$enableval", with_pthread="yes")
494
495 AM_CONDITIONAL(USE_PTHREAD, test "x$with_pthread" = "xyes")
496 if test "x$with_pthread" = "xyes"
497 then
498         dnl
499      dnl Basic checkings (c&p'ed from squid)
500         dnl
501         AC_MSG_CHECKING([for special a pthread case])
502
503         oldcflags="$CFLAGS"
504      CFLAGS="$CFLAGS -D_REENTRANT"
505         PTHREAD_CFLAGS="-D_REENTRANT"
506
507         case "$host" in
508            i386-unknown-freebsd*)
509            if test "$GCC" = "yes" ; then
510               if test -z "$PRESET_LDFLAGS"; then
511                 PTHREAD_LIBS="-pthread"
512                          have_pthread="yes"
513               fi
514            fi
515                  AC_MSG_RESULT([-pthread])
516            ;;
517        *-solaris2.*)
518            if test "$GCC" = "yes" ; then
519               CFLAGS="$CFLAGS -pthreads"
520               PTHREAD_CFLAGS="-pthreads"
521                     AC_MSG_RESULT([-pthreads])
522            else
523               CFLAGS="$CFLAGS -mt"
524               PTHREAD_CFLAGS="-mt"
525                     AC_MSG_RESULT([-mt])
526            fi
527               have_pthread="yes"
528            ;;
529           *)
530                  AC_MSG_RESULT([no])
531                  ;;
532      esac
533
534         if test "$have_pthread" != "yes"; then
535         AC_CHECK_LIB(pthread, main, have_pthread=yes, have_pthread=no)
536            if test "$have_pthread" = "yes"; then
537                  PTHREAD_LIBS="-lpthread"
538            fi
539      fi
540
541         dnl
542         dnl More detailed checks on the pthread support
543         dnl
544         AC_MSG_CHECKING([for pthread_rwlock_t support])
545
546         have_pthread_rwlock_t=yes
547         AC_TRY_COMPILE([#include <pthread.h>],
548                         [pthread_rwlock_t rwlock; pthread_rwlock_init( &rwlock, NULL);],
549                         compiled=yes, compiled=no)
550
551         if test "$compiled" = "yes"; then
552                 AC_MSG_RESULT([ok])
553         else
554              dnl Didn't find rwlock_t.
555              dnl Try defining _XOPEN_SOURCE=500
556              dnl
557                 oldcflags2="$CFLAGS"
558                 CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500"
559
560                 AC_TRY_COMPILE([#include <pthread.h>],
561                             [pthread_rwlock_t rwlock; pthread_rwlock_init( &rwlock, NULL);],
562                             compiled=yes, compiled=no)
563
564                 if test "$compiled" = "yes"; then
565                     AC_MSG_RESULT([-D_XOPEN_SOURCE=500])
566                     PTHREAD_CFLAGS="-D_XOPEN_SOURCE=500"
567                 else
568                     have_pthread_rwlock_t=no
569                     AC_MSG_RESULT([no])
570                 fi
571
572                 CFLAGS="$oldcflags2"
573         fi
574
575         if test "$have_pthread_rwlock_t" = "yes"; then
576                 AC_DEFINE(HAVE_PTHREAD_RWLOCK_T, 1, [Define if your pthread library includes pthread_rwlock_t])
577         else
578                 AC_MSG_ERROR([pthread_rwlock_t support missing])
579         fi
580
581         AC_CHECK_FUNC(pthread_attr_setschedpolicy, have_pthread_attr_setschedpolicy=yes)
582         if test x"$have_pthread_attr_setschedpolicy" = "xyes"; then
583              AC_DEFINE(HAVE_PTHREAD_SETSCHEDPOLICY, 1, [Pthread support pthread_attr_setschedpolicy])
584         fi
585
586         save_LIBS="$LIBS"
587         LIBS="$LIBS $PTHREAD_LIBS"
588
589         AC_CHECK_FUNCS(pthread_mutexattr_settype pthread_mutexattr_setkind_np)
590
591         dnl
592         dnl Yield
593         dnl
594         AC_CHECK_FUNCS(sched_yield, , [
595            AC_CHECK_LIB(rt, sched_yield, [
596                AC_DEFINE(HAVE_SCHED_YIELD)
597                   PTHREAD_LIBS="$PTHREAD_LIBS -lrt"
598            ],[
599                AC_CHECK_LIB(posix4, sched_yield, [
600                   AC_DEFINE(HAVE_SCHED_YIELD)
601           PTHREAD_LIBS="$PTHREAD_LIBS -lposix4"
602            ])])
603      ])
604
605         LIBS="$save_LIBS"
606         CFLAGS="$oldcflags"
607 fi
608
609 if test "$have_pthread" = "yes"; then
610         AC_DEFINE(HAVE_PTHREAD, 1, [Have pthread support])
611         AC_SUBST(PTHREAD_CFLAGS)
612         AC_SUBST(PTHREAD_LIBS)
613 fi
614
615
616 dnl
617 dnl Is setenv() threadsafe?
618 dnl
619 if test "$setenv_is_threadsafe" = "yes"; then
620 AC_DEFINE(SETENV_IS_THREADSAFE, 1, [setenv function is thread safe])
621 fi
622
623 dnl
624 dnl Check for vsyslog
625 dnl
626 AC_CHECK_FUNCS(syslog vsyslog strsep strcasestr memmove strerror bcopy strlcat)
627
628 dnl
629 dnl Check for Glib (usually Linux)
630 dnl
631 AC_PREPROC_IFELSE([
632 #include <features.h>
633 #ifndef __GLIBC__
634     chokeme
635 #endif
636 ], [
637     AC_DEFINE([HAVE_GLIBC], [1], [Define to 1 if you have glibc.])
638     AC_DEFINE([_GNU_SOURCE], [1], [Define to 1 if you have glibc.])
639 ])
640
641 dnl
642 dnl Does this platform require array notation to assign to a va_list?
643 dnl If cross-compiling, we assume va_list is "normal".  If this breaks
644 dnl you, set ac_cv_valistisarray=true and maybe define HAVE_VA_LIST_AS_ARRAY
645 dnl also just to be sure.
646 dnl
647 AC_MSG_CHECKING(whether va_list assignments need array notation)
648 AC_CACHE_VAL(ac_cv_valistisarray,
649         [AC_TRY_RUN([#include <stdlib.h>
650                      #include <stdarg.h>
651                      void foo(int i, ...) {
652                         va_list ap1, ap2;
653                         va_start(ap1, i);
654                         ap2 = ap1;
655                         if (va_arg(ap2, int) != 123 || va_arg(ap1, int) != 123) { exit(1); }
656                         va_end(ap1); va_end(ap2);
657                      }
658                      int main()
659                      { foo(0, 123); return(0); }],
660                     [ac_cv_valistisarray=false],
661                     [ac_cv_valistisarray=true],
662                     [ac_cv_valistisarray=false])])
663
664 if test "$ac_cv_valistisarray" = true ; then
665         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY,,[va_list works copying an array])
666         AC_MSG_RESULT(yes)
667 else
668         AC_MSG_RESULT(no)
669 fi
670
671
672 dnl
673 dnl Check if the global variable `timezone' exists. If so, define
674 dnl HAVE_INT_TIMEZONE.
675 dnl
676 AC_STRUCT_TIMEZONE
677
678 AC_MSG_CHECKING(for global timezone)
679 AC_TRY_LINK([#include <time.h>],
680 [int res; res = timezone / 60;],
681 [AC_MSG_RESULT(yes)
682 AC_DEFINE(HAVE_INT_TIMEZONE,, [Set to 1 if you have the global variable timezone])],
683 AC_MSG_RESULT(no))
684
685
686 dnl
687 dnl Check for RTDL constants (from Haskell code)
688 dnl
689 dnl ** check for libdl & RTLD_NEXT
690 dnl ** sometimes RTLD_NEXT is hidden in #ifdefs we really don't wan to set
691 AC_MSG_CHECKING(for RTLD_NEXT from dlfcn.h)
692 AC_EGREP_CPP(yes,
693 [
694  #include <dlfcn.h>
695  #ifdef RTLD_NEXT
696         yes
697  #endif
698 ], [
699   AC_MSG_RESULT(yes)
700   AC_DEFINE(HAVE_RTLDNEXT,,[Have RTDL_NEXT])
701   HaveRtldNext=YES
702 ], [
703   AC_MSG_RESULT(no)
704   HaveRtldNext=NO
705   ])
706 AC_SUBST(HaveRtldNext)
707
708 dnl ** RTLD_LOCAL isn't available on cygwin or openbsd
709 AC_MSG_CHECKING(for RTLD_LOCAL from dlfcn.h)
710 AC_EGREP_CPP(yes,
711 [
712  #include <dlfcn.h>
713  #ifdef RTLD_LOCAL
714         yes
715  #endif
716 ], [
717   AC_MSG_RESULT(yes)
718   AC_DEFINE(HAVE_RTLDLOCAL,,[Have RTDL_LOCAL])
719   HaveRtldLocal=YES
720 ], [
721   AC_MSG_RESULT(no)
722   HaveRtldLocal=NO
723   ])
724 AC_SUBST(HaveRtldLocal)
725
726 dnl ** RTLD_GLOBAL isn't available on openbsd
727 AC_MSG_CHECKING(for RTLD_GLOBAL from dlfcn.h)
728 AC_EGREP_CPP(yes,
729 [
730  #include <dlfcn.h>
731  #ifdef RTLD_GLOBAL
732         yes
733  #endif
734 ], [
735   AC_MSG_RESULT(yes)
736   AC_DEFINE(HAVE_RTLDGLOBAL,,[Have RTDL_GLOBAL])
737   HaveRtldGlobal=YES
738 ], [
739   AC_MSG_RESULT(no)
740   HaveRtldGlobal=NO
741   ])
742 AC_SUBST(HaveRtldGlobal)
743
744 dnl ** RTLD_NOW isn't available on openbsd
745 AC_MSG_CHECKING(for RTLD_NOW from dlfcn.h)
746 AC_EGREP_CPP(yes,
747 [
748  #include <dlfcn.h>
749  #ifdef RTLD_NOW
750         yes
751  #endif
752 ], [
753   AC_MSG_RESULT(yes)
754   AC_DEFINE(HAVE_RTLDNOW,,[Have RTDL_NOW])
755   HaveRtldNow=YES
756 ], [
757   AC_MSG_RESULT(no)
758   HaveRtldNow=NO
759   ])
760 AC_SUBST(HaveRtldNow)
761
762
763 dnl
764 dnl Check of off64_t
765 dnl
766 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
767 AC_TRY_RUN([
768 #if defined(HAVE_UNISTD_H)
769 #include <unistd.h>
770 #endif
771 #include <stdio.h>
772 #include <sys/stat.h>
773 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
774 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
775 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
776     AC_DEFINE(HAVE_OFF64_T,1,[Whether off64_t is available])
777 fi
778
779 dnl
780 dnl Shared Memory
781 dnl
782 AC_CHECK_FUNC(shm_open, have_shm_open=yes)
783
784 RT_LIBS=
785 if test "$have_shm_open" != "yes"; then
786   AC_CHECK_LIB(rt, shm_open, [
787                             RT_LIBS="-lrt"
788                             have_shm_open=yes])
789 fi
790 if test "$have_shm_open" != "yes"; then
791   AC_CHECK_LIB(rt, shm_open, [
792                             RT_LIBS="-lposix4"
793                             have_shm_open=yes])
794 fi
795 AC_SUBST(RT_LIBS)
796
797 if test "$have_shm_open" = "yes"; then
798    AC_DEFINE(HAVE_POSIX_SHM, 1, [Define to 1 to use POSIX shared memory])
799 fi
800 AM_CONDITIONAL(USE_POSIX_SHM, test "$have_shm_open" = "yes")
801
802
803 dnl
804 dnl SYSV Semaphores
805 dnl
806 AC_CHECK_HEADER(sys/sem.h, sysv_sem=yes, sysv_sem=no)
807
808 if test "x$sysv_sem" = "xyes"; then
809    AC_CHECK_FUNC(semget, , sysv_sem=no)
810    AC_CHECK_FUNC(semop, , sysv_sem=no)
811    AC_CHECK_FUNC(semctl, , sysv_sem=no)
812 fi
813
814 if test "x$sysv_sem" = xyes; then
815    AC_DEFINE(HAVE_SYSV_SEMAPHORES, 1, [Define to 1 to use SYSV semaphores])
816 fi
817 AM_CONDITIONAL(USE_SYSV_SEMAPHORES, test "x$sysv_sem" = xyes)
818
819 dnl union semun
820 dnl
821 AC_MSG_CHECKING([for union semun])
822 AC_CACHE_VAL(ac_cv_struct_semun, [
823    AC_TRY_COMPILE(
824         [
825            #include <sys/types.h>
826            #include <sys/ipc.h>
827            #include <sys/sem.h>;
828      ],[
829            union semun semdat;
830         ],
831            ac_cv_struct_semun=yes,
832            ac_cv_struct_semun=no
833      )
834 ])
835 AC_MSG_RESULT($ac_cv_struct_semun)
836 if test "$ac_cv_struct_semun" = "yes"; then
837         AC_DEFINE(HAVE_SEMUN, 1, [Define if sys/sem.h defines struct semun])
838 fi
839
840
841 # From etr_socket_nsl.m4
842 ETR_SOCKET_NSL
843
844 # From sendfile_samba.m4
845 SENDFILE_CHECK
846
847 # readdir_r()
848 LIBWWW_READDIR_R_TYPE
849
850
851 dnl
852 dnl IPv6 Support
853 dnl I got this mostly from Apache's tests
854 dnl
855
856 AC_ARG_ENABLE(ipv6,
857   AC_HELP_STRING([--disable-ipv6], [Disable IPv6 support]),
858   [ if test "$enableval" = "no"; then
859        disabled_ipv6=1
860     fi ],
861   [ disabled_ipv6=0 ] )
862
863 AC_SEARCH_LIBS(getaddrinfo, socket inet6)
864 AC_SEARCH_LIBS(getnameinfo, socket inet6)
865 AC_SEARCH_LIBS(gai_strerror, socket inet6)
866 AC_CHECK_FUNC(gai_strerror)
867
868 APR_CHECK_WORKING_GETADDRINFO
869 APR_CHECK_WORKING_GETNAMEINFO
870
871 AC_ACME_SOCKADDR_UN
872 AC_ACME_SOCKADDR_IN6
873 AC_ACME_SOCKADDR_STORAGE
874
875 AC_MSG_CHECKING(if the system supports IPv6)
876 have_ipv6="no"
877
878 if test "$disabled_ipv6" = 1; then
879     AC_MSG_RESULT([no -- disabled by user])
880 else
881     if test "x$ac_cv_acme_sockaddr_in6" = "xyes"; then
882         if test "x$ac_cv_working_getaddrinfo" = "xyes"; then
883             if test "x$ac_cv_working_getnameinfo" = "xyes"; then
884                 have_ipv6="yes"
885                 AC_MSG_RESULT([yes])
886                       AC_DEFINE(HAVE_IPV6, 1, [Define if you have IPv6 support.])
887             else
888                 AC_MSG_RESULT([no -- no getnameinfo])
889             fi
890         else
891             AC_MSG_RESULT([no -- no working getaddrinfo])
892         fi
893     else
894         AC_MSG_RESULT([no -- no sockaddr_in6])
895     fi
896 fi
897
898 dnl
899 dnl Test whether SO_RCVTIMEO is broken
900 dnl
901 AC_CACHE_CHECK([whether setsockopt(SO_RCVTIMEO) is broken],
902   ac_cv_so_rcvtimeo_broken, [dnl
903     AC_RUN_IFELSE([AC_LANG_SOURCE([[
904 #if defined(HAVE_SYS_TYPES_H)
905 #include <sys/types.h>
906 #endif
907
908 #if defined(HAVE_SYS_SOCKET_H)
909 #include <sys/socket.h>
910 #endif
911
912 #if defined(HAVE_SYS_TIME_H)
913 #include <sys/time.h>
914 #endif
915
916 int main(void) {
917         int fd;
918         int ret;
919         struct timeval new_tv;
920
921         /* Open the socket (INET/TCP).*/
922         fd = socket(AF_INET, SOCK_STREAM, 0);
923
924         /* set the timeout for the incoming queue */
925         /* 1 second for example */
926         new_tv.tv_sec = 1;
927         new_tv.tv_usec = 0;
928
929         ret = setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &new_tv, sizeof(new_tv));
930         return ret;
931 }
932 ]])],[ac_cv_so_rcvtimeo_broken=no],[ac_cv_so_rcvtimeo_broken=yes],[ac_cv_so_rcvtimeo_broken=cross])])
933 if test x"$ac_cv_so_rcvtimeo_broken" = x"yes"; then
934   AC_DEFINE(HAVE_BROKEN_SO_RCVTIMEO, 1, [Define if setsockopt(SO_RCVTIMEO) is broken])
935 fi
936
937
938 dnl
939 dnl Look for socklen_t
940 dnl
941 AC_MSG_CHECKING([for socklen_t])
942 AC_TRY_COMPILE(
943  [#include <sys/types.h>
944   #include <sys/socket.h>],
945  [socklen_t len = 42; return 0;],
946  ac_cv_type_socklen_t=yes,
947  ac_cv_type_socklen_t=no
948 )
949
950 if test $ac_cv_type_socklen_t != yes; then
951   AC_DEFINE(socklen_t, int, [Substitute for socklen_t])
952   AC_MSG_RESULT(int)
953 else
954   AC_MSG_RESULT(yes)
955 fi
956
957 dnl
958 dnl Check of __func__ and co..
959 dnl
960 AC_MSG_CHECKING([whether our compiler supports __func__])
961 AC_TRY_COMPILE([],
962  [const char *cp = __func__;],
963  AC_MSG_RESULT([yes]),
964  AC_MSG_RESULT([no])
965  AC_MSG_CHECKING([whether our compiler supports __FUNCTION__])
966  AC_TRY_COMPILE([],
967    [const char *cp = __FUNCTION__;],
968    AC_MSG_RESULT([yes])
969    AC_DEFINE(__func__, __FUNCTION__,
970          [Define to appropriate substitue if compiler doesnt have __func__]),
971    AC_MSG_RESULT([no])
972    AC_DEFINE(__func__, __FILE__,
973          [Define to appropriate substitue if compiler doesnt have __func__])))
974
975 dnl
976 dnl Check for pcre library
977 dnl
978 have_pcre="built-in"
979
980 AC_ARG_ENABLE(internal_pcre,
981                     AC_HELP_STRING([--enable-internal-pcre],[Enable internal PCRE]),
982                     use_internal_pcre="$enableval", use_internal_pcre="no")
983
984 if test "x$use_internal_pcre" != "xyes"; then
985   AC_CHECK_LIB(pcre, pcre_compile, have_pcre_lib=yes, have_pcre_lib=no)
986   AC_CHECK_HEADER(pcre.h, have_pcre_include=yes, have_pcre_include=no)
987   if test "$have_pcre_lib $have_pcre_include" = "yes yes"; then
988      have_pcre="yes"
989   fi
990 fi
991
992 AM_CONDITIONAL(USE_INTERNAL_PCRE, test "x$have_pcre" = "xbuilt-in")
993
994 dnl
995 dnl PAM
996 dnl
997 AC_ARG_ENABLE(pam, AC_HELP_STRING([--disable-pam],[Disable PAM support]), use_pam="$enableval", use_pam="yes")
998 if test "x$use_pam" = "xyes"; then
999      AC_CHECK_LIB(pam, pam_start, have_pam_lib=yes, have_pam_lib=no)
1000      AC_CHECK_LIB(pam, _pam_dispatch, have_pam_dispatch=yes, have_pam_dispatch=no)
1001      AC_CHECK_HEADER(security/pam_modules.h, have_pam_include=yes, have_pam_include=no, [[
1002 #ifdef HAVE_SECURITY_PAM_MODULES_H
1003 # include <security/pam_modules.h>
1004 #endif
1005         ]])
1006      AC_CHECK_HEADERS(security/_pam_macros.h security/pam_appl.h)
1007 fi
1008
1009 if test "$use_pam $have_pam_lib $have_pam_include" = "yes yes yes"; then
1010    have_pam="yes"
1011 else
1012    have_pam="no"
1013 fi
1014 AM_CONDITIONAL(HAVE_PAM, test "x$have_pam" = "xyes")
1015
1016 if test "$have_pam_dispatch" = "yes"; then
1017         AC_DEFINE(HAVE_PAM_DISPATCH, 1, [Have _pam_dispatch function])
1018 fi
1019
1020 dnl
1021 dnl crypt()
1022 dnl
1023 AC_CHECK_HEADERS(crypt.h)
1024
1025 AC_CHECK_FUNC(crypt, system_crypt="yes", system_crypt="no")
1026 AC_CHECK_LIB(crypt, crypt, have_crypt_lib="yes", have_crypt_lib="no")
1027 if test "x$have_crypt_lib" = "xyes"; then
1028         CRYPT_LIBS="-lcrypt"
1029         AC_SUBST(CRYPT_LIBS)
1030 fi
1031
1032 use_crypt="no"
1033 if test "$system_crypt $have_crypt_lib" != "no no"; then
1034    use_crypt="yes"
1035    AC_DEFINE(HAVE_CRYPT, 1, [Have crypt function])
1036 fi
1037
1038 dnl
1039 dnl crypt_r()
1040 dnl
1041 AC_CHECK_FUNC(crypt_r, system_crypt_r="yes", system_crypt_r="no")
1042 AC_CHECK_LIB(crypt, crypt_r, have_crypt_r_lib="yes", have_crypt_r_lib="no")
1043
1044 use_crypt_r="no"
1045 if test "$system_crypt_r $have_crypt_r_lib" != "no no"; then
1046    use_crypt_r="yes"
1047    AC_DEFINE(HAVE_CRYPT_R, 1, [Have crypt_r function])
1048 fi
1049
1050 dnl
1051 dnl crypt_r and pthread
1052 dnl
1053 if test "$use_crypt_r" = "yes"; then
1054    dnl
1055    dnl crypt_r style
1056    dnl
1057    AC_MSG_CHECKING([crypt_r style])
1058    crypt_r_style=none
1059
1060    # pthread.h is needed on AIX
1061    AC_TRY_COMPILE([#include <pthread.h>
1062                    #include <crypt.h>],
1063                            [CRYPTD buffer;],
1064                            crypt_r_style=cryptd)
1065
1066    if test "$crypt_r_style" = "none"; then
1067       AC_TRY_COMPILE([#include <crypt.h>],
1068                                  [struct crypt_data buffer;],
1069                                  crypt_r_style=struct_crypt_data)
1070    fi
1071
1072    if test "$crypt_r_style" = "none"; then
1073       AC_TRY_COMPILE([#define _GNU_SOURCE
1074                                   #include <crypt.h>],
1075                                  [struct crypt_data buffer;],
1076                                  [crypt_r_style=struct_crypt_data
1077                                CRYPT_CFLAGS="-D_GNU_SOURCE"
1078                                   AC_SUBST(CRYPT_CFLAGS)])
1079    fi
1080
1081    AC_MSG_RESULT([$crypt_r_style])
1082
1083    if test "$crypt_r_style" = "cryptd"; then
1084      AC_DEFINE(CRYPT_R_CRYPTD, 1, [Define if crypt_r has uses CRYPTD])
1085    fi
1086
1087    if test "$crypt_r_style" = "struct_crypt_data"; then
1088      AC_DEFINE(CRYPT_R_STRUCT_CRYPT_DATA, 1, [Define if crypt_r uses struct crypt_data])
1089    fi
1090
1091    if test "$crypt_r_style" = "none"; then
1092      AC_MSG_ERROR([Unable to detect data struct is used by crypt_r])
1093    fi
1094 fi
1095
1096 AM_CONDITIONAL(USE_CRYPT, test "x$use_crypt x$use_crypt_r" != "xno xno")
1097
1098
1099 dnl
1100 dnl OpenSSL
1101 dnl
1102 AC_ARG_WITH(libssl,
1103     AC_HELP_STRING([--with-libssl@<:@=DIR@:>@],[Include libssl/OpenSSL support (default yes)]),
1104     [WITH_OPENSSL=$withval],[WITH_OPENSSL=yes])
1105
1106 have_openssl=no
1107
1108 if test "$WITH_OPENSSL" != "no"; then
1109     if test "$WITH_OPENSSL" != "yes"; then
1110         LIBSSL_CFLAGS="-I$WITH_OPENSSL/include"
1111         LIBSSL_LIBS="-L$WITH_OPENSSL/lib"
1112     fi
1113
1114     AC_CHECK_LIB(crypto, BN_init)
1115     AC_CHECK_HEADERS([openssl/engine.h])
1116     AC_CHECK_LIB(ssl, SSL_accept, [have_openssl=yes], [have_openssl=no], $LIBSSL_LIBS)
1117
1118     if test "$have_openssl" = "yes"; then
1119         LIBSSL_LIBS="$LIBSSL_LIBS -lssl"
1120
1121            AC_SUBST(LIBSSL_LIBS)
1122            AC_SUBST(LIBSSL_CFLAGS)
1123
1124            AC_DEFINE(HAVE_OPENSSL, 1, [Have OpenSSL library])
1125     fi
1126 fi
1127 AC_MSG_CHECKING(for libssl)
1128 AC_MSG_RESULT([$have_openssl])
1129
1130 AM_CONDITIONAL(USE_OPENSSL, test "x$have_openssl" = "xyes")
1131
1132
1133 dnl
1134 dnl Native Language Support
1135 dnl
1136 AM_PO_SUBDIRS
1137
1138 if test "x$USE_NLS" = "xyes"; then
1139    AC_CHECK_PROG(HAVE_MSGFMT, msgfmt,yes,no)
1140
1141    if test "x$HAVE_MSGFMT" = "xno"; then
1142       AC_MSG_ERROR([msgfmt not found. You need to install the 'gettext' package, or pass --enable-nls=no to configure.])
1143    fi
1144 fi
1145
1146 AM_CONDITIONAL(NLS_ENABLED, test "x$USE_NLS" = "xyes")
1147 AC_CONFIG_FILES([po/admin/Makefile.in])
1148
1149 dnl
1150 dnl LDAP
1151 dnl
1152 AC_ARG_WITH([ldap],
1153         AC_HELP_STRING([--with-ldap=@<:@ARG@:>@],
1154             [use OpenLDAP development library @<:@default=yes@:>@, optionally specify path to dev libs]
1155         ),
1156         [
1157         if test "$withval" = "no"; then
1158             want_ldap="no"
1159         elif test "$withval" = "yes"; then
1160             want_ldap="yes"
1161         else
1162             want_ldap="yes"
1163             LDAP_CONFIG="$withval"
1164         fi
1165         ],
1166         [want_ldap="yes"]
1167 )
1168
1169 if test "$want_ldap" = "yes"; then
1170        AC_CHECK_LIB(ldap, ldap_init, have_ldap_lib=yes, have_ldap_lib=no)
1171        AC_CHECK_HEADER(ldap.h, have_ldap_include=yes, have_ldap_include=no)
1172
1173           AC_CHECK_LIB(ldap, ldap_start_tls_s, [
1174                 AC_DEFINE(LDAP_HAVE_START_TLS_S,, Define if you have ldap_start_tls_s)
1175           ])
1176
1177        if test "$have_ldap_lib $have_ldap_include" = "yes yes"; then
1178           have_ldap="yes"
1179        else
1180           have_ldap="no"
1181        fi
1182 else
1183        have_ldap="no"
1184 fi
1185
1186 AM_CONDITIONAL(HAVE_LDAP, test "x$have_ldap" = "xyes")
1187
1188
1189 dnl
1190 dnl Check for MySQL: Execution of a string containing multiple
1191 dnl statements was introduced in the MySQL release 5.0.0
1192 dnl
1193 AX_LIB_MYSQL(5.0.0)
1194
1195
1196 dnl
1197 dnl GeoIP library
1198 dnl
1199 AC_ARG_WITH([geoip],
1200         AC_HELP_STRING([--with-geoip=@<:@ARG@:>@],
1201             [use the GeoIP library @<:@default=yes@:>@, optionally specify path to dev libs]
1202         ),
1203         [
1204         if test "$withval" = "no"; then
1205             want_geoip="no"
1206         elif test "$withval" = "yes"; then
1207             want_geoip="yes"
1208         else
1209             want_geoip="yes"
1210             GEOIP_CONFIG="$withval"
1211         fi
1212         ],
1213         [want_geoip="yes"]
1214 )
1215
1216 if test "x$want_geoip" = "xyes"; then
1217    AC_CHECK_LIB(GeoIP, GeoIP_new, have_geoip_lib=yes, have_geoip_lib=no)
1218    AC_CHECK_HEADERS(GeoIP.h, have_geoip_include=yes, have_geoip_include=no)
1219 fi
1220
1221 have_geoip="no"
1222 if test "$have_geoip_lib $have_geoip_include" = "yes yes"; then
1223    have_geoip="yes"
1224 fi
1225
1226 AM_CONDITIONAL(HAVE_GEOIP, test "x$have_geoip" = "xyes")
1227
1228
1229 dnl
1230 dnl FFMpeg library
1231 dnl
1232 AC_ARG_WITH([ffmpeg],
1233         AC_HELP_STRING([--with-ffmpeg=@<:@ARG@:>@],
1234             [use the FFMpeg library @<:@default=yes@:>@, optionally specify path to dev libs]
1235         ),
1236         [
1237         if test "$withval" = "no"; then
1238             want_ffmpeg="no"
1239         elif test "$withval" = "yes"; then
1240             want_ffmpeg="yes"
1241         else
1242             want_ffmpeg="yes"
1243             FFMPEG_CONFIG="$withval"
1244         fi
1245         ],
1246         [want_ffmpeg="yes"]
1247 )
1248
1249 if test "x$want_ffmpeg" = "xyes"; then
1250    AC_CHECK_LIB([avformat], [main], [
1251          FFMPEG_LIBS="-lavformat -lavcodec -lavutil"
1252          have_ffmpeg_lib=yes
1253    ],[have_ffmpeg_lib=no])
1254
1255    AC_CHECK_LIB([bz2], [BZ2_bzdopen], [
1256          FFMPEG_LIBS="$FFMPEG_LIBS -lbz2"
1257    ])
1258
1259    AC_CHECK_LIB([m], [cos], [
1260          FFMPEG_LIBS="$FFMPEG_LIBS -lm"
1261    ])
1262
1263    AC_CHECK_HEADERS([libavformat/avformat.h], [
1264       have_ffmpeg_include=yes
1265    ],[have_ffmpeg_include=no])
1266 fi
1267
1268 have_ffmpeg="no"
1269 if test "$have_ffmpeg_lib $have_ffmpeg_include" = "yes yes"; then
1270    have_ffmpeg="yes"
1271    AC_SUBST(FFMPEG_LIBS)
1272    AC_SUBST(FFMPEG_CFLAGS)
1273    AC_DEFINE([USE_FFMPEG], 1, [Whether to use FFMpeg])
1274 fi
1275
1276 AM_CONDITIONAL(HAVE_FFMPEG, test "x$have_ffmpeg" = "xyes")
1277
1278
1279 dnl
1280 dnl WWW root directory, and user/group
1281 dnl
1282 AC_ARG_WITH(wwwroot, AC_HELP_STRING([--with-wwwroot=DIR], [Set the WWW root directory]),
1283                   WWW_ROOT="$withval", WWW_ROOT="$localstatedir/www")
1284 AC_SUBST(WWW_ROOT)
1285
1286 AC_ARG_WITH(wwwuser, AC_HELP_STRING([--with-wwwuser=USER], [Set default execution user]),
1287                   WWW_USER="$withval", WWW_USER="")
1288 AC_SUBST(WWW_USER)
1289
1290 AC_ARG_WITH(wwwgroup, AC_HELP_STRING([--with-wwwgroup=GROUP], [Set default execution group]),
1291                   WWW_GROUP="$withval", WWW_GROUP="")
1292 AC_SUBST(WWW_GROUP)
1293
1294
1295 dnl
1296 dnl Look for misc binaries
1297 dnl
1298 AC_PATH_PROG(PHPCGI, php-cgi)
1299 AC_ARG_VAR(PHPCGI, [path to PHP-cgi])
1300
1301 AC_MSG_CHECKING([$PHPCGI supports FastCGI])
1302 if test "x$PHPCGI" = "x"; then
1303    AC_MSG_RESULT([no])
1304 else
1305    $PHPCGI -v -d session.save_path=/tmp | grep 'cgi-fcgi' >/dev/null 2>/dev/null
1306    if test $? != 0; then
1307       PHPCGI=""
1308       AC_MSG_RESULT([no])
1309    else
1310       AC_MSG_RESULT([yes])
1311    fi
1312 fi
1313
1314 if test "x$PHPCGI" = "x"; then
1315    for n in php-cgi php; do
1316      for p in /usr/lib/cgi-bin /usr/bin /usr/local/bin; do
1317        phpcgi_path="$p/php-cgi"
1318           AC_MSG_CHECKING([for $phpcgi_path])
1319           if test -x "$phpcgi_path"; then
1320              $phpcgi_path -v | grep 'cgi-fcgi' >/dev/null 2>/dev/null
1321                 if test $? = 0; then
1322                   PHPCGI=$phpcgi_path
1323                AC_MSG_RESULT([yes])
1324                 else
1325                AC_MSG_RESULT([not fcgi])
1326                 fi
1327                 break
1328           else
1329              AC_MSG_RESULT([no])
1330           fi
1331      done
1332         if test "x$PHPCGI" != x; then
1333           break;
1334         fi
1335    done
1336 fi
1337
1338 if test "x$PHPCGI" = "x"; then
1339    PHPCGI="php-cgi"
1340 fi
1341
1342 AC_SUBST(PHPCGI)
1343
1344
1345 dnl
1346 dnl Cherokee admin
1347 dnl
1348 AC_ARG_ENABLE(admin,
1349            AC_HELP_STRING([--disable-admin],[Disable Cherokee-admin installation]),
1350            wants_admin="$enableval", wants_admin="yes")
1351 AM_CONDITIONAL(INSTALL_ADMIN, test "x$wants_admin" != "xno")
1352
1353 dnl
1354 dnl Clean files generated from *.pre
1355 dnl
1356 pres="constants.h cherokee.conf.sample performance.conf.sample http-cherokee.xml admin/configured.py contrib/cherokee"
1357 AC_MSG_NOTICE([Deleting .pre files])
1358 rm -f $pres
1359
1360 dnl
1361 dnl Options
1362 dnl
1363 use_static_module=""
1364 AC_ARG_ENABLE(static-module,
1365            AC_HELP_STRING([--enable-static-module=MODULE][]),
1366            [use_static_module="$use_static_module $enableval "],[])
1367
1368 modules="error_redir error_nn server_info file dirlist cgi fcgi scgi uwsgi proxy redir common ssi secdownload empty_gif admin custom_error dbslayer streaming gzip deflate ncsa combined custom pam ldap mysql htpasswd plain htdigest authlist round_robin ip_hash directory extensions request header exists fullpath method from bind geoip url_arg wildcard rehost target_ip evhost post_track post_report libssl render_rrd rrd not and or"
1369
1370 # Remove modules that will not be compiles
1371 #
1372 if test "x$have_pam" != "xyes"; then
1373         modules=`echo $modules | sed s/pam//`
1374 fi
1375 if test "x$have_ldap" != "xyes"; then
1376         modules=`echo $modules | sed s/ldap//`
1377 fi
1378 if test "x$have_mysql" != "xyes"; then
1379         modules=`echo $modules | sed s/mysql//`
1380         modules=`echo $modules | sed s/dbslayer//`
1381 fi
1382 if test "x$have_geoip" != "xyes"; then
1383         modules=`echo $modules | sed s/geoip//`
1384 fi
1385 if test "$use_crypt" != "yes"; then
1386         modules=`echo $modules | sed s/htpasswd//`
1387 fi
1388 if test "$have_openssl" != "yes"; then
1389         modules=`echo $modules | sed s/libssl//`
1390 fi
1391
1392 add_calls=""
1393 init_calls=""
1394 headers=""
1395 ext_defs=""
1396
1397 for mod in $modules; do
1398         AC_MSG_CHECKING([module "$mod"])
1399
1400         if echo $use_static_module | grep -w $mod >/dev/null || echo $use_static_module | grep all >/dev/null; then
1401                  ext_defs="$ext_defs \n extern cherokee_plugin_info_t cherokee_${mod}_info;"
1402
1403                  headers="$headers \n void PLUGIN_INIT_NAME($mod) (cherokee_plugin_loader_t *loader);"
1404                  add_calls="$add_calls \n add_static_entry (loader, \"$mod\", PLUGIN_INFO_PTR($mod));"
1405                  init_calls="$init_calls \n PLUGIN_INIT_NAME($mod)(loader);"
1406
1407               AC_MSG_RESULT([static])
1408         else
1409               AC_MSG_RESULT([dynamic])
1410         fi
1411 done
1412
1413 AC_MSG_CHECKING([loader.autoconf files])
1414 mkdir cherokee 2>/dev/null
1415 printf "$ext_defs\n"                                 > cherokee/loader.autoconf.h
1416 printf "$headers \n\n $add_calls \n\n $init_calls\n" > cherokee/loader.autoconf.inc
1417 AC_MSG_RESULT([done])
1418
1419 dnl
1420 dnl Static/Dynamic modules
1421 dnl
1422 conf_h="cherokee/loader.autoconf.h"
1423 AM_CONDITIONAL(STATIC_HANDLER_SERVER_INFO,    grep server_info    $conf_h >/dev/null)
1424 AM_CONDITIONAL(STATIC_HANDLER_FILE,           grep file           $conf_h >/dev/null)
1425 AM_CONDITIONAL(STATIC_HANDLER_ADMIN,          grep admin          $conf_h >/dev/null)
1426 AM_CONDITIONAL(STATIC_HANDLER_DIRLIST,        grep dirlist        $conf_h >/dev/null)
1427 AM_CONDITIONAL(STATIC_HANDLER_CGI,            grep cgi            $conf_h >/dev/null)
1428 AM_CONDITIONAL(STATIC_HANDLER_FCGI,           grep fcgi           $conf_h >/dev/null)
1429 AM_CONDITIONAL(STATIC_HANDLER_SCGI,           grep scgi           $conf_h >/dev/null)
1430 AM_CONDITIONAL(STATIC_HANDLER_UWSGI,          grep uwsgi          $conf_h >/dev/null)
1431 AM_CONDITIONAL(STATIC_HANDLER_REDIR,          grep redir          $conf_h >/dev/null)
1432 AM_CONDITIONAL(STATIC_HANDLER_ERROR_REDIR,    grep error_redir    $conf_h >/dev/null)
1433 AM_CONDITIONAL(STATIC_HANDLER_ERROR_NN,       grep error_nn       $conf_h >/dev/null)
1434 AM_CONDITIONAL(STATIC_HANDLER_COMMON,         grep common         $conf_h >/dev/null)
1435 AM_CONDITIONAL(STATIC_HANDLER_CGI,            grep cgi            $conf_h >/dev/null)
1436 AM_CONDITIONAL(STATIC_HANDLER_PROXY,          grep proxy          $conf_h >/dev/null)
1437 AM_CONDITIONAL(STATIC_HANDLER_SSI,            grep ssi            $conf_h >/dev/null)
1438 AM_CONDITIONAL(STATIC_HANDLER_SECDOWNLOAD,    grep secdownload    $conf_h >/dev/null)
1439 AM_CONDITIONAL(STATIC_HANDLER_EMPTY_GIF,      grep empty_gif      $conf_h >/dev/null)
1440 AM_CONDITIONAL(STATIC_HANDLER_CUSTOM_ERROR,   grep custom_error   $conf_h >/dev/null)
1441 AM_CONDITIONAL(STATIC_HANDLER_DBSLAYER,       grep dbslayer       $conf_h >/dev/null)
1442 AM_CONDITIONAL(STATIC_HANDLER_STREAMING,      grep streaming      $conf_h >/dev/null)
1443 AM_CONDITIONAL(STATIC_HANDLER_RENDER_RRD,     grep render_rrd     $conf_h >/dev/null)
1444 AM_CONDITIONAL(STATIC_ENCODER_GZIP,           grep gzip           $conf_h >/dev/null)
1445 AM_CONDITIONAL(STATIC_ENCODER_DEFLATE,        grep deflate        $conf_h >/dev/null)
1446 AM_CONDITIONAL(STATIC_LOGGER_NCSA,            grep ncsa           $conf_h >/dev/null)
1447 AM_CONDITIONAL(STATIC_LOGGER_COMBINED,        grep combined       $conf_h >/dev/null)
1448 AM_CONDITIONAL(STATIC_LOGGER_CUSTOM,          grep custom         $conf_h >/dev/null)
1449 AM_CONDITIONAL(STATIC_VALIDATOR_PAM,          grep pam            $conf_h >/dev/null)
1450 AM_CONDITIONAL(STATIC_VALIDATOR_LDAP,         grep ldap           $conf_h >/dev/null)
1451 AM_CONDITIONAL(STATIC_VALIDATOR_MYSQL,        grep mysql          $conf_h >/dev/null)
1452 AM_CONDITIONAL(STATIC_VALIDATOR_HTPASSWD,     grep htpasswd       $conf_h >/dev/null)
1453 AM_CONDITIONAL(STATIC_VALIDATOR_PLAIN,        grep plain          $conf_h >/dev/null)
1454 AM_CONDITIONAL(STATIC_VALIDATOR_HTDIGEST,     grep htdigest       $conf_h >/dev/null)
1455 AM_CONDITIONAL(STATIC_VALIDATOR_AUTHLIST,     grep authlist       $conf_h >/dev/null)
1456 AM_CONDITIONAL(STATIC_BALANCER_ROUND_ROBIN,   grep round_robin    $conf_h >/dev/null)
1457 AM_CONDITIONAL(STATIC_BALANCER_IP_HASH,       grep ip_hash        $conf_h >/dev/null)
1458 AM_CONDITIONAL(STATIC_CRYPTOR_LIBSSL,         grep libssl         $conf_h >/dev/null)
1459 AM_CONDITIONAL(STATIC_RULE_DIRECTORY,         grep directory      $conf_h >/dev/null)
1460 AM_CONDITIONAL(STATIC_RULE_EXTENSIONS,        grep extensions     $conf_h >/dev/null)
1461 AM_CONDITIONAL(STATIC_RULE_REQUEST,           grep request        $conf_h >/dev/null)
1462 AM_CONDITIONAL(STATIC_RULE_HEADER,            grep header         $conf_h >/dev/null)
1463 AM_CONDITIONAL(STATIC_RULE_EXISTS,               grep exists         $conf_h >/dev/null)
1464 AM_CONDITIONAL(STATIC_RULE_FULL_PATH,         grep fullpath       $conf_h >/dev/null)
1465 AM_CONDITIONAL(STATIC_RULE_BIND,                 grep bind           $conf_h >/dev/null)
1466 AM_CONDITIONAL(STATIC_RULE_METHOD,               grep method         $conf_h >/dev/null)
1467 AM_CONDITIONAL(STATIC_RULE_FROM,                 grep from           $conf_h >/dev/null)
1468 AM_CONDITIONAL(STATIC_RULE_GEOIP,             grep geoip          $conf_h >/dev/null)
1469 AM_CONDITIONAL(STATIC_RULE_URL_ARG,              grep url_arg        $conf_h >/dev/null)
1470 AM_CONDITIONAL(STATIC_VRULE_WILDCARD,         grep wildcard       $conf_h >/dev/null)
1471 AM_CONDITIONAL(STATIC_VRULE_REHOST,           grep rehost         $conf_h >/dev/null)
1472 AM_CONDITIONAL(STATIC_VRULE_TARGET_IP,        grep target_ip      $conf_h >/dev/null)
1473 AM_CONDITIONAL(STATIC_GEN_EVHOST,             grep evhost         $conf_h >/dev/null)
1474 AM_CONDITIONAL(STATIC_POST_TRACK,             grep post_track     $conf_h >/dev/null)
1475 AM_CONDITIONAL(STATIC_POST_REPORT,            grep post_report    $conf_h >/dev/null)
1476 AM_CONDITIONAL(STATIC_COLLECTOR_RRD,          grep rrd            $conf_h >/dev/null)
1477 # These must be at the end
1478 AM_CONDITIONAL(STATIC_RULE_NOT,               grep _not_          $conf_h >/dev/null)
1479 AM_CONDITIONAL(STATIC_RULE_AND,               grep _and_          $conf_h >/dev/null)
1480 AM_CONDITIONAL(STATIC_RULE_OR,                grep _or_           $conf_h >/dev/null)
1481
1482 AC_OUTPUT([
1483 Makefile
1484 cget/Makefile
1485 cherokee-config
1486 cherokee.pc
1487 cherokee.spec
1488 cherokee/Makefile
1489 contrib/Makefile
1490 icons/Makefile
1491 m4/Makefile
1492 qa/Makefile
1493 doc/Makefile
1494 themes/Makefile
1495 themes/default/Makefile
1496 themes/firefox3/Makefile
1497 themes/plain/Makefile
1498 packages/Makefile
1499 packages/osx/Makefile
1500 packages/osx/Info.plist
1501 packages/osx/Description.plist
1502 packages/windows/Makefile
1503 packages/windows/cherokee.nsi
1504 www/Makefile
1505 dbslayer/Makefile
1506 admin/Makefile
1507 admin/static/Makefile
1508 admin/static/js/Makefile
1509 admin/static/css/Makefile
1510 admin/static/images/Makefile
1511 admin/static/images/flags/Makefile
1512 admin/static/images/wizards/Makefile
1513 po/Makefile
1514 ])
1515
1516
1517 methods=""
1518 if test "$have_epoll"        = yes; then methods="${methods}epoll ";  fi
1519 if test "$have_kqueue"       = yes; then methods="${methods}kqueue "; fi
1520 if test "$have_poll"         = yes; then methods="${methods}poll ";   fi
1521 if test "$have_port"         = yes; then methods="${methods}port ";   fi
1522 if test "$have_win32_select" = yes; then methods="${methods}win32 ";  fi
1523 if test "$have_select"       = yes; then methods="${methods}select";  fi
1524
1525 if test "$use_crypt_r" = "yes"; then
1526         crypt_type="multithread"
1527 elif test "$use_crypt" = "yes"; then
1528         crypt_type="single thread"
1529 else
1530         crypt_type="no"
1531 fi
1532
1533 echo
1534 echo ============================
1535 echo "Install prefix        $prefix"
1536 echo "CFLAGS                $CFLAGS"
1537 echo "trace                 $enable_trace"
1538 echo "backtracing           $enable_backtraces"
1539 echo "sendfile()            $with_sendfile_support"
1540 echo "IPv6 support          $have_ipv6"
1541 i=1
1542 for m in $methods; do
1543         echo "Polling method $i      $m"
1544         i=`expr $i + 1`
1545 done
1546 echo "Threading support     $have_pthread"
1547 echo "OpenSSL support       $have_openssl"
1548 echo "PCRE library          $have_pcre"
1549 echo "Compatible PAM        $have_pam"
1550 echo "LDAP                  $have_ldap"
1551 echo "MySQL                 $have_mysql"
1552 echo "GeoIP                 $have_geoip"
1553 echo "FFMpeg                $have_ffmpeg"
1554 echo "crypt support         $crypt_type"
1555 if test "x$is_beta" = "xyes"; then
1556 echo "Beta release          $svn_rev"
1557 fi
1558 echo
1559 eval eval echo "Installation dir      $bindir"
1560 echo ============================
1561 echo
1562 if test "x$cherokeepath" != "x" ; then
1563         echo Warning: You have an old copy of Cherokee at $cherokeepath.
1564         echo
1565 fi
1566
1567 cat <<THEEND
1568 +------------------------------------------------------------------+
1569 | License:                                                         |
1570 | This software is subject to the GPL License, available in this   |
1571 | distribution in the file COPYING. Please, remember that any copy |
1572 | distribution or modification of the software is subject to it.   |
1573 +------------------------------------------------------------------+
1574
1575 Thank you for using Cherokee.
1576 THEEND
Note: See TracBrowser for help on using the browser.