source: neercs/trunk/configure.ac @ 4794

Last change on this file since 4794 was 4794, checked in by Pascal Terjan, 9 years ago

Test pam_misc.h location instead of checking for OSX

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(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(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)
74
75if test "${ac_cv_header_security_pam_misc_h}" = "yes" -o "${ac_cv_header_pam_pam_misc_h}" = "yes"; then
76    AC_CHECK_LIB(pam, pam_authenticate,
77      [PAM_LIBS="${PAM_LIBS} -lpam"
78      AC_DEFINE(USE_LOCK, 1, [Locking the PTY is supported])])
79fi
80AC_SUBST(PAM_LIBS)
81
82AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
83AC_SUBST(MATH_LIBS)
84
85AC_CHECK_LIB(util, forkpty, UTIL_LIBS="${UTIL_LIBS} -lutil")
86AC_SUBST(UTIL_LIBS)
87
88AC_MSG_CHECKING(for pty grab support)
89case $target in
90  i?86-*-linux-*|amd64-*-linux-*|x86_64-*-linux-*)
91    AC_DEFINE(USE_GRAB, 1, [Grabbing processes is supported])
92    grab=yes ;;
93  *)
94    grab=no ;;
95esac
96AC_MSG_RESULT($grab)
97
98if test "${enable_debug}" = "yes"; then
99  AC_DEFINE(DEBUG, 1, Define to 1 to activate debug)
100fi
101
102AC_DEFINE(_GNU_SOURCE, 1, [Use GNU extentions])
103
104PYTHON="no"
105if test "${enable_python}" != "no"; then
106PKG_CHECK_MODULES(PYTHON3, python3 >= 3.1,
107 [PYTHON="yes"
108  PYTHON_CFLAGS="${PYTHON3_CFLAGS}"
109  PYTHON_LIBS="${PYTHON3_LIBS}"
110  AC_DEFINE(HAVE_PYTHON3, 1, [Define to 1 if Python 3 is present])
111  AC_DEFINE(HAVE_PYTHON26, 1, [Define to 1 if Python >= 2.6 is present])],
112 [AC_PATH_PROG(PYTHON_CONFIG, python2.6-config, no)
113  if test "${PYTHON_CONFIG}" = "no"; then
114    AC_PATH_PROG(PYTHON_CONFIG, python2.5-config, no)
115  else
116    AC_DEFINE(HAVE_PYTHON26, 1, [Define to 1 if Python >= 2.6 is present])
117  fi
118  if test "${PYTHON_CONFIG}" = "no"; then
119    AC_PATH_PROG(PYTHON_CONFIG, python2.4-config, no)
120  fi
121  if test "${PYTHON_CONFIG}" != "no"; then
122    PYTHON="yes"
123    PYTHON_CFLAGS="`${PYTHON_CONFIG} --cflags`"
124    PYTHON_LIBS="`${PYTHON_CONFIG} --libs`"
125    AC_DEFINE(HAVE_PYTHON2, 1, [Define to 1 if Python 2 is present])
126  fi])
127  if test "${PYTHON}" = "yes"; then
128    AC_DEFINE(USE_PYTHON, 1, [Define to 1 to use Python interpreter])
129  else
130    AC_MSG_RESULT(you need Python 2.4 or later to compile the interpreter)
131  fi
132fi
133
134AC_SUBST(PYTHON_CFLAGS)
135AC_SUBST(PYTHON_LIBS)
136
137# Optimizations / Profiling
138CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce"
139
140if test "${enable_profiling}" = "yes"; then
141  CFLAGS="${CFLAGS} -g -O0 -fno-strength-reduce -pg"
142else
143  CFLAGS="${CFLAGS} -fomit-frame-pointer"
144fi
145
146# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
147CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
148
149# Build documentation?
150DOXYGEN="no"
151LATEX="no"
152if test "${enable_doc}" != "no"; then
153  AC_PATH_PROG(DOXYGEN, doxygen, no)
154  if test "${DOXYGEN}" != "no"; then
155    # Build LaTeX documentation?
156    AC_PATH_PROG(LATEX, pdflatex, no)
157    AC_PATH_PROG(KPSEWHICH, kpsewhich, no)
158    AC_PATH_PROG(DVIPS, dvips, no)
159    if test "${DVIPS}" = "no" -o "${KPSEWHICH}" = "no"; then
160      LATEX="no"
161    fi
162    if test "${LATEX}" != "no"; then
163      AC_MSG_CHECKING(for a4.sty and a4wide.sty)
164      if "${KPSEWHICH}" a4.sty >/dev/null 2>&1; then
165        if "${KPSEWHICH}" a4wide.sty >/dev/null 2>&1; then
166          AC_MSG_RESULT(yes)
167        else
168          LATEX="no"
169          AC_MSG_RESULT(no)
170        fi
171      else
172        LATEX="no"
173        AC_MSG_RESULT(no)
174      fi
175    fi
176  fi
177fi
178AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
179AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
180
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.