source: libcaca/trunk/configure.ac @ 4679

Last change on this file since 4679 was 4679, checked in by Sam Hocevar, 9 years ago

Set version to 0.99beta18.

  • Property svn:keywords set to Id
File size: 19.7 KB
Line 
1
2AC_INIT(libcaca, 0.99.beta18)
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
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 Python bindings?
469ac_cv_my_have_python="no"
470if test "${enable_python}" != "no"; then
471  AM_PATH_PYTHON(2.2, ac_cv_my_have_python="yes", :)
472fi
473AM_CONDITIONAL(USE_PYTHON, test "${ac_cv_my_have_python}" = "yes")
474
475# Build the Ruby bindings?
476ac_cv_my_have_ruby="no"
477if test "${enable_ruby}" != "no"; then
478  AC_PATH_PROG(RUBY, ruby, no)
479  if test "${RUBY}" != "no"; then
480    RUBY_CFLAGS="-I$(ruby -r rbconfig -e 'print Config::CONFIG@<:@"archdir"@:>@')"
481    RUBY_LIBS="-L$(ruby -r rbconfig -e 'print Config::CONFIG@<:@"libdir"@:>@') -l$(ruby -r rbconfig -e 'print Config::CONFIG@<:@"RUBY_SO_NAME"@:>@')"
482    RUBY_SITEARCHDIR=`ruby -r rbconfig -e 'print Config::CONFIG@<:@"sitearchdir"@:>@'`
483    RUBY_SITELIBDIR=`ruby -r rbconfig -e 'print Config::CONFIG@<:@"sitelibdir"@:>@'`
484    AC_SUBST(RUBY_CFLAGS)
485    AC_SUBST(RUBY_LIBS)
486    AC_SUBST(RUBY_SITEARCHDIR)
487    AC_SUBST(RUBY_SITELIBDIR)
488    CPPFLAGS="${CPPFLAGS} ${RUBY_CFLAGS}"
489    AC_CHECK_HEADERS([ruby.h],
490     [ac_cv_my_have_ruby="yes"
491      CACA_BINDINGS="${CACA_BINDINGS} Ruby"])
492  fi
493fi
494AM_CONDITIONAL(USE_RUBY, test "${ac_cv_my_have_ruby}" = "yes")
495
496AC_MSG_CHECKING(available language bindings)
497if test -z "${CACA_BINDINGS}"; then
498  AC_MSG_RESULT(no)
499else
500  CACA_BINDINGS="${CACA_BINDINGS# *}"
501  AC_MSG_RESULT([${CACA_BINDINGS}])
502fi
503
504# Build cacaserver?
505ac_cv_my_have_network="no"
506AC_CHECK_HEADERS(sys/socket.h,
507 [ac_cv_my_have_network="yes"])
508AM_CONDITIONAL(USE_NETWORK, test "${ac_cv_my_have_network}" = "yes")
509
510# Use Imlib2?
511if test "${enable_imlib2}" != "no"; then
512  PKG_CHECK_MODULES(IMLIB2, imlib2, [IMLIB2="yes"], [IMLIB2="no"])
513  if test "${IMLIB2}" = "yes"; then
514    AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2)
515  fi
516fi
517
518# Build development tools?
519PKG_CHECK_MODULES(PANGOFT2, pangoft2, [PANGOFT2="yes"], [PANGOFT2="no"])
520AM_CONDITIONAL(USE_PANGO, test "${PANGOFT2}" = "yes")
521
522# Build documentation?
523DOXYGEN="no"
524LATEX="no"
525if test "${enable_doc}" != "no"; then
526  AC_PATH_PROG(DOXYGEN, doxygen, no)
527  if test "${DOXYGEN}" != "no"; then
528    # Build LaTeX documentation?
529    AC_PATH_PROG(LATEX, pdflatex, no)
530    AC_PATH_PROG(KPSEWHICH, kpsewhich, no)
531    AC_PATH_PROG(DVIPS, dvips, no)
532    if test "${DVIPS}" = "no" -o "${KPSEWHICH}" = "no"; then
533      LATEX="no"
534    fi
535    if test "${LATEX}" != "no"; then
536      AC_MSG_CHECKING(for a4.sty and a4wide.sty)
537      if "${KPSEWHICH}" a4.sty >/dev/null 2>&1; then
538        if "${KPSEWHICH}" a4wide.sty >/dev/null 2>&1; then
539          AC_MSG_RESULT(yes)
540        else
541          LATEX="no"
542          AC_MSG_RESULT(no)
543        fi
544      else
545        LATEX="no"
546        AC_MSG_RESULT(no)
547      fi
548    fi
549  fi
550fi
551AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no")
552AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no")
553
554# Use cppunit for unit tests?
555PKG_CHECK_MODULES(CPPUNIT, cppunit, [CPPUNIT="yes"], [CPPUNIT="no"])
556AM_CONDITIONAL(USE_CPPUNIT, test "$CPPUNIT" = "yes")
557
558# Use zzuf for fuzzing tests?
559ZZUF="no"
560if test "${enable_zzuf}" != "no"; then
561  AC_PATH_PROG(ZZUF, zzuf, no)
562fi
563AM_CONDITIONAL(USE_ZZUF, test "${ZZUF}" != "no")
564
565AC_CONFIG_FILES([
566  Makefile
567  kernel/Makefile
568  caca/Makefile
569  src/Makefile
570  examples/Makefile
571  test/Makefile
572  tools/Makefile
573  java/Makefile
574  caca-sharp/Makefile
575  cxx/Makefile
576  python/Makefile
577  ruby/Makefile
578  doc/Makefile
579  win32/Makefile
580])
581AC_CONFIG_FILES([
582  caca/caca_types.h
583  caca/caca.pc
584  caca-sharp/caca-sharp.dll.config
585  cxx/caca++.pc
586  doc/doxygen.cfg
587])
588AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
589AC_OUTPUT
590
Note: See TracBrowser for help on using the repository browser.