| 1 | # $Id$ |
|---|
| 2 | |
|---|
| 3 | AC_PREREQ(2.59) |
|---|
| 4 | AC_COPYRIGHT([Copyright (c) 2006 Linpro AS / Verdens Gang AS]) |
|---|
| 5 | AC_REVISION([$Id$]) |
|---|
| 6 | AC_INIT([Varnish], [1.0.4], [varnish-dev@projects.linpro.no]) |
|---|
| 7 | AC_CONFIG_SRCDIR(include/varnishapi.h) |
|---|
| 8 | AM_CONFIG_HEADER(config.h) |
|---|
| 9 | |
|---|
| 10 | AC_CANONICAL_SYSTEM |
|---|
| 11 | AC_LANG(C) |
|---|
| 12 | |
|---|
| 13 | AM_INIT_AUTOMAKE |
|---|
| 14 | |
|---|
| 15 | # Checks for programs. |
|---|
| 16 | AC_GNU_SOURCE |
|---|
| 17 | AC_PROG_CC |
|---|
| 18 | AC_PROG_CPP |
|---|
| 19 | AC_PROG_INSTALL |
|---|
| 20 | AC_PROG_LIBTOOL |
|---|
| 21 | AC_PROG_MAKE_SET |
|---|
| 22 | AC_CHECK_PROGS(XSLTPROC, [xsltproc]) |
|---|
| 23 | |
|---|
| 24 | # Checks for libraries. |
|---|
| 25 | save_LIBS="${LIBS}" |
|---|
| 26 | LIBS="" |
|---|
| 27 | AC_CHECK_LIB(rt, clock_gettime) |
|---|
| 28 | RT_LIBS="${LIBS}" |
|---|
| 29 | LIBS="${save_LIBS}" |
|---|
| 30 | AC_SUBST(RT_LIBS) |
|---|
| 31 | |
|---|
| 32 | save_LIBS="${LIBS}" |
|---|
| 33 | LIBS="" |
|---|
| 34 | AC_CHECK_LIB(dl, dlopen) |
|---|
| 35 | DL_LIBS="${LIBS}" |
|---|
| 36 | LIBS="${save_LIBS}" |
|---|
| 37 | AC_SUBST(DL_LIBS) |
|---|
| 38 | |
|---|
| 39 | save_LIBS="${LIBS}" |
|---|
| 40 | LIBS="" |
|---|
| 41 | AC_SEARCH_LIBS(initscr, [curses ncurses]) |
|---|
| 42 | CURSES_LIBS="${LIBS}" |
|---|
| 43 | LIBS="${save_LIBS}" |
|---|
| 44 | AC_SUBST(CURSES_LIBS) |
|---|
| 45 | |
|---|
| 46 | save_LIBS="${LIBS}" |
|---|
| 47 | LIBS="" |
|---|
| 48 | AC_SEARCH_LIBS(pthread_create, [thr pthread c_r]) |
|---|
| 49 | PTHREAD_LIBS="${LIBS}" |
|---|
| 50 | LIBS="${save_LIBS}" |
|---|
| 51 | AC_SUBST(PTHREAD_LIBS) |
|---|
| 52 | |
|---|
| 53 | # Checks for header files. |
|---|
| 54 | AC_HEADER_STDC |
|---|
| 55 | AC_HEADER_SYS_WAIT |
|---|
| 56 | AC_HEADER_TIME |
|---|
| 57 | AC_CHECK_HEADERS([sys/socket.h]) |
|---|
| 58 | AC_CHECK_HEADERS([sys/statvfs.h]) |
|---|
| 59 | AC_CHECK_HEADERS([sys/vfs.h]) |
|---|
| 60 | AC_CHECK_HEADERS([netinet/in.h]) |
|---|
| 61 | AC_CHECK_HEADERS([stddef.h]) |
|---|
| 62 | AC_CHECK_HEADERS([stdlib.h]) |
|---|
| 63 | AC_CHECK_HEADERS([unistd.h]) |
|---|
| 64 | AC_CHECK_HEADERS([vis.h]) |
|---|
| 65 | |
|---|
| 66 | # Checks for typedefs, structures, and compiler characteristics. |
|---|
| 67 | AC_C_CONST |
|---|
| 68 | AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,[ |
|---|
| 69 | #include <sys/types.h> |
|---|
| 70 | #ifdef HAVE_SYS_SOCKET_H |
|---|
| 71 | #include <sys/socket.h> |
|---|
| 72 | #endif |
|---|
| 73 | ]) |
|---|
| 74 | |
|---|
| 75 | # Checks for library functions. |
|---|
| 76 | AC_TYPE_SIGNAL |
|---|
| 77 | AC_TYPE_SIZE_T |
|---|
| 78 | AC_FUNC_VPRINTF |
|---|
| 79 | AC_CHECK_FUNCS([strerror]) |
|---|
| 80 | AC_FUNC_STRERROR_R |
|---|
| 81 | AC_CHECK_FUNCS([socket]) |
|---|
| 82 | AC_CHECK_FUNCS([strptime]) |
|---|
| 83 | AC_CHECK_FUNCS([sendfile]) |
|---|
| 84 | |
|---|
| 85 | # These functions are provided by libcompat on platforms where they |
|---|
| 86 | # are not available |
|---|
| 87 | AC_CHECK_FUNCS([asprintf vasprintf]) |
|---|
| 88 | AC_CHECK_FUNCS([setproctitle]) |
|---|
| 89 | AC_CHECK_FUNCS([srandomdev]) |
|---|
| 90 | AC_CHECK_FUNCS([strlcat strlcpy]) |
|---|
| 91 | AC_CHECK_FUNCS([strndup]) |
|---|
| 92 | AC_CHECK_FUNCS([vis strvis strvisx]) |
|---|
| 93 | AC_CHECK_FUNCS([daemon]) |
|---|
| 94 | |
|---|
| 95 | save_LIBS="${LIBS}" |
|---|
| 96 | LIBS="${LIBS} ${RT_LIBS}" |
|---|
| 97 | AC_CHECK_FUNCS([clock_gettime]) |
|---|
| 98 | LIBS="${save_LIBS}" |
|---|
| 99 | |
|---|
| 100 | # Check which mechanism to use for the acceptor |
|---|
| 101 | AC_CHECK_FUNCS([kqueue]) |
|---|
| 102 | AC_CHECK_FUNCS([epoll_ctl]) |
|---|
| 103 | AC_CHECK_FUNCS([poll]) |
|---|
| 104 | |
|---|
| 105 | # Now that we're done using the compiler to look for functions and |
|---|
| 106 | # libraries, set CFLAGS to what we want them to be for our own code |
|---|
| 107 | |
|---|
| 108 | # This corresponds to FreeBSD's WARNS level 6 |
|---|
| 109 | DEVELOPER_CFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wformat" |
|---|
| 110 | |
|---|
| 111 | # Turn off warnings for two issues which occur frequently in our code |
|---|
| 112 | #DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wextra -Wno-missing-field-initializers -Wno-sign-compare" |
|---|
| 113 | |
|---|
| 114 | AC_ARG_ENABLE(developer-warnings, |
|---|
| 115 | AS_HELP_STRING([--enable-developer-warnings],[enable strict warnings (default is NO)]), |
|---|
| 116 | CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}") |
|---|
| 117 | AC_ARG_ENABLE(debugging-symbols, |
|---|
| 118 | AS_HELP_STRING([--enable-debugging-symbols],[enable debugging symbols (default is NO)]), |
|---|
| 119 | CFLAGS="${CFLAGS} -O0 -g -fno-inline") |
|---|
| 120 | AC_ARG_ENABLE(werror, |
|---|
| 121 | AS_HELP_STRING([--enable-werror],[use -Werror (default is NO)]), |
|---|
| 122 | CFLAGS="${CFLAGS} -Werror") |
|---|
| 123 | |
|---|
| 124 | # Generate output |
|---|
| 125 | AC_CONFIG_FILES([ |
|---|
| 126 | Makefile |
|---|
| 127 | bin/Makefile |
|---|
| 128 | bin/varnishd/Makefile |
|---|
| 129 | bin/varnishlog/Makefile |
|---|
| 130 | bin/varnishhist/Makefile |
|---|
| 131 | bin/varnishncsa/Makefile |
|---|
| 132 | bin/varnishstat/Makefile |
|---|
| 133 | bin/varnishtop/Makefile |
|---|
| 134 | doc/Makefile |
|---|
| 135 | etc/Makefile |
|---|
| 136 | include/Makefile |
|---|
| 137 | lib/Makefile |
|---|
| 138 | lib/libcompat/Makefile |
|---|
| 139 | lib/libvarnish/Makefile |
|---|
| 140 | lib/libvarnishapi/Makefile |
|---|
| 141 | lib/libvcl/Makefile |
|---|
| 142 | man/Makefile |
|---|
| 143 | ]) |
|---|
| 144 | AC_OUTPUT |
|---|