1 | # $Id: configure.ac 98 2006-09-22 16:27:37Z sam $ |
---|
2 | |
---|
3 | AC_INIT(neercs, 0.0) |
---|
4 | |
---|
5 | AC_PREREQ(2.50) |
---|
6 | AC_CONFIG_SRCDIR(src/main.c) |
---|
7 | AC_CONFIG_AUX_DIR(.auto) |
---|
8 | AC_CANONICAL_SYSTEM |
---|
9 | |
---|
10 | AM_INIT_AUTOMAKE(neercs, 0.0) |
---|
11 | AM_CONFIG_HEADER(config.h) |
---|
12 | |
---|
13 | AM_PROG_CC_C_O |
---|
14 | AC_PROG_CPP |
---|
15 | |
---|
16 | AC_CANONICAL_HOST |
---|
17 | |
---|
18 | if test "$host_os" == "darwin10.2.0"; then |
---|
19 | case x${target} in |
---|
20 | x*86*darwin*) |
---|
21 | MACOSX_SDK="${MACOSX_SDK:-/Developer/SDKs/MacOSX10.6.sdk}" |
---|
22 | GCC_VERSION="${GCC_VERSION:-4.0}" |
---|
23 | ARCH="${ARCH:--arch i386}" |
---|
24 | MACOSX_SDK_CFLAGS="${MACOSX_SDK_CFLAGS:--isysroot ${MACOSX_SDK}}" |
---|
25 | MACOSX_SDK_CXXFLAGS="${MACOSX_SDK_CXXFLAGS:-${MACOSX_SDK_CFLAGS}}" |
---|
26 | ;; |
---|
27 | esac |
---|
28 | CC="${CC:-gcc-${GCC_VERSION}}" |
---|
29 | CXX="${CXX:-g++-${GCC_VERSION}}" |
---|
30 | MACOSX_SDK_FRAMEWORKS="${MACOSX_SDK_FRAMEWORKS:--F${MACOSX_SDK}/System/Library/Frameworks}" |
---|
31 | CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS}" |
---|
32 | CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS}" |
---|
33 | CXXFLAGS="${CXXFLAGS} ${MACOSX_SDK_CXXFLAGS}" |
---|
34 | OBJCFLAGS="${OBJCFLAGS} ${MACOSX_SDK_CFLAGS}" |
---|
35 | LDFLAGS="${ARCH} ${MACOSX_SDK_LDFLAGS} ${LDFLAGS}" |
---|
36 | fi |
---|
37 | |
---|
38 | |
---|
39 | dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right |
---|
40 | dnl now otherwise it might be set in an obscure if statement. Same thing for |
---|
41 | dnl PKG_PROG_PKG_CONFIG which needs to be called first. |
---|
42 | AC_EGREP_CPP(yes, foo) |
---|
43 | PKG_PROG_PKG_CONFIG() |
---|
44 | |
---|
45 | dnl Don't let pkg-config fuck our cross-compilation environment |
---|
46 | m4_pattern_allow([^PKG_CONFIG_LIBDIR$]) |
---|
47 | if test "$build" != "$host" -a "${PKG_CONFIG_LIBDIR}" = ""; then |
---|
48 | export PKG_CONFIG_LIBDIR=/dev/null |
---|
49 | fi |
---|
50 | |
---|
51 | |
---|
52 | dnl conditional builds |
---|
53 | AC_ARG_ENABLE(debug, |
---|
54 | [ --enable-debug build debug versions of neercs (default no)]) |
---|
55 | AC_ARG_ENABLE(python, |
---|
56 | [ --enable-python build Python interpreter (default yes)]) |
---|
57 | AS_IF([test "x$enable_python" != "xno"], [ |
---|
58 | enable_python="yes" |
---|
59 | ]) |
---|
60 | |
---|
61 | CACA="no" |
---|
62 | PKG_CHECK_MODULES(CACA, caca >= 0.99.beta15, |
---|
63 | [CACA="yes"], |
---|
64 | [AC_MSG_RESULT(no) |
---|
65 | AC_MSG_ERROR([you need libcaca version 0.99.beta15 or later])]) |
---|
66 | |
---|
67 | AC_CHECK_HEADERS(stdio.h pty.h sys/ioctl.h sys/ptrace.h sys/stat.h sys/syscall.h sys/user.h sys/wait.h linux/kdev_t.h linux/major.h security/pam_appl.h security/pam_misc.h) |
---|
68 | |
---|
69 | if test $host_os != "darwin10.2.0"; then |
---|
70 | AC_CHECK_LIB(pam, pam_authenticate, |
---|
71 | [PAM_LIBS="${PAM_LIBS} -lpam" |
---|
72 | AC_DEFINE(USE_LOCK, 1, [Locking the PTY is supported])]) |
---|
73 | AC_SUBST(PAM_LIBS) |
---|
74 | else |
---|
75 | AC_MSG_RESULT(Disabling lock support on OSX) |
---|
76 | fi |
---|
77 | |
---|
78 | AC_CHECK_LIB(caca, caca_clear_dirty_rect_list, |
---|
79 | [AC_DEFINE(HAVE_CACA_DIRTY_RECTANGLES, 1, [libcaca has dirty rectangles])]) |
---|
80 | |
---|
81 | AC_CHECK_LIB(caca, caca_fill_triangle_textured, |
---|
82 | [AC_DEFINE(HAVE_CACA_TRIANGLE_TEXTURING, 1, [libcaca has trifiller])]) |
---|
83 | |
---|
84 | AC_CHECK_LIB(util, forkpty, UTIL_LIBS="${UTIL_LIBS} -lutil") |
---|
85 | AC_SUBST(UTIL_LIBS) |
---|
86 | |
---|
87 | AC_MSG_CHECKING(for pty grab support) |
---|
88 | case $target in |
---|
89 | i?86-*-linux-*|amd64-*-linux-*|x86_64-*-linux-*) |
---|
90 | AC_DEFINE(USE_GRAB, 1, [Grabbing processes is supported]) |
---|
91 | grab=yes ;; |
---|
92 | *) |
---|
93 | grab=no ;; |
---|
94 | esac |
---|
95 | AC_MSG_RESULT($grab) |
---|
96 | |
---|
97 | if test "${enable_debug}" = "yes"; then |
---|
98 | AC_DEFINE(DEBUG, 1, Define to 1 to activate debug) |
---|
99 | fi |
---|
100 | |
---|
101 | AC_DEFINE(_GNU_SOURCE, 1, [Use GNU extentions]) |
---|
102 | |
---|
103 | PYTHON3="yes" |
---|
104 | if test "${enable_python}" != "no"; then |
---|
105 | PKG_CHECK_MODULES(PYTHON3, python3 >= 3.1, |
---|
106 | [PYTHON3="yes" AC_DEFINE(USE_PYTHON, 1, [Define to 1 to use Python interpreter])], |
---|
107 | [AC_MSG_RESULT(you need Python 3.1 or later to compile the interpreter) |
---|
108 | ]) |
---|
109 | fi |
---|
110 | |
---|
111 | |
---|
112 | # Optimizations |
---|
113 | CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer" |
---|
114 | # Code qui fait des warnings == code de porc == deux baffes dans ta gueule |
---|
115 | CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare" |
---|
116 | |
---|
117 | AC_OUTPUT([ |
---|
118 | Makefile |
---|
119 | doc/Makefile |
---|
120 | src/Makefile |
---|
121 | data/Makefile |
---|
122 | ]) |
---|
123 | |
---|