source: libcaca/trunk/configure.ac @ 4219

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

Java bindings, courtesy of Adrien Grand <jpountz@dinauz.org>.

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