summaryrefslogtreecommitdiff
path: root/configure.ac
blob: d940c89036628d1e6f9de0e3c3719770261fc1bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

AC_INIT([fcgy],[0.0],[projects@yorhel.nl])
AC_CONFIG_SRCDIR([.])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_AUX_DIR([build-aux])
m4_include([deps/lean.m4])
AM_INIT_AUTOMAKE([foreign subdir-objects])

AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_RANLIB

# Don't use AC_GNU_SOURCE, it pulls in a lot of pointless header file checks.
AC_DEFINE(_GNU_SOURCE, 1, [Expose some potentially-unportable symbols])

AC_SYS_LARGEFILE

m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

# Check for pod2man
AC_CHECK_PROG([have_pod2man],[pod2man],[yes],[no])
AM_CONDITIONAL([USE_POD2MAN], [test "x$have_pod2man" = "xyes"])


AC_SEARCH_LIBS([clock_gettime],[rt])
AC_SEARCH_LIBS([inet_ntop], [nsl])
AC_SEARCH_LIBS([socket], [socket], [], [
  AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"], [], [-lnsl])])


# Libev (4.0+) can either be provided by the system or by using the version in deps/.
AC_ARG_WITH(system-libev,
            AS_HELP_STRING([--with-system-libev], [Use the system-provided libev instead of the embedded version.]),
            [usesysev=$withval], [usesysev=auto])
if test "x$usesysev" != "xno"; then
  havesysev=no
  AC_CHECK_LIB([ev],
               [ev_depth],
               [AC_CHECK_HEADERS([ev.h],[havesysev=yes],[])],
               [])
  if test "x$havesysev" = "xno" -a "x$usesysev" = "xyes"; then
    AC_MSG_ERROR([System-provided libev requested, but library or header could not be found.])
  fi
  usesysev=$havesysev
fi
if test "x$usesysev" = "xno"; then
  # Since we have our own libev, let's disable EV_MULTIPLICITY and threading
  # support. Decreases binary size a bit.
  AC_DEFINE(EV_MULTIPLICITY, 0, [Define to disable support for multiple event loops.])
  AC_DEFINE(EV_NO_THREADS, 1, [Define to disable support for threads.])
  m4_include([deps/ev/libev.m4])
fi
AM_CONDITIONAL([HAVE_SYSEV], [test "x$usesysev" = "xyes"])
# We require 4.0+ and don't want the compatibility macros
AC_DEFINE(EV_COMPAT3, 0, [Define to disable compatibility with pre-4.0 libev.])


AC_ARG_ENABLE(git-version,
  AS_HELP_STRING([--enable-git-version], [enable use of git version if available]),
  [wantgitver=$enableval], [wantgitver=yes])

usegitver=no
if test "x$wantgitver" = "xyes" ; then
  AC_CHECK_PROGS([GIT], [git], [no])
  test "x$GIT" != "xno" -a -d "$srcdir/.git" && usegitver=yes
fi
AM_CONDITIONAL(USE_GIT_VERSION, test "x$usegitver" = "xyes")


AC_OUTPUT([Makefile])