source: neercs/trunk/configure.ac @ 4366

Last change on this file since 4366 was 4366, checked in by Sam Hocevar, 10 years ago

Clean up source code, copyright information, author names, SVN keywords...

File size: 5.6 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(neercs, 0.0)
10AM_CONFIG_HEADER(config.h)
11
12AM_PROG_CC_C_O
13AC_PROG_CPP
14
15AC_CANONICAL_HOST
16
17if test "$host_os" == "darwin10.2.0"; then
18    case x${target} in
19     x*86*darwin*)
20      MACOSX_SDK="${MACOSX_SDK:-/Developer/SDKs/MacOSX10.6.sdk}"
21      GCC_VERSION="${GCC_VERSION:-4.0}"
22      ARCH="${ARCH:--arch i386}"
23      MACOSX_SDK_CFLAGS="${MACOSX_SDK_CFLAGS:--isysroot ${MACOSX_SDK}}"
24      MACOSX_SDK_CXXFLAGS="${MACOSX_SDK_CXXFLAGS:-${MACOSX_SDK_CFLAGS}}"
25      ;;
26    esac
27    CC="${CC:-gcc-${GCC_VERSION}}"
28    CXX="${CXX:-g++-${GCC_VERSION}}"
29    MACOSX_SDK_FRAMEWORKS="${MACOSX_SDK_FRAMEWORKS:--F${MACOSX_SDK}/System/Library/Frameworks}"
30    CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS}"
31    CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS}"
32    CXXFLAGS="${CXXFLAGS} ${MACOSX_SDK_CXXFLAGS}"
33    OBJCFLAGS="${OBJCFLAGS} ${MACOSX_SDK_CFLAGS}"
34    LDFLAGS="${ARCH} ${MACOSX_SDK_LDFLAGS} ${LDFLAGS}"
35fi
36
37
38dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
39dnl now otherwise it might be set in an obscure if statement. Same thing for
40dnl PKG_PROG_PKG_CONFIG which needs to be called first.
41AC_EGREP_CPP(yes, foo)
42PKG_PROG_PKG_CONFIG()
43
44dnl Don't let pkg-config fuck our cross-compilation environment
45m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
46if test "$build" != "$host" -a "${PKG_CONFIG_LIBDIR}" = ""; then
47  export PKG_CONFIG_LIBDIR=/dev/null
48fi
49
50
51dnl conditional builds
52AC_ARG_ENABLE(debug,
53  [  --enable-debug          build debug version of neercs (default no)])
54AC_ARG_ENABLE(profiling,
55  [  --enable-profiling      build profiling version of neercs (gprof)(default no)])
56AC_ARG_ENABLE(python,
57  [  --enable-python         build Python interpreter (default yes)])
58AS_IF([test "x$enable_python" != "xno"], [
59  enable_python="yes"
60])
61AC_ARG_ENABLE(ruby,
62  [  --enable-ruby           build Ruby interpreter (default yes)])
63AS_IF([test "x$enable_ruby" != "xno"], [
64  enable_ruby="yes"
65])
66
67CACA="no"
68PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17,
69 [CACA="yes"],
70 [AC_MSG_RESULT(no)
71  AC_MSG_ERROR([you need libcaca version 0.99.beta17 or later])])
72
73AC_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)
74
75if test $host_os != "darwin10.2.0"; then
76AC_CHECK_LIB(pam, pam_authenticate,
77 [PAM_LIBS="${PAM_LIBS} -lpam"
78  AC_DEFINE(USE_LOCK, 1, [Locking the PTY is supported])])
79AC_SUBST(PAM_LIBS)
80else
81AC_MSG_RESULT(Disabling lock support on OSX)
82fi
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
180AC_CONFIG_FILES([
181  Makefile
182  doc/Makefile
183  src/Makefile
184  data/Makefile
185  test/Makefile
186])
187AC_CONFIG_FILES([
188  doc/doxygen.cfg
189])
190AC_OUTPUT
191
Note: See TracBrowser for help on using the repository browser.