source: libcaca/trunk/configure.ac @ 4410

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

New improved ctypes-based Python bindings, by Alex Foulon <alxf@lavabit.com>.

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