source: neercs/trunk/configure.ac

Last change on this file was 4882, checked in by Sam Hocevar, 6 years ago

build: update bootstrap script and configure.ac.

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