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