source: libcaca/trunk/configure.ac @ 4328

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

Move some configuration stuff from build-kernel into configure.ac.

  • Property svn:keywords set to Id
File size: 19.4 KB
Line 
1# $Id: configure.ac 4317 2010-02-07 00:22:31Z sam $
2
3AC_INIT(libcaca, 0.99.beta17)
4AC_PREREQ(2.50)
5AC_CONFIG_AUX_DIR(.auto)
6AC_CANONICAL_SYSTEM
7AM_INIT_AUTOMAKE([no-define tar-ustar])
8dnl AM_MAINTAINER_MODE
9
10AM_CONFIG_HEADER(config.h)
11
12LT_MAJOR="0"
13LT_MINOR="99"
14LT_MICRO="17"
15AC_SUBST(LT_MAJOR)
16AC_SUBST(LT_MINOR)
17AC_SUBST(LT_MICRO)
18LT_VERSION="$LT_MAJOR:$LT_MINOR:$LT_MICRO"
19AC_SUBST(LT_VERSION)
20
21AM_PROG_CC_C_O
22AC_PROG_CPP
23AC_PROG_CXX
24AC_PROG_CXXCPP
25_AM_DEPENDENCIES([OBJC])
26OBJC="${CC}"
27AC_SUBST(OBJC)
28AC_SUBST(OBJCFLAGS)
29AM_PROG_AS
30
31AC_LIBTOOL_WIN32_DLL
32AM_PROG_LIBTOOL
33AC_LIBTOOL_CXX
34
35AC_C_CONST
36AC_C_INLINE
37AC_TYPE_SIGNAL
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()
44m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
45if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
46  export PKG_CONFIG_LIBDIR=/dev/null
47fi
48
49AC_MSG_CHECKING(for suffix of libraries)
50case "$shrext_cmds" in
51  .dll) eval LT_SUFFIX="-$LT_MAJOR$shrext_cmds" ;;
52  "") LT_SUFFIX=".so.$LT_MAJOR" ;;
53  *) eval LT_SUFFIX="$shrext_cmds.$LT_MAJOR" ;;
54esac
55AC_MSG_RESULT($LT_SUFFIX)
56AC_SUBST(LT_SUFFIX)
57
58dnl global configuration features
59AC_ARG_ENABLE(kernel,
60  [  --enable-kernel         kernel mode (default no)])
61
62dnl output driver features
63AC_ARG_ENABLE(slang,
64  [  --enable-slang          slang graphics support (autodetected)])
65AC_ARG_ENABLE(ncurses,
66  [  --enable-ncurses        ncurses graphics support (autodetected)])
67AC_ARG_ENABLE(win32,
68  [  --enable-win32          Windows console support (autodetected)])
69AC_ARG_ENABLE(conio,
70  [  --enable-conio          DOS conio.h graphics support (autodetected)])
71AC_ARG_ENABLE(x11,
72  [  --enable-x11            X11 support (autodetected)])
73AC_ARG_ENABLE(gl,
74  [  --enable-gl             OpenGL support (autodetected)])
75AC_ARG_ENABLE(cocoa,
76  [  --enable-cocoa          Cocoa support (autodetected)])
77AC_ARG_ENABLE(network,
78  [  --enable-network        network support (autodetected)])
79AC_ARG_ENABLE(vga,
80  [  --enable-vga            VGA support for kernel mode (autodetected)])
81
82dnl language bindings
83AC_ARG_ENABLE(csharp,
84  [  --enable-csharp         C# bindings (autodetected)])
85AC_ARG_ENABLE(java,
86  [  --enable-java           Java bindings (autodetected)])
87AC_ARG_ENABLE(cxx,
88  [  --enable-cxx            C++ bindings (autodetected)])
89AC_ARG_ENABLE(ruby,
90  [  --enable-ruby           Ruby bindings (autodetected)])
91
92dnl example programs features
93AC_ARG_ENABLE(imlib2,
94  [  --enable-imlib2         Imlib2 graphics support (autodetected)])
95
96dnl conditional builds
97AC_ARG_ENABLE(debug,
98  [  --enable-debug          build debug versions of the library (default no)])
99AC_ARG_ENABLE(profiling,
100  [  --enable-profiling      activate built-in profiling (default no)])
101AC_ARG_ENABLE(plugins,
102  [  --enable-plugins        make X11 and GL drivers plugins (default disabled)])
103AC_ARG_ENABLE(doc,
104  [  --enable-doc            build documentation (needs doxygen and LaTeX)])
105AC_ARG_ENABLE(cppunit,
106  [  --enable-cppunit        use cppunit for unit tests (autodetected)])
107AC_ARG_ENABLE(zzuf,
108  [  --enable-zzuf           use zzuf for fuzzing tests (autodetected)])
109
110ac_cv_my_have_kernel="no"
111if test "${enable_kernel}" = "yes"; then
112  ac_cv_my_have_kernel="yes"
113  CPPFLAGS="${CPPFLAGS} -I. -D__KERNEL__ -nostdinc -include kernel/klibc.h -fno-stack-protector"
114  CCASFLAGS="${CCASFLAGS} -I. -fno-stack-protector"
115  CFLAGS="${CFLAGS} -fno-builtin -O0 -I. -I.. -I../caca/ -Wall -D__KERNEL__ -fno-stack-protector -m32"
116  LDFLAGS="${LDFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,100000 -fno-stack-protector"
117  AC_DEFINE(USE_KERNEL, 1, Define to 1 to activate kernel mode)
118fi
119AM_CONDITIONAL(USE_KERNEL, test "${ac_cv_my_have_kernel}" = "yes")
120
121AC_CHECK_HEADERS(stdio.h stdarg.h signal.h sys/ioctl.h sys/time.h endian.h unistd.h arpa/inet.h netinet/in.h winsock2.h errno.h locale.h getopt.h dlfcn.h termios.h)
122AC_CHECK_FUNCS(signal ioctl snprintf vsnprintf getenv putenv strcasecmp htons)
123AC_CHECK_FUNCS(usleep gettimeofday atexit)
124
125ac_cv_have_getopt_long="no"
126AC_CHECK_FUNCS(getopt_long,
127 [ac_cv_have_getopt_long="yes"],
128 [AC_CHECK_LIB(gnugetopt, getopt_long,
129   [ac_cv_have_getopt_long="yes"
130    GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
131if test "$ac_cv_have_getopt_long" != "no"; then
132  AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the ‘getopt_long’ function.)
133fi
134AM_CONDITIONAL(NEED_GETOPT_LONG, test "$ac_cv_have_getopt_long" = "no")
135AC_SUBST(GETOPT_LIBS)
136
137AC_MSG_CHECKING(for Sleep)
138AC_TRY_COMPILE([#include <windows.h>],[Sleep(42);],
139 [AC_MSG_RESULT(yes)
140  AC_DEFINE(HAVE_SLEEP, 1, [Define to 1 if you have the ‘Sleep’ function.])],
141 [AC_MSG_RESULT(no)])
142
143AC_MSG_CHECKING(for fsin/fcos)
144AC_TRY_COMPILE([],[double x; asm volatile("fsin; fcos":"=t"(x):);],
145 [AC_MSG_RESULT(yes)
146  AC_DEFINE(HAVE_FSIN_FCOS, 1, [Define to 1 if you have the ‘fsin’ and ‘fcos’ instructions.])],
147 [AC_MSG_RESULT(no)])
148
149AC_MSG_CHECKING(for fldln2/fxch/fyl2x)
150AC_TRY_COMPILE([],[double x; asm volatile("fldln2; fldln2; fxch; fyl2x":"=t"(x):);],
151 [AC_MSG_RESULT(yes)
152  AC_DEFINE(HAVE_FLDLN2, 1, [Define to 1 if you have the ‘fldln2’ and other floating point instructions.])],
153 [AC_MSG_RESULT(no)])
154
155AC_CHECK_HEADERS(zlib.h)
156AC_CHECK_LIB(z, gzopen, [ZLIB_LIBS="${ZLIB_LIBS} -lz"])
157
158AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
159
160CACA_DRIVERS=""
161
162if test "${enable_conio}" != "no"; then
163  ac_cv_my_have_conio="no"
164  AC_CHECK_HEADERS(conio.h,
165   [AC_MSG_CHECKING(for ScreenUpdate in pc.h)
166    AC_EGREP_HEADER(ScreenUpdate, pc.h,
167     [ac_cv_my_have_conio="yes"
168      AC_MSG_RESULT(yes)
169      AC_DEFINE(SCREENUPDATE_IN_PC_H, 1,
170                Define to 1 if <pc.h> defines ScreenUpdate.)
171      AC_DEFINE(USE_CONIO, 1, Define to 1 to activate the conio.h backend driver)
172      CACA_DRIVERS="${CACA_DRIVERS} conio"],
173     [AC_MSG_RESULT(no)])])
174  if test "${ac_cv_my_have_conio}" = "no" -a "${enable_conio}" = "yes"; then
175    AC_MSG_ERROR([cannot find conio.h])
176  fi
177fi
178
179if test "${enable_win32}" != "no"; then
180  ac_cv_my_have_win32="no"
181  AC_CHECK_HEADERS(windows.h,
182   [AC_MSG_CHECKING(for AllocConsole in windows.h)
183    AC_EGREP_HEADER(AllocConsole, windows.h,
184     [ac_cv_my_have_win32="yes"
185      AC_MSG_RESULT(yes)
186      AC_DEFINE(ALLOCCONSOLE_IN_WINDOWS_H, 1,
187                Define to 1 if <windows.h> defines AllocConsole.)
188      AC_DEFINE(USE_WIN32, 1, Define to 1 to activate the win32 backend driver)
189      CACA_DRIVERS="${CACA_DRIVERS} win32"],
190     [AC_MSG_RESULT(no)])])
191  if test "${ac_cv_my_have_win32}" = "no" -a "${enable_win32}" = "yes"; then
192    AC_MSG_ERROR([cannot find win32 console development files])
193  fi
194fi
195
196if test "${enable_slang}" != "no"; then
197  ac_cv_my_have_slang="no"
198  AC_CHECK_HEADERS(slang.h slang/slang.h,
199   [ac_cv_my_have_slang="yes"
200    AC_DEFINE(USE_SLANG, 1, Define to 1 to activate the slang backend driver)
201    AC_CHECK_LIB(slang, SLsmg_utf8_enable,
202     [AC_DEFINE(HAVE_SLSMG_UTF8_ENABLE, 1, Define to 1 if you have the ‘SLsmg_utf8_enable’ function.)])
203    CPPFLAGS="${CPPFLAGS} -DOPTIMISE_SLANG_PALETTE=1"
204    CACA_LIBS="${CACA_LIBS} -lslang"
205    CACA_DRIVERS="${CACA_DRIVERS} slang"
206    break])
207  if test "${ac_cv_my_have_slang}" = "no" -a "${enable_slang}" = "yes"; then
208    AC_MSG_ERROR([cannot find slang development files])
209  fi
210fi
211
212if test "${enable_x11}" != "no"; then
213  AC_PATH_X
214  AC_CHECK_LIB(X11, XOpenDisplay,
215   [ac_cv_my_have_x11="yes"
216    if test -n "${x_includes}"; then X_CFLAGS="-I${x_includes}"; fi
217    if test -n "${x_libraries}"; then X_LIBS="-L${x_libraries}"; fi
218    AC_DEFINE(USE_X11, 1, Define to 1 to activate the X11 backend driver)
219    CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
220    X11_LIBS="${X11_LIBS} -lX11 ${X_LIBS}"
221    CACA_DRIVERS="${CACA_DRIVERS} x11"],
222   [ac_cv_my_have_x11="no"],
223   [[`if test -n "${x_libraries}"; then echo -L${x_libraries}; fi`]])
224  AC_CHECK_HEADERS(X11/XKBlib.h)
225  if test "${ac_cv_my_have_x11}" != "yes" -a "${enable_x11}" = "yes"; then
226    AC_MSG_ERROR([cannot find X11 development files])
227  fi
228fi
229
230if test "${enable_gl}" != "no"; then
231  ac_cv_my_have_gl="no"
232  AC_CHECK_HEADERS(GL/gl.h OpenGL/gl.h,
233   [AC_CHECK_HEADERS(GL/glut.h,
234     [AC_CHECK_LIB(glut, glutCloseFunc,
235       [AC_DEFINE(HAVE_GLUTCLOSEFUNC, 1, Define to 1 if you have the ‘glutCloseFunc’ function.)])
236      AC_CHECK_LIB(glut, glutMainLoopEvent,
237       [ac_cv_my_have_gl="yes"])
238      AC_CHECK_LIB(glut, glutCheckLoop,
239       [ac_cv_my_have_gl="yes"
240        AC_DEFINE(HAVE_GLUTCHECKLOOP, 1, Define to 1 if you have the ‘glutCheckLoop’ function.)])])
241      break])
242  if test "${ac_cv_my_have_gl}" = "yes"; then
243    AC_DEFINE(USE_GL, 1, Define to 1 to activate the OpenGL backend driver)
244    GL_LIBS="${GL_LIBS} -lGL -lGLU -lglut"
245    CACA_DRIVERS="${CACA_DRIVERS} gl"
246  elif test "${enable_gl}" = "yes"; then
247    AC_MSG_ERROR([cannot find OpenGL+FreeGLUT development files])
248  fi
249  PKG_CHECK_MODULES(FTGL, ftgl >= 2.1.3, [FTGL="yes"], [FTGL="no"])
250fi
251AM_CONDITIONAL(USE_FTGL, test "${FTGL}" = "yes")
252
253if test "${enable_cocoa}" != "no"; then
254  ac_cv_my_have_cocoa="no"
255  AC_CHECK_HEADERS(Cocoa/Cocoa.h,
256   [ac_cv_my_have_cocoa="yes"])
257  if test "${ac_cv_my_have_cocoa}" = "yes"; then
258    case x${target} in
259    xpowerpc*darwin*)
260      # 10.3 needed to link with X11
261      MACOSX_SDK="${MACOSX_SDK:-/Developer/SDKs/MacOSX10.3.9.sdk}"
262      GCC_VERSION="${GCC_VERSION:-3.3}"
263      ARCH="${ARCH:--arch ppc}"
264      MACOSX_SDK_CFLAGS="${MACOSX_SDK_CFLAGS:--nostdinc -isystem ${MACOSX_SDK}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOSX_SDK}/usr/include}"
265      MACOSX_SDK_CXXFLAGS="${MACOSX_SDK_CXXFLAGS:--nostdinc++ -I${MACOSX_SDK}/usr/include/gcc/darwin/${GCC_VERSION}/c++ -I${MACOSX_SDK}/usr/include/gcc/darwin/${GCC_VERSION}/c++/ppc-darwin -I${MACOSX_SDK}/usr/include/gcc/darwin/${GCC_VERSION}/c++/backward}"
266      MACOSX_SDK_LDFLAGS="${MACOSX_SDK_LDFLAGS:--L${MACOSX_SDK}/usr/lib/gcc/darwin -L${MACOSX_SDK}/usr/lib/gcc/darwin/${GCC_VERSION} -L${MACOSX_SDK}/usr/lib}"
267      ;;
268    x*86_64*darwin*)
269      MACOSX_SDK="${MACOSX_SDK:-/Developer/SDKs/MacOSX10.5.sdk}"
270      GCC_VERSION="${GCC_VERSION:-4.0}"
271      ARCH="${ARCH:--arch i386}"
272      MACOSX_SDK_CFLAGS="${MACOSX_SDK_CFLAGS:--isysroot ${MACOSX_SDK}}"
273      MACOSX_SDK_CXXFLAGS="${MACOSX_SDK_CXXFLAGS:-${MACOSX_SDK_CFLAGS}}"
274      ;;
275    x*86*darwin*)
276      MACOSX_SDK="${MACOSX_SDK:-/Developer/SDKs/MacOSX10.6.sdk}"
277      GCC_VERSION="${GCC_VERSION:-4.0}"
278      ARCH="${ARCH:--arch i386}"
279      MACOSX_SDK_CFLAGS="${MACOSX_SDK_CFLAGS:--isysroot ${MACOSX_SDK}}"
280      MACOSX_SDK_CXXFLAGS="${MACOSX_SDK_CXXFLAGS:-${MACOSX_SDK_CFLAGS}}"
281      ;;
282    esac
283    CC="${CC:-gcc-${GCC_VERSION}}"
284    CXX="${CXX:-g++-${GCC_VERSION}}"
285    MACOSX_SDK_FRAMEWORKS="${MACOSX_SDK_FRAMEWORKS:--F${MACOSX_SDK}/System/Library/Frameworks}"
286    CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS}"
287    CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS}"
288    CXXFLAGS="${CXXFLAGS} ${MACOSX_SDK_CXXFLAGS}"
289    OBJCFLAGS="${OBJCFLAGS} ${MACOSX_SDK_CFLAGS}"
290    LDFLAGS="${ARCH} ${MACOSX_SDK_LDFLAGS} ${LDFLAGS}"
291    AC_DEFINE(USE_COCOA, 1, Define to 1 to activate the Cocoa backend driver)
292    CACA_LIBS="${CACA_LIBS} -Wl,-syslibroot,${MACOSX_SDK},-framework,Cocoa"
293    CACA_DRIVERS="${CACA_DRIVERS} cocoa"
294  elif test "${enable_cocoa}" = "yes"; then
295    AC_MSG_ERROR([cannot find Cocoa development files])
296  fi
297fi
298AM_CONDITIONAL(USE_COCOA, test "${ac_cv_my_have_cocoa}" = "yes")
299
300if test "${enable_ncurses}" != "no"; then
301  ac_cv_my_have_ncurses="no"
302  AC_CHECK_HEADERS(ncursesw/ncurses.h ncurses/ncurses.h ncurses.h curses.h,
303   [ncurses="no"
304    AC_CHECK_LIB(ncursesw, initscr,
305     [ncurses="-lncursesw"],
306     [AC_CHECK_LIB(ncurses, initscr,
307       [ncurses="-lncurses"])])
308    if test "${ncurses}" = "no"; then
309      continue
310    fi
311    ac_cv_my_have_ncurses="yes"
312    AC_DEFINE(USE_NCURSES, 1, Define to 1 to activate the ncurses backend driver)
313    CACA_LIBS="${CACA_LIBS} ${ncurses}"
314    CACA_DRIVERS="${CACA_DRIVERS} ncurses"
315    dnl  Check for resizeterm or resize_term
316    SAVED_LIBS="${LIBS}"
317    LIBS="${LIBS} ${ncurses}"
318    AC_CHECK_FUNCS(resizeterm resize_term)
319    LIBS="${SAVED_LIBS}"
320    break])
321  if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
322    AC_MSG_ERROR([cannot find ncurses development files])
323  fi
324fi
325
326if test "${enable_vga}" != "no"; then
327  if test "${ac_cv_my_have_kernel}" = "yes"; then
328    AC_DEFINE(USE_VGA, 1, Define to 1 to activate the VGA backend driver)
329    CACA_DRIVERS="${CACA_DRIVERS} vga"
330  elif test "${enable_vga}" = "yes"; then
331    AC_MSG_ERROR([--enable-vga requires --enable-kernel])
332  fi
333fi
334
335if test "${enable_debug}" = "yes"; then
336  AC_DEFINE(DEBUG, 1, Define to 1 to activate debug)
337fi
338
339if test "${enable_profiling}" = "yes"; then
340  AC_DEFINE(PROF, 1, Define to 1 to activate profiling)
341fi
342
343if test "${enable_plugins}" = "yes"; then
344  ac_cv_my_have_plugins="yes"
345  AC_DEFINE(USE_PLUGINS, 1, Define to 1 to activate plugins)
346  CACA_LIBS="${CACA_LIBS} -ldl"
347else
348  CACA_CFLAGS="${CACA_CFLAGS} ${X11_CFLAGS} ${GL_CFLAGS} ${FTGL_CFLAGS}"
349  CACA_LIBS="${CACA_LIBS} ${X11_LIBS} ${GL_LIBS} ${FTGL_LIBS}"
350fi
351AM_CONDITIONAL(USE_PLUGINS, test "${ac_cv_my_have_plugins}" = "yes")
352
353AC_MSG_CHECKING(valid output drivers)
354if test -z "${CACA_DRIVERS}"; then
355  AC_MSG_RESULT(no)
356  AC_MSG_ERROR([no output drivers were selected!])
357else
358  CACA_DRIVERS="${CACA_DRIVERS# *}"
359  AC_MSG_RESULT([${CACA_DRIVERS}])
360fi
361
362AC_SUBST(MATH_LIBS)
363AC_SUBST(ZLIB_LIBS)
364AC_SUBST(GETOPT_LIBS)
365AC_SUBST(CACA_CFLAGS)
366AC_SUBST(CACA_LIBS)
367AC_SUBST(X11_CFLAGS)
368AC_SUBST(X11_LIBS)
369AC_SUBST(GL_CFLAGS)
370AC_SUBST(GL_LIBS)
371
372# How to get the C99 types. See caca/caca_types.h.in for details about
373# the CACA_TYPES variable
374if test "${ac_cv_my_have_kernel}" = "yes"; then
375  CACA_TYPES=0
376else
377  AC_CHECK_HEADERS(stdint.h,
378    [CACA_TYPES=1],
379    [AC_CHECK_HEADERS(inttypes.h,
380      [CACA_TYPES=2],
381      [AC_CHECK_HEADERS(windows.h,
382        [CACA_TYPES=3],
383        [CACA_TYPES=0])])])
384fi
385AC_SUBST(CACA_TYPES)
386
387# Optimizations
388CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
389# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
390CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
391CXXFLAGS="${CXXFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wsign-compare"
392
393CACA_BINDINGS=""
394
395# Build the C++ bindings?
396ac_cv_my_have_cxx="no"
397if test "${enable_cxx}" != "no"; then
398  AC_MSG_CHECKING([working <iostream>])
399  AC_LANG_PUSH(C++)
400  AC_TRY_COMPILE(
401   [#include <iostream>],
402   [],
403   [ac_cv_my_have_cxx="yes"
404    CACA_BINDINGS="${CACA_BINDINGS} C++"])
405  AC_LANG_POP(C++)
406  AC_MSG_RESULT([$ac_cv_my_have_cxx])
407fi
408AM_CONDITIONAL(USE_CXX, test "${ac_cv_my_have_cxx}" = "yes")
409
410# Build the .NET bindings?
411ac_cv_my_have_csharp="no"
412if test "${enable_csharp}" != "no"; then
413  AC_PATH_PROG(CSC, csc, no)
414  if test "$CSC" = "no"; then
415    AC_PATH_PROG(GMCS, gmcs, no)
416    CSC="$GMCS"
417  fi
418  AC_PATH_PROG(GACUTIL, gacutil, no)
419  if test "${CSC}" != "no" -a "${GACUTIL}" != "no"; then
420    ac_cv_my_have_csharp="yes"
421    CACA_BINDINGS="${CACA_BINDINGS} C#"
422  fi
423fi
424AM_CONDITIONAL(USE_CSHARP, test "${ac_cv_my_have_csharp}" = "yes")
425
426# Build the Java bindings?
427ac_cv_my_have_java="no"
428if test "${enable_java}" != "no" -a "${ac_cv_my_have_kernel}" != "yes"; then
429  AC_PATH_PROG(JAVAC, javac, no)
430  AC_PATH_PROG(JAVAH, javah, no)
431  AC_PATH_PROG(JAR, jar, no)
432  if test "${JAVAC}" != "no" -a "${JAVAH}" != "no" -a "${JAR}" != "no"; then
433    if test "$JAVA_HOME" = ""; then
434      # Try to resolve JAVA_HOME
435      JAVAC_EXE="$JAVAC"
436      # Follow symlinks
437      while test -h "$JAVAC_EXE"; do
438        ls=`ls -ld "$JAVAC_EXE"`
439        link=`expr "$ls" : '.*-> \(.*\)$'`
440        if expr "$link" : '/.*' > /dev/null; then
441          JAVAC_EXE="$link"
442        else
443          JAVAC_EXE="`dirname "$JAVAC_EXE"`/$link"
444        fi
445      done
446      JAVA_HOME="`dirname $JAVAC_EXE`/.."
447    fi
448    # Include path to jni.h
449    JAVA_CFLAGS="${JAVA_CFLAGS} -I$JAVA_HOME/include"
450    # Add the OS specific include path
451    for dir in $JAVA_HOME/include/*; do
452      if test -f "$dir/jni_md.h"; then
453        JAVA_CFLAGS="${JAVA_CFLAGS} -I$dir"
454      fi
455    done
456    AC_SUBST(JAVA_CFLAGS)
457    AC_SUBST(JAVA_LIBS)
458    AC_LANG_PUSH(C)
459    CPPFLAGS="${CPPFLAGS} ${JAVA_CFLAGS}"
460    AC_CHECK_HEADERS([jni.h],
461     [ac_cv_my_have_java="yes"
462      CACA_BINDINGS="${CACA_BINDINGS} Java"])
463    AC_LANG_POP(C)
464  fi
465fi
466AM_CONDITIONAL(USE_JAVA, test "${ac_cv_my_have_java}" = "yes")
467
468# Build the Ruby bindings?
469ac_cv_my_have_ruby="no"
470if test "${enable_ruby}" != "no"; then
471  AC_PATH_PROG(RUBY, ruby, no)
472  if test "${RUBY}" != "no"; then
473    RUBY_CFLAGS="-I$(ruby -r rbconfig -e 'print Config::CONFIG@<:@"archdir"@:>@')"
474    RUBY_LIBS="-L$(ruby -r rbconfig -e 'print Config::CONFIG@<:@"libdir"@:>@') -l$(ruby -r rbconfig -e 'print Config::CONFIG@<:@"RUBY_SO_NAME"@:>@')"
475    RUBY_SITEARCHDIR=`ruby -r rbconfig -e 'print Config::CONFIG@<:@"sitearchdir"@:>@'`
476    RUBY_SITELIBDIR=`ruby -r rbconfig -e 'print Config::CONFIG@<:@"sitelibdir"@:>@'`
477    AC_SUBST(RUBY_CFLAGS)
478    AC_SUBST(RUBY_LIBS)
479    AC_SUBST(RUBY_SITEARCHDIR)
480    AC_SUBST(RUBY_SITELIBDIR)
481    CPPFLAGS="${CPPFLAGS} ${RUBY_CFLAGS}"
482    AC_CHECK_HEADERS([ruby.h],
483     [ac_cv_my_have_ruby="yes"
484      CACA_BINDINGS="${CACA_BINDINGS} Ruby"])
485  fi
486fi
487AM_CONDITIONAL(USE_RUBY, test "${ac_cv_my_have_ruby}" = "yes")
488
489AC_MSG_CHECKING(available language bindings)
490if test -z "${CACA_BINDINGS}"; then
491  AC_MSG_RESULT(no)
492else
493  CACA_BINDINGS="${CACA_BINDINGS# *}"
494  AC_MSG_RESULT([${CACA_BINDINGS}])
495fi
496
497# Build cacaserver?
498ac_cv_my_have_network="no"
499AC_CHECK_HEADERS(sys/socket.h,
500 [ac_cv_my_have_network="yes"])
501AM_CONDITIONAL(USE_NETWORK, test "${ac_cv_my_have_network}" = "yes")
502
503# Use Imlib2?
504if test "${enable_imlib2}" != "no"; then
505  PKG_CHECK_MODULES(IMLIB2, imlib2, [IMLIB2="yes"], [IMLIB2="no"])
506  if test "${IMLIB2}" = "yes"; then
507    AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2)
508  fi
509fi
510
511# Build development tools?
512PKG_CHECK_MODULES(PANGOFT2, pangoft2, [PANGOFT2="yes"], [PANGOFT2="no"])
513AM_CONDITIONAL(USE_PANGO, test "${PANGOFT2}" = "yes")
514
515# Build documentation?
516DOXYGEN="no"
517LATEX="no"
518if test "${enable_doc}" != "no"; then
519  AC_PATH_PROG(DOXYGEN, doxygen, no)
520  if test "${DOXYGEN}" != "no"; then
521    # Build LaTeX documentation?
522    AC_PATH_PROG(LATEX, pdflatex, no)
523    AC_PATH_PROG(KPSEWHICH, kpsewhich, no)
524    AC_PATH_PROG(DVIPS, dvips, no)
525    if test "${DVIPS}" = "no" -o "${KPSEWHICH}" = "no"; then
526      LATEX="no"
527    fi
528    if test "${LATEX}" != "no"; then
529      AC_MSG_CHECKING(for a4.sty and a4wide.sty)
530      if "${KPSEWHICH}" a4.sty >/dev/null 2>&1; then
531        if "${KPSEWHICH}" a4wide.sty >/dev/null 2>&1; then
532          AC_MSG_RESULT(yes)
533        else
534          LATEX="no"
535          AC_MSG_RESULT(no)
536        fi
537      else
538        LATEX="no"
539        AC_MSG_RESULT(no)
540      fi
541    fi
542  fi
543fi
544AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
545AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
546
547# Use cppunit for unit tests?
548PKG_CHECK_MODULES(CPPUNIT, cppunit, [CPPUNIT="yes"], [CPPUNIT="no"])
549AM_CONDITIONAL(USE_CPPUNIT, test "$CPPUNIT" = "yes")
550
551# Use zzuf for fuzzing tests?
552ZZUF="no"
553if test "${enable_zzuf}" != "no"; then
554  AC_PATH_PROG(ZZUF, zzuf, no)
555fi
556AM_CONDITIONAL(USE_ZZUF, test "${ZZUF}" != "no")
557
558AC_CONFIG_FILES([
559  Makefile
560  kernel/Makefile
561  caca/Makefile
562  src/Makefile
563  examples/Makefile
564  test/Makefile
565  tools/Makefile
566  java/Makefile
567  caca-sharp/Makefile
568  cxx/Makefile
569  python/Makefile
570  ruby/Makefile
571  doc/Makefile
572  win32/Makefile
573])
574AC_CONFIG_FILES([
575  caca/caca_types.h
576  caca/caca.pc
577  caca-sharp/caca-sharp.dll.config
578  cxx/caca++.pc
579  doc/doxygen.cfg
580])
581AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
582AC_OUTPUT
583
Note: See TracBrowser for help on using the repository browser.