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