6 AC_CONFIG_SRCDIR(src/main.c)
7 AC_CONFIG_AUX_DIR(autotools)
10 AM_INIT_AUTOMAKE(toilet, 0.1)
11 AM_CONFIG_HEADER(config.h)
16 dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
17 dnl now otherwise it might be set in an obscure if statement. Same thing for
18 dnl PKG_PROG_PKG_CONFIG which needs to be called first.
19 AC_EGREP_CPP(yes, foo)
22 dnl Don't let pkg-config fuck our cross-compilation environment
23 m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
24 if test "$build" != "$host" -a "${PKG_CONFIG_LIBDIR}" = ""; then
25 export PKG_CONFIG_LIBDIR=/dev/null
28 AC_CHECK_HEADERS(getopt.h sys/ioctl.h zlib.h)
30 AC_CHECK_FUNCS(getopt_long,
31 [AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)],
32 [AC_CHECK_LIB(gnugetopt, getopt_long,
33 [AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)
34 GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
37 AC_CHECK_LIB(z, gzopen,
38 [ZLIB_LIBS="${ZLIB_LIBS} -lz"])
41 AC_CACHE_CHECK([for TIOCGWINSZ],
42 [ac_cv_have_tiocgwinsz],
44 [#include <sys/ioctl.h>],
46 ioctl(1, TIOCGWINSZ, &ws);],
47 ac_cv_have_tiocgwinsz=yes,
48 ac_cv_have_tiocgwinsz=no)])
49 if test "${ac_cv_have_tiocgwinsz}" = "yes"; then
50 AC_DEFINE(HAVE_TIOCGWINSZ, 1, [Define if you have TIOCGWINSZ])
54 PKG_CHECK_MODULES(CUCUL, cucul >= 0.99.beta10,
57 AC_MSG_ERROR([you need libcucul version 0.99.beta10 or later])])
59 AC_MSG_CHECKING([for release date])
60 stamp="$(sed -ne 's/# \$Id: .*\(....-..-..\).*/\1/p;q' configure.ac)"
61 if date +"%e %B %Y" -d "$stamp" >/dev/null 2>&1; then
62 ac_build_date="$(LANG=C date +"%e %B %Y" -d "$stamp" | sed 's/^ //')"
64 ac_build_date="${stamp##*-} ${${stamp%-*}#*-} ${stamp%%-*}"
66 AC_MSG_RESULT([$ac_build_date])
67 AC_DEFINE_UNQUOTED(DATE, "$ac_build_date", [Define the version date])
70 CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
71 # Code qui fait des warnings == code de porc == deux baffes dans ta gueule
72 CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"