source: neercs/trunk/configure.ac @ 4391

Last change on this file since 4391 was 4391, checked in by Sam Hocevar, 11 years ago

Explicitly link neercs with -lm because of sincosf() usage.

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