source: libcaca/trunk/configure.ac @ 4340

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

Large source code cleanup, getting rid of spaces, tabs, and svn keywords.

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