source: neercs/trunk/configure.ac @ 4336

Last change on this file since 4336 was 4336, checked in by Pascal Terjan, 11 years ago

Support python 2.6, and ask for 2.4 as it is accepted

File size: 5.9 KB
Line 
1# $Id: configure.ac 98 2006-09-22 16:27:37Z sam $
2
3AC_INIT(neercs, 0.0)
4
5AC_PREREQ(2.50)
6AC_CONFIG_SRCDIR(src/main.c)
7AC_CONFIG_AUX_DIR(.auto)
8AC_CANONICAL_SYSTEM
9
10AM_INIT_AUTOMAKE(neercs, 0.0)
11AM_CONFIG_HEADER(config.h)
12
13AM_PROG_CC_C_O
14AC_PROG_CPP
15
16AC_CANONICAL_HOST
17
18if 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}"
36fi
37
38
39dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
40dnl now otherwise it might be set in an obscure if statement. Same thing for
41dnl PKG_PROG_PKG_CONFIG which needs to be called first.
42AC_EGREP_CPP(yes, foo)
43PKG_PROG_PKG_CONFIG()
44
45dnl Don't let pkg-config fuck our cross-compilation environment
46m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
47if test "$build" != "$host" -a "${PKG_CONFIG_LIBDIR}" = ""; then
48  export PKG_CONFIG_LIBDIR=/dev/null
49fi
50
51
52dnl conditional builds
53AC_ARG_ENABLE(debug,
54  [  --enable-debug          build debug version of neercs (default no)])
55AC_ARG_ENABLE(profiling,
56  [  --enable-profiling      build profiling version of neercs (gprof)(default no)])
57AC_ARG_ENABLE(python,
58  [  --enable-python         build Python interpreter (default yes)])
59AS_IF([test "x$enable_python" != "xno"], [
60  enable_python="yes"
61])
62AC_ARG_ENABLE(ruby,
63  [  --enable-ruby           build Ruby interpreter (default yes)])
64AS_IF([test "x$enable_ruby" != "xno"], [
65  enable_ruby="yes"
66])
67
68CACA="no"
69PKG_CHECK_MODULES(CACA, caca >= 0.99.beta16,
70 [CACA="yes"],
71 [AC_MSG_RESULT(no)
72  AC_MSG_ERROR([you need libcaca version 0.99.beta17 or later])])
73
74AC_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)
75
76if test $host_os != "darwin10.2.0"; then
77AC_CHECK_LIB(pam, pam_authenticate,
78 [PAM_LIBS="${PAM_LIBS} -lpam"
79  AC_DEFINE(USE_LOCK, 1, [Locking the PTY is supported])])
80AC_SUBST(PAM_LIBS)
81else
82AC_MSG_RESULT(Disabling lock support on OSX)
83fi
84
85AC_CHECK_LIB(caca, caca_clear_dirty_rect_list,
86 [AC_DEFINE(HAVE_CACA_DIRTY_RECTANGLES, 1, [libcaca has dirty rectangles])])
87
88AC_CHECK_LIB(caca, caca_fill_triangle_textured,
89 [AC_DEFINE(HAVE_CACA_TRIANGLE_TEXTURING, 1, [libcaca has trifiller])])
90
91AC_CHECK_LIB(util, forkpty, UTIL_LIBS="${UTIL_LIBS} -lutil")
92AC_SUBST(UTIL_LIBS)
93
94AC_MSG_CHECKING(for pty grab support)
95case $target in
96  i?86-*-linux-*|amd64-*-linux-*|x86_64-*-linux-*)
97    AC_DEFINE(USE_GRAB, 1, [Grabbing processes is supported])
98    grab=yes ;;
99  *)
100    grab=no ;;
101esac
102AC_MSG_RESULT($grab)
103
104if test "${enable_debug}" = "yes"; then
105  AC_DEFINE(DEBUG, 1, Define to 1 to activate debug)
106fi
107
108AC_DEFINE(_GNU_SOURCE, 1, [Use GNU extentions])
109
110PYTHON="no"
111if test "${enable_python}" != "no"; then
112PKG_CHECK_MODULES(PYTHON3, python3 >= 3.1,
113 [PYTHON="yes"
114  PYTHON_CFLAGS="${PYTHON3_CFLAGS}"
115  PYTHON_LIBS="${PYTHON3_LIBS}"
116  AC_DEFINE(HAVE_PYTHON3, 1, [Define to 1 if Python 3 is present])
117  AC_DEFINE(HAVE_PYTHON26, 1, [Define to 1 if Python >= 2.6 is present])],
118 [AC_PATH_PROG(PYTHON_CONFIG, python2.6-config, no)
119  if test "${PYTHON_CONFIG}" = "no"; then
120    AC_PATH_PROG(PYTHON_CONFIG, python2.5-config, no)
121  else
122    AC_DEFINE(HAVE_PYTHON26, 1, [Define to 1 if Python >= 2.6 is present])
123  fi
124  if test "${PYTHON_CONFIG}" = "no"; then
125    AC_PATH_PROG(PYTHON_CONFIG, python2.4-config, no)
126  fi
127  if test "${PYTHON_CONFIG}" != "no"; then
128    PYTHON="yes"
129    PYTHON_CFLAGS="`${PYTHON_CONFIG} --cflags`"
130    PYTHON_LIBS="`${PYTHON_CONFIG} --libs`"
131    AC_DEFINE(HAVE_PYTHON2, 1, [Define to 1 if Python 2 is present])
132  fi])
133  if test "${PYTHON}" = "yes"; then
134    AC_DEFINE(USE_PYTHON, 1, [Define to 1 to use Python interpreter])
135  else
136    AC_MSG_RESULT(you need Python 2.4 or later to compile the interpreter)
137  fi
138fi
139
140AC_SUBST(PYTHON_CFLAGS)
141AC_SUBST(PYTHON_LIBS)
142
143# Optimizations / Profiling
144CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce"
145
146if test "${enable_profiling}" = "yes"; then
147  CFLAGS="${CFLAGS} -g -O0 -fno-strength-reduce -pg"
148else
149  CFLAGS="${CFLAGS} -fomit-frame-pointer"
150fi
151
152# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
153CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
154
155# Build documentation?
156DOXYGEN="no"
157LATEX="no"
158if test "${enable_doc}" != "no"; then
159  AC_PATH_PROG(DOXYGEN, doxygen, no)
160  if test "${DOXYGEN}" != "no"; then
161    # Build LaTeX documentation?
162    AC_PATH_PROG(LATEX, pdflatex, no)
163    AC_PATH_PROG(KPSEWHICH, kpsewhich, no)
164    AC_PATH_PROG(DVIPS, dvips, no)
165    if test "${DVIPS}" = "no" -o "${KPSEWHICH}" = "no"; then
166      LATEX="no"
167    fi
168    if test "${LATEX}" != "no"; then
169      AC_MSG_CHECKING(for a4.sty and a4wide.sty)
170      if "${KPSEWHICH}" a4.sty >/dev/null 2>&1; then
171        if "${KPSEWHICH}" a4wide.sty >/dev/null 2>&1; then
172          AC_MSG_RESULT(yes)
173        else
174          LATEX="no"
175          AC_MSG_RESULT(no)
176        fi
177      else
178        LATEX="no"
179        AC_MSG_RESULT(no)
180      fi
181    fi
182  fi
183fi
184AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
185AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
186
187AC_CONFIG_FILES([
188  Makefile
189  doc/Makefile
190  src/Makefile
191  data/Makefile
192  test/Makefile
193])
194AC_CONFIG_FILES([
195  doc/doxygen.cfg
196])
197AC_OUTPUT
198
Note: See TracBrowser for help on using the repository browser.