source: toilet/trunk/configure.ac @ 4348

Last change on this file since 4348 was 4347, checked in by Sam Hocevar, 11 years ago

Add mygetopt.c to the project. Fixes #42.

  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1# $Id: configure.ac 4347 2010-02-08 23:56:33Z sam $
2
3AC_INIT(toilet, 0.1)
4
5AC_PREREQ(2.50)
6AC_CONFIG_SRCDIR(src/main.c)
7AC_CONFIG_AUX_DIR(.auto)
8AC_CANONICAL_SYSTEM
9
10AM_INIT_AUTOMAKE(toilet, 0.1)
11AM_CONFIG_HEADER(config.h)
12
13AM_PROG_CC_C_O
14AC_PROG_CPP
15
16dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
17dnl now otherwise it might be set in an obscure if statement. Same thing for
18dnl PKG_PROG_PKG_CONFIG which needs to be called first.
19AC_EGREP_CPP(yes, foo)
20PKG_PROG_PKG_CONFIG()
21
22dnl Don't let pkg-config fuck our cross-compilation environment
23m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
24if test "$build" != "$host" -a "${PKG_CONFIG_LIBDIR}" = ""; then
25  export PKG_CONFIG_LIBDIR=/dev/null
26fi
27
28AC_CHECK_HEADERS(getopt.h sys/ioctl.h zlib.h)
29
30ac_cv_have_getopt_long="no"
31AC_CHECK_FUNCS(getopt_long,
32 [ac_cv_have_getopt_long="yes"],
33 [AC_CHECK_LIB(gnugetopt, getopt_long,
34   [ac_cv_have_getopt_long="yes"
35    GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
36if test "$ac_cv_have_getopt_long" != "no"; then
37  AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the ‘getopt_long’ function.)
38fi
39AM_CONDITIONAL(NEED_GETOPT_LONG, test "$ac_cv_have_getopt_long" = "no")
40AC_SUBST(GETOPT_LIBS)
41
42AC_CHECK_LIB(z, gzopen,
43 [ZLIB_LIBS="${ZLIB_LIBS} -lz"])
44AC_SUBST(ZLIB_LIBS)
45
46AC_CACHE_CHECK([for TIOCGWINSZ],
47  [ac_cv_have_tiocgwinsz],
48  [AC_TRY_COMPILE(
49    [#include <sys/ioctl.h>],
50    [struct winsize ws;
51     ioctl(1, TIOCGWINSZ, &ws);],
52    ac_cv_have_tiocgwinsz=yes,
53    ac_cv_have_tiocgwinsz=no)])
54if test "${ac_cv_have_tiocgwinsz}" = "yes"; then
55  AC_DEFINE(HAVE_TIOCGWINSZ, 1, [Define if you have TIOCGWINSZ])
56fi
57
58CUCUL="no"
59PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17,
60 [CUCUL="yes"],
61 [AC_MSG_RESULT(no)
62  AC_MSG_ERROR([you need libcaca version 0.99.beta17 or later])])
63
64AC_MSG_CHECKING([for release date])
65stamp="$(sed -ne 's/# \$Id: .*\(....-..-..\).*/\1/p;q' configure.ac)"
66 if date +"%e %B %Y" -d "$stamp" >/dev/null 2>&1; then
67   ac_build_date="$(LANG=C date +"%e %B %Y" -d "$stamp" | sed 's/^ //')"
68 else
69   tmp="${stamp%-*}"
70   ac_build_date="${stamp##*-} ${tmp#*-} ${stamp%%-*}"
71 fi
72AC_MSG_RESULT([$ac_build_date])
73AC_DEFINE_UNQUOTED(DATE, "$ac_build_date", [Define the version date])
74
75# Optimizations
76CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
77# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
78CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
79
80AC_OUTPUT([
81  Makefile
82  src/Makefile
83  tools/Makefile
84  fonts/Makefile
85  doc/Makefile
86  test/Makefile
87])
88
Note: See TracBrowser for help on using the repository browser.