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