| 1 | dnl ============================================================== |
| 2 | dnl Process this file with autoconf to produce a configure script. |
| 3 | dnl ============================================================== |
| 4 | |
| 5 | dnl require autoconf 2.62 (AS_ECHO/AS_ECHO_N) |
| 6 | AC_PREREQ([2.62]) |
| 7 | |
| 8 | AC_INIT([FreeJ],[0.11.0],[freej@lists.dyne.org],[freej]) |
| 9 | AC_CONFIG_MACRO_DIR([m4]) |
| 10 | |
| 11 | AC_CANONICAL_HOST |
| 12 | |
| 13 | dnl backwards compatibility for autoconf >= 2.64 |
| 14 | dnl PACKAGE_URL should be the fifth argument of AC_INIT |
| 15 | m4_define([AC_PACKAGE_URL], [http://freej.dyne.org]) |
| 16 | AC_DEFINE(PACKAGE_URL, "AC_PACKAGE_URL", [Package URL]) |
| 17 | AC_SUBST(PACKAGE_URL, AC_PACKAGE_URL) |
| 18 | |
| 19 | dnl ============================================================== |
| 20 | dnl Get the operating system and version number... |
| 21 | dnl ============================================================== |
| 22 | AC_MSG_CHECKING([for which platform we are compiling]) |
| 23 | case "$host_cpu" in |
| 24 | powerpc*) |
| 25 | have_ppc=yes |
| 26 | ;; |
| 27 | x86_64*) |
| 28 | have_x86_64=yes |
| 29 | ;; |
| 30 | i*86*) |
| 31 | have_x86_32=yes |
| 32 | ;; |
| 33 | esac |
| 34 | |
| 35 | case "$host_os" in |
| 36 | *linux*) |
| 37 | AC_MSG_RESULT([Linux]) |
| 38 | AC_DEFINE(HAVE_LINUX,1,[define if compiling for Linux]) |
| 39 | DL_LIBS="-ldl" |
| 40 | have_linux=yes |
| 41 | |
| 42 | if test x$have_ppc = xyes; then |
| 43 | AC_DEFINE(ARCH_PPC,1,[define if compiling for Linux/PPC]) |
| 44 | AC_DEFINE(ARCH_POWERPC,1,[define if compiling for Linux/PPC]) |
| 45 | dnl TODO(godog) what about ppc64? |
| 46 | AC_DEFINE(POWERPC_MODE_32BITS,1,[define if compiling for PPC]) |
| 47 | AC_DEFINE(HAVE_ALTIVEC,1,[define if cpu supports Altivec instruction set]) |
| 48 | AC_DEFINE(HAVE_ALTIVEC_H,1,[define if cpu supports Altivec instruction set]) |
| 49 | AC_DEFINE(WORDS_BIGENDIAN,1,[define if compiling for Big Endian CPU]) |
| 50 | AC_DEFINE(PA_BIG_ENDIAN,1,[define big endian arch for portaudio]) |
| 51 | dnl AC_DEFINE(SDL_BYTEORDER,SDL_BIG_ENDIAN,[define big endian arch for SDL]) |
| 52 | fi |
| 53 | |
| 54 | if test x$have_x86_64 = xyes; then |
| 55 | AC_DEFINE(ARCH_X86,1,[define if compiling for Linux/x86]) |
| 56 | AC_DEFINE(HAVE_64BIT,1,[define if host has 64 bit]) |
| 57 | fi |
| 58 | |
| 59 | if test x$have_x86_32 = xyes; then |
| 60 | AC_DEFINE(ARCH_X86,1,[define if compiling for Linux/x86]) |
| 61 | AC_DEFINE(PA_LITTLE_ENDIAN,1,[define little endian arch for portaudio]) |
| 62 | dnl AC_DEFINE(SDL_BYTEORDER,SDL_LIL_ENDIAN,[define little endian arch for SDL]) |
| 63 | fi |
| 64 | ;; |
| 65 | |
| 66 | *darwin*) |
| 67 | AC_MSG_RESULT([Darwin/OSX]) |
| 68 | AC_DEFINE(HAVE_DARWIN,1,[define if compiling for Apple Darwin OSX]) |
| 69 | have_darwin=yes |
| 70 | ;; |
| 71 | |
| 72 | *freebsd*) |
| 73 | AC_MSG_RESULT([FreeBSD]) |
| 74 | AC_DEFINE(HAVE_FREEBSD,1,[define if compiling for FreeBSD]) |
| 75 | AC_DEFINE(HAVE_SYS_SOCKET_H,1,[define if compiling for FreeBSD]) |
| 76 | GLOBAL_CFLAGS="$GLOBAL_CFLAGS -I/usr/local/include -L/usr/local/lib" |
| 77 | have_freebsd=yes |
| 78 | ;; |
| 79 | |
| 80 | *) |
| 81 | AC_MSG_RESULT([$host_os?!]) |
| 82 | AC_MSG_ERROR([[ |
| 83 | [!] Your system architecture is not supported by FreeJ |
| 84 | [!] if you are interested in porting FreeJ to your architecture |
| 85 | [!] you are very welcome to contact me <jaromil@dyne.org> |
| 86 | ]], 0) |
| 87 | ;; |
| 88 | esac |
| 89 | |
| 90 | |
| 91 | dnl ============================================================== |
| 92 | dnl Setup for automake |
| 93 | dnl ============================================================== |
| 94 | |
| 95 | AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects]) |
| 96 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 97 | |
| 98 | AC_CONFIG_SRCDIR([src/freej.cpp]) |
| 99 | AC_CONFIG_HEADERS([config.h]) |
| 100 | |
| 101 | dnl never run autotools and configure automatically |
| 102 | dnl AM_MAINTAINER_MODE |
| 103 | |
| 104 | dnl Checks for programs. |
| 105 | AC_PROG_CXX |
| 106 | AC_PROG_AWK |
| 107 | AC_PROG_CC |
| 108 | AC_PROG_CPP |
| 109 | AC_PROG_INSTALL |
| 110 | AC_PROG_LN_S |
| 111 | AC_PROG_MAKE_SET |
| 112 | AM_PROG_AS |
| 113 | dnl compatibility with older libtool |
| 114 | m4_ifndef([LT_INIT], [AC_PROG_RANLIB]) |
| 115 | |
| 116 | |
| 117 | dnl Checks for header files. |
| 118 | AC_PATH_X |
| 119 | AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h memory.h stdint.h stdlib.h \ |
| 120 | string.h strings.h sys/file.h sys/ioctl.h sys/time.h termios.h unistd.h]) |
| 121 | |
| 122 | dnl Checks for typedefs, structures, and compiler characteristics. |
| 123 | AC_HEADER_STDBOOL |
| 124 | AC_C_INLINE |
| 125 | AC_TYPE_INT16_T |
| 126 | AC_TYPE_INT32_T |
| 127 | AC_TYPE_INT64_T |
| 128 | AC_TYPE_INT8_T |
| 129 | AC_TYPE_SIZE_T |
| 130 | AC_TYPE_UINT16_T |
| 131 | AC_TYPE_UINT32_T |
| 132 | AC_TYPE_UINT64_T |
| 133 | AC_TYPE_UINT8_T |
| 134 | |
| 135 | dnl Checks for library functions. |
| 136 | AC_FUNC_ERROR_AT_LINE |
| 137 | AC_FUNC_FORK |
| 138 | AC_FUNC_MALLOC |
| 139 | AC_FUNC_MMAP |
| 140 | AC_FUNC_REALLOC |
| 141 | AC_CHECK_FUNCS([bzero floor gettimeofday memmove memset munmap rint select \ |
| 142 | setenv strcasecmp strdup strerror strncasecmp strrchr strstr]) |
| 143 | |
| 144 | dnl compatibility with older libtool |
| 145 | m4_ifdef([LT_INIT], |
| 146 | [LT_INIT([disable-static dlopen])], |
| 147 | [AC_LIBTOOL_DLOPEN |
| 148 | AC_DISABLE_STATIC |
| 149 | AC_PROG_LIBTOOL]) |
| 150 | |
| 151 | dnl versioning info for libtool |
| 152 | FREEJ_CURRENT=0 |
| 153 | FREEJ_REVISION=0 |
| 154 | FREEJ_AGE=0 |
| 155 | FREEJ_VERSION_INFO="$FREEJ_CURRENT:$FREEJ_REVISION:$FREEJ_AGE" |
| 156 | dnl Note this is the ABI version which is not the same as our actual |
| 157 | dnl library version |
| 158 | AC_SUBST(FREEJ_VERSION_INFO) |
| 159 | |
| 160 | |
| 161 | dnl ============================================================== |
| 162 | dnl check for swig and whether to enable bindings |
| 163 | dnl ============================================================== |
| 164 | AC_PROG_SWIG([1.3]) |
| 165 | SWIG_ENABLE_CXX |
| 166 | |
| 167 | if test -z "$SWIG_LIB"; then |
| 168 | have_swig=no |
| 169 | |
| 170 | AC_MSG_WARN([No language bindings will be created]) |
| 171 | else |
| 172 | have_swig=yes |
| 173 | |
| 174 | SWIG_COMMAND='$(SWIG) -c++ -O -Wall -I$(top_builddir) -I$(top_srcdir)/src/include -I$(top_builddir)/doc' |
| 175 | AC_SUBST(SWIG_COMMAND) |
| 176 | SWIG_IFACE='$(top_srcdir)/bindings/freej.i' |
| 177 | AC_SUBST(SWIG_IFACE) |
| 178 | |
| 179 | ENABLE_SWIG_PYTHON |
| 180 | ENABLE_SWIG_RUBY |
| 181 | ENABLE_SWIG_JAVA |
| 182 | ENABLE_SWIG_PERL |
| 183 | |
| 184 | if test x$enable_perl = xyes; then |
| 185 | AC_CHECK_FUNCS([strtoul]) |
| 186 | AC_FUNC_STRTOD |
| 187 | fi |
| 188 | fi |
| 189 | |
| 190 | AM_CONDITIONAL([BUILD_SWIG_PYTHON], [test x$enable_python = xyes]) |
| 191 | AM_CONDITIONAL([BUILD_SWIG_RUBY], [test x$enable_ruby = xyes]) |
| 192 | AM_CONDITIONAL([BUILD_SWIG_JAVA], [test x$enable_java = xyes]) |
| 193 | AM_CONDITIONAL([BUILD_SWIG_PERL], [test x$enable_perl = xyes]) |
| 194 | |
| 195 | dnl swig not found but bindings requested is fatal |
| 196 | if test x$have_swig = xno && { |
| 197 | test x$enable_python = xyes || |
| 198 | test x$enable_java = xyes || |
| 199 | test x$enable_ruby = xyes || |
| 200 | test x$enable_perl = xyes |
| 201 | }; then |
| 202 | AC_MSG_ERROR([*** bindings requested but swig not found!]) |
| 203 | fi |
| 204 | |
| 205 | if test x$enable_python = xyes; then |
| 206 | AC_CHECK_PROG([DOXYGEN], [doxygen], [doxygen]) |
| 207 | if test -z "$DOXYGEN"; then |
| 208 | AC_MSG_ERROR([*** Doxygen is required to build python docstrings.]) |
| 209 | fi |
| 210 | fi |
| 211 | |
| 212 | dnl ============================================================== |
| 213 | dnl Add the local include path and some flags |
| 214 | dnl ============================================================== |
| 215 | dnl -freg-struct-return is to compile an host compatible with freeframe dso |
| 216 | GLOBAL_CFLAGS="$GLOBAL_CFLAGS -pipe -D_REENTRANT -freg-struct-return -fPIC" |
| 217 | if test x$have_darwin = xyes; then |
| 218 | dnl add the fink default path to find headers |
| 219 | GLOBAL_CFLAGS="$GLOBAL_CFLAGS -I/sw/include" |
| 220 | fi |
| 221 | |
| 222 | dnl ============================================================== |
| 223 | dnl Check for slang |
| 224 | dnl ============================================================== |
| 225 | PKG_CHECK_MODULES([SLANG], [slang], [have_slang=yes], [have_slang=no]) |
| 226 | if test x$have_slang = xno; then |
| 227 | SLANG_CFLAGS="-I/usr/include/slang" |
| 228 | SLANG_LIBS="-lslang" |
| 229 | FREEJ_SAVE_FLAGS |
| 230 | CFLAGS="$SLANG_CFLAGS" |
| 231 | CPPFLAGS="$SLANG_CFLAGS" |
| 232 | LDFLAGS="" |
| 233 | FREEJ_CHECK_LIB_HEADER([slang], [SLang_getkey], [slang.h], |
| 234 | [have_slang=yes], [have_slang=no]) |
| 235 | FREEJ_RESTORE_FLAGS |
| 236 | fi |
| 237 | if test x$have_slang = xno; then |
| 238 | AC_MSG_ERROR([*** SLANG development files not found!]) |
| 239 | fi |
| 240 | |
| 241 | dnl Check for GD |
| 242 | GD_LIBS="" |
| 243 | FREEJ_CHECK_LIB_HEADER([gd], [gdImageCreateTrueColor], [gd.h], |
| 244 | [have_gd=yes], [have_gd=no]) |
| 245 | if test x$have_gd = xyes; then |
| 246 | GD_LIBS="-lgd" |
| 247 | AC_DEFINE(WITH_GD,1,[define if compiling with GD to support screenshot taking]) |
| 248 | AC_SUBST([GD_LIBS]) |
| 249 | fi |
| 250 | |
| 251 | dnl ============================================================== |
| 252 | dnl Check for SDL |
| 253 | dnl ============================================================== |
| 254 | PKG_CHECK_MODULES(SDL, sdl > 1.2, :, |
| 255 | AC_MSG_ERROR([*** SDL development files not found!])) |
| 256 | |
| 257 | |
| 258 | dnl ============================================================== |
| 259 | dnl Check OGG VORBIS THEORA |
| 260 | dnl ============================================================== |
| 261 | PKG_CHECK_MODULES(OGG, ogg >= 1.1, :, |
| 262 | AC_MSG_ERROR([*** Ogg >=1.1 development files not found!])) |
| 263 | PKG_CHECK_MODULES(VORBIS, vorbis, :, |
| 264 | AC_MSG_ERROR([*** Vorbis development files not found!])) |
| 265 | PKG_CHECK_MODULES(VORBISENC, vorbisenc, :, |
| 266 | AC_MSG_ERROR([*** Vorbisenc development files not found!])) |
| 267 | PKG_CHECK_MODULES(THEORA, theora, :, |
| 268 | AC_MSG_ERROR([*** Theora development files not found!])) |
| 269 | XIPH_CFLAGS="$OGG_CFLAGS $VORBIS_CFLAGS $VORBISENC_CFLAGS $THEORA_CFLAGS" |
| 270 | XIPH_LIBS="$OGG_LIBS $VORBIS_LIBS $VORBISENC_LIBS $THEORA_LIBS" |
| 271 | AC_SUBST([XIPH_CFLAGS]) |
| 272 | AC_SUBST([XIPH_LIBS]) |
| 273 | |
| 274 | dnl TODO(shammash): heritage from conditional build, still used somewhere. |
| 275 | AC_DEFINE(WITH_OGGTHEORA,1,[define if compiling with Ogg/Theora encoding]) |
| 276 | |
| 277 | |
| 278 | dnl ============================================================== |
| 279 | dnl FFMPEG DYNAMIC |
| 280 | dnl ============================================================== |
| 281 | PKG_CHECK_MODULES(AVCODEC, libavcodec, :, |
| 282 | AC_MSG_ERROR([*** Libavcodec development files not found!])) |
| 283 | PKG_CHECK_MODULES(AVFORMAT, libavformat, :, |
| 284 | AC_MSG_ERROR([*** Libavformat development files not found!])) |
| 285 | PKG_CHECK_MODULES(AVUTIL, libavutil, :, |
| 286 | AC_MSG_ERROR([*** Libavutil development files not found!])) |
| 287 | PKG_CHECK_MODULES(SWSCALE, libswscale, :, |
| 288 | AC_MSG_ERROR([*** Libswscale development files not found!])) |
| 289 | FFMPEG_CFLAGS="$AVCODEC_CFLAGS $AVFORMAT_CFLAGS $AVUTIL_CFLAGS $SWSCALE_CFLAGS" |
| 290 | FFMPEG_LIBS="$AVCODEC_LIBS $AVFORMAT_LIBS $AVUTIL_LIBS $SWSCALE_LIBS" |
| 291 | AC_SUBST([FFMPEG_CFLAGS]) |
| 292 | AC_SUBST([FFMPEG_LIBS]) |
| 293 | |
| 294 | dnl FFmpeg changed include path policy, let's check which one is in use. |
| 295 | FREEJ_SAVE_FLAGS |
| 296 | CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS" |
| 297 | CFLAGS="$CFLAGS $FFMPEG_CFLAGS" |
| 298 | AC_CHECK_HEADERS(libavcodec/avcodec.h ffmpeg/avcodec.h) |
| 299 | AC_CHECK_HEADERS(libavformat/avformat.h ffmpeg/avformat.h) |
| 300 | AC_CHECK_HEADERS(libavutil/avutil.h ffmpeg/avutil.h) |
| 301 | AC_CHECK_HEADERS(libswscale/swscale.h ffmpeg/swscale.h) |
| 302 | FREEJ_RESTORE_FLAGS |
| 303 | dnl Then in sources we have to include in the following way: |
| 304 | dnl #ifdef HAVE_LIBAVCODEC_AVCODEC_H |
| 305 | dnl # include <libavcodec/avcodec.h> |
| 306 | dnl #elif defined(HAVE_FFMPEG_AVCODEC_H) |
| 307 | dnl # include <ffmpeg/avcodec.h> |
| 308 | dnl #else |
| 309 | dnl # include <avcodec.h> |
| 310 | dnl #endif |
| 311 | |
| 312 | dnl TODO(shammash): heritage from conditional build, still used somewhere. |
| 313 | AC_DEFINE(WITH_FFMPEG,1, [define if compiling movie layer linking to ffmpeg libavcodec]) |
| 314 | AC_DEFINE(WITH_SWSCALE,1, [define if using new swscale library from ffmpeg]) |
| 315 | |
| 316 | |
| 317 | dnl ============================================================== |
| 318 | dnl LIBLO |
| 319 | dnl ============================================================== |
| 320 | PKG_CHECK_MODULES([LIBLO], [liblo], [:], |
| 321 | AC_MSG_ERROR([*** Liblo development files not found!])) |
| 322 | |
| 323 | |
| 324 | dnl ============================================================== |
| 325 | dnl shout lib |
| 326 | dnl ============================================================== |
| 327 | PKG_CHECK_MODULES([SHOUT], [shout], [:], |
| 328 | AC_MSG_ERROR([*** Libshout development files not found!])) |
| 329 | |
| 330 | |
| 331 | dnl ============================================================== |
| 332 | dnl Font handling (text layer) |
| 333 | dnl ============================================================== |
| 334 | PKG_CHECK_MODULES(FT2, freetype2, |
| 335 | have_freetype2=yes, have_freetype2=no) |
| 336 | PKG_CHECK_MODULES(FC, fontconfig, |
| 337 | have_fontconfig=yes, have_fontconfig=no) |
| 338 | if test x$have_freetype2 = xyes && test x$have_fontconfig = xyes; then |
| 339 | have_textlayer=yes |
| 340 | AC_DEFINE(WITH_TEXTLAYER,1,[define if having fontconfig and freetype]) |
| 341 | fi |
| 342 | |
| 343 | |
| 344 | dnl ============================================================== |
| 345 | dnl Check X11 for xgrab |
| 346 | dnl ============================================================== |
| 347 | PKG_CHECK_MODULES(X11, x11, have_xgrab=yes, have_xgrab=no) |
| 348 | if test x$have_xgrab = xyes; then |
| 349 | AC_DEFINE(WITH_XGRAB,1,[define if using xgrab layer]) |
| 350 | AC_DEFINE(WITH_XSCREENSAVER,1,[define if using xscreensaver layer]) |
| 351 | fi |
| 352 | |
| 353 | |
| 354 | dnl ============================================================== |
| 355 | dnl ENABLE LIBFLASH |
| 356 | dnl ============================================================== |
| 357 | AC_ARG_ENABLE(flash, |
| 358 | AS_HELP_STRING([--enable-flash],[compile with Flash animation layer (yes)]), |
| 359 | [have_flash=$enableval], |
| 360 | [have_flash=yes]) |
| 361 | AC_MSG_CHECKING([flash - v3 animation only - layer]) |
| 362 | if test x$have_flash = xyes; then |
| 363 | AC_MSG_RESULT(yes) |
| 364 | AC_CHECK_FUNCS([sqrt]) |
| 365 | AC_DEFINE(WITH_FLASH,1,[define if compiling flash layer]) |
| 366 | FLASH_LIBS="\$(top_builddir)/lib/flash/libflash.la" |
| 367 | FLASH_CFLAGS="-I\$(top_srcdir)/lib/flash" |
| 368 | else |
| 369 | AC_MSG_RESULT(no) |
| 370 | fi |
| 371 | AM_CONDITIONAL(BUILD_FLASH, [test x$have_flash = xyes]) |
| 372 | AC_SUBST(FLASH_LIBS) |
| 373 | AC_SUBST(FLASH_CFLAGS) |
| 374 | |
| 375 | |
| 376 | dnl ============================================================== |
| 377 | dnl CHECK if there is CWIID |
| 378 | dnl ============================================================== |
| 379 | PKG_CHECK_MODULES(CWIID, cwiid, have_cwiid=yes, have_cwiid=no) |
| 380 | if test x$have_cwiid = xno; then |
| 381 | FREEJ_CHECK_LIB_HEADER([cwiid], [cwiid_open], [cwiid.h], |
| 382 | [have_cwiid=yes], [have_cwiid=no]) |
| 383 | fi |
| 384 | if test x$have_cwiid = xyes; then |
| 385 | CWIID_CFLAGS="" |
| 386 | CWIID_LIBS="-lcwiid" |
| 387 | AC_DEFINE(WITH_CWIID,1,[define if compiling cwiid WiiMote controller]) |
| 388 | fi |
| 389 | |
| 390 | |
| 391 | dnl ============================================================== |
| 392 | dnl CHECK if there is VIDEO4LINUX |
| 393 | dnl ============================================================== |
| 394 | AC_CHECK_HEADERS([linux/videodev.h], [have_videodev=yes], [have_videodev=no]) |
| 395 | AC_ARG_ENABLE(v4l, |
| 396 | AS_HELP_STRING([--enable-v4l],[compile with Video4Linux Layer (autodetect)]), |
| 397 | [enable_v4l=$enableval], |
| 398 | [enable_v4l=autodetect]) |
| 399 | |
| 400 | if test x$have_videodev = xno && test x$enable_v4l = xyes; then |
| 401 | AC_MSG_ERROR([*** v4l enabled but header videodev.h not found!]) |
| 402 | fi |
| 403 | |
| 404 | if test x$have_videodev = xyes && { |
| 405 | test x$enable_v4l = xyes || |
| 406 | test x$enable_v4l = xautodetect |
| 407 | }; then |
| 408 | AC_DEFINE(WITH_V4L,1,[define if compiling video4linux layer]) |
| 409 | fi |
| 410 | |
| 411 | dnl ============================================================== |
| 412 | dnl compile with full warnings and debugging symbols |
| 413 | dnl ============================================================== |
| 414 | AC_ARG_ENABLE(debug, |
| 415 | AS_HELP_STRING([--enable-debug],[compile with debug symbols (no)]), |
| 416 | [enable_debug=$enableval], |
| 417 | [enable_debug=no]) |
| 418 | |
| 419 | if test x$enable_debug = xyes; then |
| 420 | GLOBAL_CFLAGS="$GLOBAL_CFLAGS -Wall -g -ggdb" |
| 421 | fi |
| 422 | |
| 423 | |
| 424 | dnl ============================================================================== |
| 425 | dnl CHECK to use profiling flags when compiling, for execution analysis with gprof |
| 426 | dnl ============================================================================== |
| 427 | AC_ARG_ENABLE(profiling, |
| 428 | AS_HELP_STRING([--enable-profiling],[compile using gprof flags for execution analysis (no)]), |
| 429 | [enable_profiling=$enableval], |
| 430 | [enable_profiling=no]) |
| 431 | |
| 432 | if test x$enable_profiling = xyes; then |
| 433 | GLOBAL_CFLAGS="$GLOBAL_CFLAGS -pg" |
| 434 | fi |
| 435 | |
| 436 | |
| 437 | dnl ============================================================== |
| 438 | dnl CHECK to use processor specific optimizations to compile |
| 439 | dnl ============================================================== |
| 440 | AC_ARG_ENABLE(cpuflags, |
| 441 | AS_HELP_STRING([--enable-cpuflags],[compile with advanced cpu instructions (yes)]), |
| 442 | [enable_cpuflags=$enableval], |
| 443 | [enable_cpuflags=yes]) |
| 444 | |
| 445 | if test x$enable_cpuflags = xyes; then |
| 446 | if test x$have_linux = xyes; then |
| 447 | if grep "^flags.* mmx" /proc/cpuinfo > /dev/null; then |
| 448 | have_mmx=yes |
| 449 | AC_DEFINE(HAVE_MMX,1,[define if enabling MMX acceleration]) |
| 450 | fi |
| 451 | if grep "^flags.* sse" /proc/cpuinfo > /dev/null; then |
| 452 | have_sse=yes |
| 453 | AC_DEFINE(HAVE_SSE,1,[define if enabling SSE acceleration]) |
| 454 | fi |
| 455 | if grep "^flags.* sse2" /proc/cpuinfo > /dev/null; then |
| 456 | have_sse=yes |
| 457 | AC_DEFINE(HAVE_SSE2,1,[define if enabling SSE2 acceleration]) |
| 458 | fi |
| 459 | if grep "^flags.* ssse3" /proc/cpuinfo > /dev/null; then |
| 460 | have_ssse3=yes |
| 461 | AC_DEFINE(HAVE_SSSE3,1,[define if enabling SSSE3 acceleration]) |
| 462 | fi |
| 463 | fi |
| 464 | if test x$have_freebsd = xyes; then |
| 465 | if sysctl -n hw.instruction_sse; then |
| 466 | dnl XXX(godog) is this MMX or SSE? |
| 467 | have_mmx=yes |
| 468 | AC_DEFINE(HAVE_MMX,1,[define if enabling MMX acceleration]) |
| 469 | fi |
| 470 | fi |
| 471 | fi |
| 472 | |
| 473 | AC_ARG_ENABLE(lubrication, |
| 474 | AS_HELP_STRING([--enable-lubrication],[compile using processor lubricants (yes)]), |
| 475 | [enable_lubrication=$enableval], |
| 476 | [enable_lubrication=yes]) |
| 477 | |
| 478 | dnl XXX(godog) integrate with AX_GCC_ARCHFLAG |
| 479 | if test x$enable_lubrication = xyes; then |
| 480 | if test x$enable_profiling = xyes || test x$enable_debug = xyes; then |
| 481 | AC_MSG_WARN([cannot lubricate code if debug or profiling are enabled]) |
| 482 | enable_lubrication=no |
| 483 | else |
| 484 | if test x$have_darwin = xyes; then |
| 485 | if test x$have_ppc = xyes; then |
| 486 | dnl use optimization flags for darwin |
| 487 | GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O2 -mabi=altivec -maltivec -mpowerpc-gfxopt" |
| 488 | else |
| 489 | GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O2 -mfpmath=sse -mtune=pentium4" |
| 490 | fi |
| 491 | dnl adding these provoke 'illegal instruction' errors in some |
| 492 | dnl ppc/gcc combinations: -mpowerpc-gfxopt -faltivec" |
| 493 | elif test x$have_ppc = xyes; then |
| 494 | GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O2 -fomit-frame-pointer -ffast-math -mabi=altivec -maltivec -mpowerpc-gfxopt" |
| 495 | elif test x$have_x86_64 = xyes; then |
| 496 | dnl should complete this with all 64bit CPUs (AMD too) |
| 497 | if test x$have_ssse3 = xyes; then |
| 498 | dnl multiple core cpu |
| 499 | GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O2 -mfpmath=sse -mtune=core2" |
| 500 | else |
| 501 | dnl single core 64bit cpu |
| 502 | GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O2 -mfpmath=sse -mtune=nocona" |
| 503 | fi |
| 504 | else |
| 505 | dnl any other platform optimizations |
| 506 | AC_MSG_WARN([no special optimisation flags found for your cpu]) |
| 507 | AC_MSG_WARN([please suggest some on our mailinglist if you know better!]) |
| 508 | GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O2" |
| 509 | fi |
| 510 | fi |
| 511 | else |
| 512 | if test x$enable_profiling = xno && test x$enable_debug = xno; then |
| 513 | AC_MSG_NOTICE([enabling generic compiler optimizations]) |
| 514 | GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O2" |
| 515 | fi |
| 516 | fi |
| 517 | |
| 518 | dnl ============================================================== |
| 519 | dnl CHECK if we have aalib |
| 520 | dnl ============================================================== |
| 521 | FREEJ_CHECK_LIB_HEADER([aa], [aa_init], [aalib.h], [have_aa=yes], [have_aa=no]) |
| 522 | if test x$have_aa = xyes; then |
| 523 | AC_DEFINE(WITH_AALIB,1,[define if to compile aalib ascii screen]) |
| 524 | AA_CFLAGS="" |
| 525 | AA_LIBS="-laa" |
| 526 | fi |
| 527 | AC_SUBST(AA_CFLAGS) |
| 528 | AC_SUBST(AA_LIBS) |
| 529 | |
| 530 | |
| 531 | |
| 532 | dnl ============================================================== |
| 533 | dnl CHECK TO USE OPENGL VIDEO OUTPUT |
| 534 | dnl ============================================================== |
| 535 | AC_ARG_ENABLE(opengl, |
| 536 | AS_HELP_STRING([--enable-opengl],[experimental opengl rendering (no)]), |
| 537 | [enable_opengl=$enableval], |
| 538 | [enable_opengl=no]) |
| 539 | |
| 540 | if test x$enable_opengl = xyes; then |
| 541 | dnl note: checking for GLU only, this brings in also GL |
| 542 | PKG_CHECK_MODULES(GLU, glu, |
| 543 | have_glu=yes, have_glu=no) |
| 544 | |
| 545 | dnl pkg-config failed, try headers |
| 546 | if test x$have_glu = xno; then |
| 547 | FREEJ_CHECK_LIB_HEADER([GLU], [gluNewQuadric], [GL/glu.h], |
| 548 | [have_glu=yes], [have_glu=no]) |
| 549 | if test x$have_glu = xyes; then |
| 550 | GLU_LIBS="-lGL -lGLU" |
| 551 | GLU_CFLAGS="" |
| 552 | fi |
| 553 | fi |
| 554 | |
| 555 | if test x$have_glu = xno; then |
| 556 | AC_MSG_ERROR([*** opengl requested but not found!]) |
| 557 | else |
| 558 | AC_DEFINE(WITH_OPENGL,1,[define if using experimental opengl rendering]) |
| 559 | fi |
| 560 | fi |
| 561 | |
| 562 | |
| 563 | dnl ============================================================== |
| 564 | dnl Audio |
| 565 | dnl ============================================================== |
| 566 | PKG_CHECK_MODULES(ALSA, alsa, |
| 567 | AC_DEFINE(WITH_MIDI,1,[define if compiling midi controller]) |
| 568 | have_midi=yes, |
| 569 | have_midi=no) |
| 570 | |
| 571 | dnl TODO(shammash): before this refactoring we were enabling jack |
| 572 | dnl only if alsa was present, check inconsistencies in the code. |
| 573 | PKG_CHECK_MODULES(JACK, jack, :, |
| 574 | AC_MSG_ERROR([*** Jack development files not found!])) |
| 575 | |
| 576 | PKG_CHECK_MODULES(FFTW, fftw3, :, |
| 577 | AC_MSG_ERROR([*** Fftw3 development files not found!])) |
| 578 | |
| 579 | PKG_CHECK_MODULES(SAMPLERATE, samplerate, :, |
| 580 | AC_MSG_ERROR([*** Samplerate development files not found!])) |
| 581 | |
| 582 | AC_DEFINE(WITH_AUDIO,1,[define if compiling audio system]) |
| 583 | |
| 584 | ## goom removed because gives compilation problems |
| 585 | ## replicated on Niels ubuntu 7.10 |
| 586 | #if test 1 = 0; then |
| 587 | # enable_goom=yes |
| 588 | # AM_PROG_LEX |
| 589 | # AC_PROG_YACC |
| 590 | # AC_CHECK_HEADERS([stddef.h libintl.h malloc.h]) |
| 591 | # AC_FUNC_ALLOCA |
| 592 | # AC_CHECK_FUNCS([strtol]) |
| 593 | # |
| 594 | # AC_DEFINE(WITH_GOOM,1,[define if goom is enabled]) |
| 595 | # GOOM_LIBS="\$(top_builddir)/lib/goom/libgoom2.a" |
| 596 | # GOOM_CFLAGS="-I\$(top_srcdir)/lib/goom" |
| 597 | # if test x$have_ppc = xyes; then |
| 598 | # GOOM_PPC_FILES="ppc_zoom_ultimate.s ppc_drawings.s" |
| 599 | # fi |
| 600 | #else |
| 601 | # enable_goom=no |
| 602 | #fi |
| 603 | #AC_SUBST(GOOM_LIBS) |
| 604 | #AC_SUBST(GOOM_CFLAGS) |
| 605 | #AC_SUBST(GOOM_PPC_FILES) |
| 606 | |
| 607 | enable_goom=no |
| 608 | AM_CONDITIONAL([BUILD_GOOM], [test x$enable_goom = xyes]) |
| 609 | |
| 610 | |
| 611 | dnl ============================================================== |
| 612 | dnl compile including the javascript interpreter |
| 613 | dnl ============================================================== |
| 614 | |
| 615 | AC_MSG_NOTICE([checking if mozilla-js is ok]) |
| 616 | PKG_CHECK_MODULES([MOZJS_JS], |
| 617 | [mozilla-js >= 1.9], |
| 618 | [have_mozjs_js=yes], [have_mozjs_js=no]) |
| 619 | if test x$have_mozjs_js = xyes; then |
| 620 | FREEJ_SAVE_FLAGS |
| 621 | CFLAGS="$MOZJS_JS_CFLAGS" |
| 622 | CPPFLAGS="$MOZJS_JS_CFLAGS" |
| 623 | LDFLAGS="$MOZJS_JS_LIBS" |
| 624 | FREEJ_CHECK_LIB_HEADER([mozjs], [JS_NewContext], [jsapi.h], |
| 625 | [have_mozjs_js=yes], [have_mozjs_js=no]) |
| 626 | FREEJ_RESTORE_FLAGS |
| 627 | fi |
| 628 | if test x$have_mozjs_js = xyes; then |
| 629 | AC_MSG_NOTICE([using mozilla-js]) |
| 630 | MOZJS_CFLAGS="$MOZJS_JS_CFLAGS" |
| 631 | MOZJS_LIBS="$MOZJS_JS_LIBS" |
| 632 | have_mozjs=yes |
| 633 | else |
| 634 | AC_MSG_NOTICE([NOT using mozilla-js]) |
| 635 | have_mozjs=no |
| 636 | fi |
| 637 | |
| 638 | if test x$have_mozjs = xno; then |
| 639 | AC_MSG_NOTICE([checking if mozilla-js && libxul-embedding-stable are ok]) |
| 640 | dnl test if https://bugzilla.mozilla.org/show_bug.cgi?id=500645 has been closed |
| 641 | PKG_CHECK_MODULES([MOZJS_STABLE], |
| 642 | [mozilla-js >= 1.9 libxul-embedding-stable >= 1.9], |
| 643 | [have_mozjs_stable=yes], [have_mozjs_stable=no]) |
| 644 | if test x$have_mozjs_stable = xyes; then |
| 645 | FREEJ_SAVE_FLAGS |
| 646 | CFLAGS="$MOZJS_STABLE_CFLAGS" |
| 647 | CPPFLAGS="$MOZJS_STABLE_CFLAGS" |
| 648 | LDFLAGS="$MOZJS_STABLE_LIBS" |
| 649 | FREEJ_CHECK_LIB_HEADER([mozjs], [JS_NewContext], [jsapi.h], |
| 650 | [have_mozjs_stable=yes], [have_mozjs_stable=no]) |
| 651 | FREEJ_RESTORE_FLAGS |
| 652 | fi |
| 653 | if test x$have_mozjs_stable = xyes; then |
| 654 | AC_MSG_NOTICE([using mozilla-js && libxul-embedding-stable]) |
| 655 | MOZJS_CFLAGS="$MOZJS_STABLE_CFLAGS" |
| 656 | MOZJS_LIBS="$MOZJS_STABLE_LIBS" |
| 657 | have_mozjs=yes |
| 658 | else |
| 659 | AC_MSG_NOTICE([NOT using mozilla-js && libxul-embedding-stable]) |
| 660 | have_mozjs=no |
| 661 | fi |
| 662 | fi |
| 663 | |
| 664 | if test x$have_mozjs = xno; then |
| 665 | dnl test if adding unstable is enough |
| 666 | AC_MSG_NOTICE([checking if mozilla-js && libxul-embedding-unstable are ok]) |
| 667 | PKG_CHECK_MODULES([MOZJS_UNSTABLE], |
| 668 | [mozilla-js >= 1.9 libxul-embedding-unstable >= 1.9], |
| 669 | [have_mozjs_unstable=yes], [have_mozjs_unstable=no]) |
| 670 | if test x$have_mozjs_unstable = xyes; then |
| 671 | FREEJ_SAVE_FLAGS |
| 672 | CFLAGS="$MOZJS_UNSTABLE_CFLAGS" |
| 673 | CPPFLAGS="$MOZJS_UNSTABLE_CFLAGS" |
| 674 | LDFLAGS="$MOZJS_UNSTABLE_LIBS" |
| 675 | FREEJ_CHECK_LIB_HEADER([mozjs], [JS_NewContext], [jsapi.h], |
| 676 | [have_mozjs_unstable=yes], [have_mozjs_unstable=no]) |
| 677 | FREEJ_RESTORE_FLAGS |
| 678 | fi |
| 679 | if test x$have_mozjs_unstable = xyes; then |
| 680 | AC_MSG_NOTICE([using mozilla-js && libxul-embedding-unstable]) |
| 681 | MOZJS_CFLAGS="$MOZJS_UNSTABLE_CFLAGS" |
| 682 | MOZJS_LIBS="$MOZJS_UNSTABLE_LIBS" |
| 683 | have_mozjs=yes |
| 684 | else |
| 685 | AC_MSG_NOTICE([NOT using mozilla-js && libxul-embedding-unstable]) |
| 686 | have_mozjs=no |
| 687 | fi |
| 688 | fi |
| 689 | |
| 690 | if test x$have_mozjs = xyes; then |
| 691 | AC_DEFINE(JS_THREADSAFE,1,[define if compiling with threadsafe libjs]) |
| 692 | AC_MSG_CHECKING([if libmozjs is in linker search path]) |
| 693 | |
| 694 | FREEJ_SAVE_FLAGS |
| 695 | CFLAGS="$MOZJS_CFLAGS" |
| 696 | CPPFLAGS="$MOZJS_CFLAGS" |
| 697 | dnl strip -L<arg> from MOZJS_LIBS |
| 698 | LDFLAGS=`echo $MOZJS_LIBS | sed 's/-L \?[^ ]*//g'` |
| 699 | AC_RUN_IFELSE([ |
| 700 | #include <jsapi.h> |
| 701 | int main() { |
| 702 | JSRuntime *jsr = JS_NewRuntime(8L * 1024L * 1024L); |
| 703 | return 0; |
| 704 | }], |
| 705 | [have_mozjs_linkable=yes], [have_mozjs_linkable=no], |
| 706 | [have_mozjs_linkable=no]) dnl action if cross-compiling |
| 707 | FREEJ_RESTORE_FLAGS |
| 708 | |
| 709 | if test x$have_mozjs_linkable = xno; then |
| 710 | AC_MSG_RESULT([no, compiling static version]) |
| 711 | have_mozjs=no |
| 712 | else |
| 713 | AC_MSG_RESULT([yes]) |
| 714 | fi |
| 715 | fi |
| 716 | |
| 717 | dnl this flag is supposed to be for users having problem with xulrunner |
| 718 | dnl installed on the system and want to force a static linking with our shipped |
| 719 | dnl xulrunner |
| 720 | AC_ARG_ENABLE(static-mozjs, |
| 721 | AS_HELP_STRING([--enable-static-mozjs],[force use of shipped mozjs]), |
| 722 | [static_mozjs=$enableval], |
| 723 | [static_mozjs=no]) |
| 724 | if test x$have_mozjs = xno || test x$static_mozjs = xyes; then |
| 725 | AC_MSG_NOTICE([fallback to static mozjs]) |
| 726 | MOZJS_CFLAGS="-I\$(top_srcdir)/lib/javascript -I\$(top_builddir)/lib/javascript" |
| 727 | dnl libs in top_srcdir instead of top_builddir because js is not under autotools |
| 728 | MOZJS_LIBS="\$(top_builddir)/lib/javascript/libmozjs.a" |
| 729 | |
| 730 | dnl run lib/javascript/configure after freej's configure, building it static |
| 731 | dnl XXX config.cache can be shared between the two configures? is it safe? |
| 732 | AC_CONFIG_COMMANDS([lib/javascript/.xulrunner-subdir], |
| 733 | [ |
| 734 | (cd lib/javascript && |
| 735 | CXXFLAGS="$GLOBAL_CFLAGS $CXXFLAGS -fPIC" \ |
| 736 | CFLAGS="$GLOBAL_CFLAGS $CFLAGS -fPIC" \ |
| 737 | $ac_srcdir/configure --enable-static \ |
| 738 | --enable-js-static-build --disable-jit) || exit $? |
| 739 | ]) |
| 740 | have_mozjs=no |
| 741 | fi |
| 742 | |
| 743 | if test x$enable_debug = xyes ; then |
| 744 | MOZJS_CFLAGS="$MOZJS_CFLAGS -DJS_GCMETER" |
| 745 | fi |
| 746 | |
| 747 | # I don't think this is needed (shammash) |
| 748 | #if test x$have_freebsd = xyes; then |
| 749 | # MOZJS_CFLAGS="-I/usr/local/include -L/usr/local/lib -I../lib/javascript" |
| 750 | # MOZJS_LIBS="-ljs" |
| 751 | # AC_DEFINE(XP_UNIX,1,[Define use of UNIX types in javascript]) |
| 752 | #fi |
| 753 | |
| 754 | if test x$have_linux = xyes ; then |
| 755 | AC_DEFINE(XP_UNIX,1,[Define use of UNIX types in javascript]) |
| 756 | fi |
| 757 | if test x$have_darwin = xyes ; then |
| 758 | AC_DEFINE(XP_MAC,1,[Define use of MAC types in javascript]) |
| 759 | fi |
| 760 | |
| 761 | AC_SUBST(MOZJS_CFLAGS) |
| 762 | AC_SUBST(MOZJS_LIBS) |
| 763 | |
| 764 | AC_DEFINE(WITH_JAVASCRIPT,1,[Define if using libmozjs for spidermonkey javascript]) |
| 765 | |
| 766 | AM_CONDITIONAL([BUILD_JAVASCRIPT], [test x$have_mozjs = xno]) |
| 767 | |
| 768 | |
| 769 | dnl ============================================================== |
| 770 | dnl unicap lib |
| 771 | dnl ============================================================== |
| 772 | PKG_CHECK_MODULES(UNICAP, libunicap, have_unicap=yes, have_unicap=no) |
| 773 | if test x$have_unicap = xyes; then |
| 774 | AC_DEFINE(WITH_UNICAP,1,[Define if to link libunicap for camera capture]) |
| 775 | fi |
| 776 | |
| 777 | dnl ============================================================== |
| 778 | dnl opencv lib |
| 779 | dnl ============================================================== |
| 780 | PKG_CHECK_MODULES(OPENCV, opencv, have_opencv=yes, have_opencv=no) |
| 781 | if test x$have_opencv = xyes; then |
| 782 | AC_DEFINE(WITH_OPENCV,1,[Define if to link opencv framework]) |
| 783 | fi |
| 784 | |
| 785 | |
| 786 | dnl ============================================================== |
| 787 | dnl SDL_gfx |
| 788 | dnl ============================================================== |
| 789 | PKG_CHECK_MODULES(SDLGFX, SDL_gfx, have_sdlgfx=yes, have_sdlgfx=no) |
| 790 | if test x$have_sdlgfx = xno; then |
| 791 | SDLGFX_CFLAGS="$SDL_CFLAGS" |
| 792 | SDLGFX_LIBS="$SDL_LIBS -lSDL_gfx" |
| 793 | FREEJ_SAVE_FLAGS |
| 794 | CFLAGS="$SDLGFX_CFLAGS" |
| 795 | CPPFLAGS="$SDLGFX_CFLAGS" |
| 796 | LDFLAGS="$SDLGFX_LIBS" |
| 797 | FREEJ_CHECK_LIB_HEADER([SDL_gfx], [pixelColor], [SDL_gfxPrimitives.h], |
| 798 | [have_sdlgfx=yes], [have_sdlgfx=no]) |
| 799 | FREEJ_RESTORE_FLAGS |
| 800 | fi |
| 801 | if test x$have_sdlgfx = xno; then |
| 802 | AC_MSG_NOTICE([Using freej version of SDLGFX]) |
| 803 | |
| 804 | AC_CHECK_FUNCS([pow]) |
| 805 | SDLGFX_LIBS="\$(top_builddir)/lib/sdl_gfx/libsdl_gfx.la" |
| 806 | SDLGFX_CFLAGS="-I\$(top_srcdir)/lib/sdl_gfx" |
| 807 | fi |
| 808 | |
| 809 | AM_CONDITIONAL([BUILD_SDLGFX], [test x$have_sdlgfx = xno]) |
| 810 | |
| 811 | |
| 812 | dnl ============================================================== |
| 813 | dnl SDL_ttf |
| 814 | dnl ============================================================== |
| 815 | PKG_CHECK_MODULES([SDLTTF], [SDL_ttf], [have_sdlttf=yes], [have_sdlttf=no]) |
| 816 | if test x$have_sdlttf = xno; then |
| 817 | SDLTTF_CFLAGS="$SDL_CFLAGS" |
| 818 | SDLTTF_LIBS="$SDL_LIBS -lSDL_ttf" |
| 819 | FREEJ_SAVE_FLAGS |
| 820 | CFLAGS="$SDLTTF_CFLAGS" |
| 821 | CPPFLAGS="$SDLTTF_CFLAGS" |
| 822 | LDFLAGS="$SDLTTF_LIBS" |
| 823 | FREEJ_CHECK_LIB_HEADER([SDL_ttf], [TTF_Init], [SDL_ttf.h], |
| 824 | [have_sdlttf=yes], [have_sdlttf=no]) |
| 825 | FREEJ_RESTORE_FLAGS |
| 826 | fi |
| 827 | if test x$have_sdlttf = xno; then |
| 828 | AC_MSG_NOTICE([Using freej version of SDLTTF]) |
| 829 | SDLTTF_CFLAGS="-I\$(top_srcdir)/lib/sdl_ttf" |
| 830 | SDLTTF_LIBS="\$(top_builddir)/lib/sdl_ttf/libsdl_ttf.la" |
| 831 | fi |
| 832 | |
| 833 | AM_CONDITIONAL([BUILD_SDLTTF], [test x$have_sdlttf = xno]) |
| 834 | |
| 835 | |
| 836 | dnl ============================================================== |
| 837 | dnl SDL_image |
| 838 | dnl ============================================================== |
| 839 | PKG_CHECK_MODULES([SDLIMAGE], [SDL_image], |
| 840 | [have_sdlimage=yes], |
| 841 | [have_sdlimage=no]) |
| 842 | if test x$have_sdlimage = xno; then |
| 843 | SDLIMAGE_CFLAGS="$SDL_CFLAGS" |
| 844 | SDLIMAGE_LIBS="$SDL_LIBS -lSDL_image -ljpeg" |
| 845 | FREEJ_SAVE_FLAGS |
| 846 | CFLAGS="$SDLIMAGE_CFLAGS" |
| 847 | CPPFLAGS="$SDLIMAGE_CFLAGS" |
| 848 | LDFLAGS="$SDLIMAGE_LIBS" |
| 849 | FREEJ_CHECK_LIB_HEADER([SDL_image], [IMG_Load], [SDL_image.h], |
| 850 | [have_sdlimage=yes], [have_sdlimage=no]) |
| 851 | FREEJ_RESTORE_FLAGS |
| 852 | fi |
| 853 | if test x$have_sdlimage = xno; then |
| 854 | FREEJ_CHECK_LIB_HEADER([jpeg], [jpeg_std_error], [jpeglib.h], |
| 855 | [have_libjpeg=yes], [have_libjpeg=no]) |
| 856 | if test x$have_libjpeg = xno; then |
| 857 | AC_MSG_ERROR([*** Libjpeg development files are required to build static SDL_image]) |
| 858 | fi |
| 859 | PKG_CHECK_MODULES(LIBPNG, libpng, have_libpng=yes, have_libpng=no) |
| 860 | if test x$have_libpng = xno; then |
| 861 | AC_MSG_ERROR([*** Libpng development files are required to build static SDL_image]) |
| 862 | fi |
| 863 | |
| 864 | SDLIMAGE_CFLAGS="-I\$(top_srcdir)/lib/sdl_image" |
| 865 | SDLIMAGE_LIBS="-lpng -ljpeg \$(top_builddir)/lib/sdl_image/libsdl_image.la" |
| 866 | fi |
| 867 | |
| 868 | AM_CONDITIONAL([BUILD_SDLIMAGE], [test x$have_sdlimage = xno]) |
| 869 | |
| 870 | |
| 871 | dnl ============================================================== |
| 872 | dnl frei0r plugins |
| 873 | dnl ============================================================== |
| 874 | # |
| 875 | # frei0r should be supported in any case: |
| 876 | # plugins will be detected runtime |
| 877 | # frei0r.h header is redistributed (see LiViDO/frei0r spec.) |
| 878 | # this is a normal behaviour for plugins |
| 879 | # support should be compiled in even if plugins aren't present. |
| 880 | # -jrml |
| 881 | # |
| 882 | #PKG_CHECK_MODULES(FREI0R, frei0r, have_frei0r=yes, have_frei0r=no) |
| 883 | #if test x$have_frei0r = xyes; then |
| 884 | # AC_DEFINE(WITH_FREI0R,1,[Define if using frei0r plugins]) |
| 885 | #fi |
| 886 | AC_DEFINE(WITH_FREI0R,1,[Define as using frei0r plugins]) |
| 887 | |
| 888 | |
| 889 | dnl ============================================================== |
| 890 | dnl freeframe plugins |
| 891 | dnl ============================================================== |
| 892 | # |
| 893 | # freeframe should be supported in any case: |
| 894 | # plugins will be detected runtime |
| 895 | # freeframe.h header is redistributed |
| 896 | # this is a normal behaviour for plugins |
| 897 | # support should be compiled in even if plugins aren't present. |
| 898 | # -xnt |
| 899 | # |
| 900 | AC_DEFINE(WITH_FREEFRAME,1,[Define as using freeframe plugins]) |
| 901 | |
| 902 | dnl ============================================================== |
| 903 | dnl Check Cairo 2d vector graphics library for VectorLayer |
| 904 | dnl ============================================================== |
| 905 | PKG_CHECK_MODULES(CAIRO, cairo, have_cairo=yes, have_cairo=no) |
| 906 | if test x$have_cairo = xyes; then |
| 907 | AC_DEFINE(WITH_CAIRO,1,[define if using cairo vector library]) |
| 908 | fi |
| 909 | |
| 910 | |
| 911 | |
| 912 | dnl ============================================================== |
| 913 | dnl link with memory debugging library dmalloc |
| 914 | dnl ============================================================== |
| 915 | AC_CHECK_HEADERS([dmalloc.h], [have_dmalloc=yes], [have_dmalloc=no]) |
| 916 | AC_ARG_WITH(dmalloc, |
| 917 | AS_HELP_STRING([--with-dmalloc],[use dmalloc, as in ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz]), |
| 918 | [with_dmalloc=$withval], |
| 919 | [with_dmalloc=no]) |
| 920 | |
| 921 | if test x$with_dmalloc = xyes; then |
| 922 | if test x$have_dmalloc = xyes; then |
| 923 | AC_DEFINE(WITH_DMALLOC,1,[Define if using the dmalloc debugging malloc package]) |
| 924 | LIBS="$LIBS -ldmallocthcxx" |
| 925 | else |
| 926 | AC_MSG_ERROR([*** dmalloc requested but header not found!]) |
| 927 | fi |
| 928 | fi |
| 929 | |
| 930 | AC_PROG_PERL_MODULES([HTML::Template], |
| 931 | AM_CONDITIONAL(BUILD_JSAPIDOC, true), |
| 932 | AM_CONDITIONAL(BUILD_JSAPIDOC, false)) |
| 933 | |
| 934 | dnl select CCVT CONVERSION TYPE |
| 935 | CCVT_CONV="ccvt_c2.c" |
| 936 | AC_SUBST(CCVT_CONV) |
| 937 | |
| 938 | CFLAGS="$GLOBAL_CFLAGS $CFLAGS" |
| 939 | AC_SUBST(CFLAGS) |
| 940 | |
| 941 | CXXFLAGS="$GLOBAL_CFLAGS $CXXFLAGS" |
| 942 | AC_SUBST(CXXFLAGS) |
| 943 | |
| 944 | dnl ============================================================== |
| 945 | dnl freej specific flags, explanation: |
| 946 | dnl STATIC_CFLAGS cflags regarding static libraries from lib/ |
| 947 | dnl CFLAGS ordinary cflags from shared libraries _plus static_cflags_ |
| 948 | dnl STATIC_LIBS libtool static libraries plus some optional ones |
| 949 | dnl LIBS ordinary shared libraries used to link libfreej |
| 950 | dnl ============================================================== |
| 951 | FREEJ_STATIC_CFLAGS="-I\$(top_srcdir)/src/include \ |
| 952 | -I\$(top_srcdir)/lib/ccvt \ |
| 953 | -I\$(top_srcdir)/lib/slw \ |
| 954 | \$(FLASH_CFLAGS) \ |
| 955 | \$(GOOM_CFLAGS)" |
| 956 | AC_SUBST(FREEJ_STATIC_CFLAGS) |
| 957 | |
| 958 | FREEJ_CFLAGS="\$(FREEJ_STATIC_CFLAGS) \ |
| 959 | \$(AA_CFLAGS) \ |
| 960 | \$(CWIID_CFLAGS) \ |
| 961 | \$(FC_CFLAGS) \ |
| 962 | \$(FFMPEG_CFLAGS) \ |
| 963 | \$(FT2_CFLAGS) \ |
| 964 | \$(GLU_CFLAGS) \ |
| 965 | \$(LIBLO_CFLAGS) \ |
| 966 | \$(MOZJS_CFLAGS) \ |
| 967 | \$(OPENCV_CFLAGS) \ |
| 968 | \$(SDL_CFLAGS) \ |
| 969 | \$(SDLGFX_CFLAGS) \ |
| 970 | \$(SDLIMAGE_CFLAGS) \ |
| 971 | \$(SDLTTF_CFLAGS) \ |
| 972 | \$(SHOUT_CFLAGS) \ |
| 973 | \$(SLANG_CFLAGS) \ |
| 974 | \$(UNICAP_CFLAGS) \ |
| 975 | \$(CAIRO_CFLAGS) \ |
| 976 | \$(XIPH_CFLAGS)" |
| 977 | AC_SUBST(FREEJ_CFLAGS) |
| 978 | |
| 979 | FREEJ_STATIC_LIBS="\$(top_builddir)/lib/ccvt/libccvt.la \ |
| 980 | \$(top_builddir)/lib/slw/libslw.la \ |
| 981 | \$(FLASH_LIBS) \ |
| 982 | \$(GOOM_LIBS)" |
| 983 | AC_SUBST(FREEJ_STATIC_LIBS) |
| 984 | |
| 985 | FREEJ_LIBS="-lpthread -lm -lrt $DL_LIBS \ |
| 986 | \$(AA_LIBS) \ |
| 987 | \$(ALSA_LIBS) \ |
| 988 | \$(BLUEZ_LIBS) \ |
| 989 | \$(CWIID_LIBS) \ |
| 990 | \$(FC_LIBS) \ |
| 991 | \$(FFMPEG_LIBS) \ |
| 992 | \$(FFTW_LIBS) \ |
| 993 | \$(FT2_LIBS) \ |
| 994 | \$(GLU_LIBS) \ |
| 995 | \$(JACK_LIBS) \ |
| 996 | \$(LIBLO_LIBS) \ |
| 997 | \$(MOZJS_LIBS) \ |
| 998 | \$(OPENCV_LIBS) \ |
| 999 | \$(SAMPLERATE_LIBS) \ |
| 1000 | \$(SDLGFX_LIBS) \ |
| 1001 | \$(SDLIMAGE_LIBS) \ |
| 1002 | \$(SDL_LIBS) \ |
| 1003 | \$(SDLTTF_LIBS) \ |
| 1004 | \$(SHOUT_LIBS) \ |
| 1005 | \$(SLANG_LIBS) \ |
| 1006 | \$(UNICAP_LIBS) \ |
| 1007 | \$(X11_LIBS) \ |
| 1008 | \$(CAIRO_LIBS) \ |
| 1009 | \$(XIPH_LIBS) \ |
| 1010 | \$(GD_LIBS)" |
| 1011 | AC_SUBST(FREEJ_LIBS) |
| 1012 | |
| 1013 | dnl ########################################################################### |
| 1014 | dnl ###### now about compile time paths |
| 1015 | if test "x${prefix}" = "xNONE"; then |
| 1016 | prefix=${ac_default_prefix} |
| 1017 | fi |
| 1018 | PACKAGE_LIB_DIR='${prefix}/lib/freej' |
| 1019 | AC_SUBST(PACKAGE_LIB_DIR) |
| 1020 | PACKAGE_DATA_DIR='${prefix}/share/freej' |
| 1021 | AC_SUBST(PACKAGE_DATA_DIR) |
| 1022 | |
| 1023 | dnl alphabetic order on dir/subdir, but Makefile sorts before everything |
| 1024 | AC_CONFIG_FILES([ |
| 1025 | Makefile |
| 1026 | freej.pc |
| 1027 | bindings/Makefile |
| 1028 | bindings/java/Makefile |
| 1029 | bindings/perl/Makefile |
| 1030 | bindings/python/Makefile |
| 1031 | bindings/ruby/Makefile |
| 1032 | doc/Makefile |
| 1033 | doc/freej.dox |
| 1034 | doc/scripting/Makefile |
| 1035 | lib/Makefile |
| 1036 | lib/ccvt/Makefile |
| 1037 | lib/flash/Makefile |
| 1038 | lib/sdl_gfx/Makefile |
| 1039 | lib/sdl_image/Makefile |
| 1040 | lib/sdl_ttf/Makefile |
| 1041 | lib/slw/Makefile |
| 1042 | lib/javascript/GNUmakefile |
| 1043 | scripts/Makefile |
| 1044 | src/Makefile |
| 1045 | src/include/Makefile |
| 1046 | tests/Makefile |
| 1047 | ]) |
| 1048 | AC_OUTPUT |
| 1049 | |
| 1050 | dnl function to print verbose configure options only if V=1 is passed to |
| 1051 | dnl configure |
| 1052 | AC_DEFUN([VRB], |
| 1053 | AS_IF([test x"$V" == x1], INFO([$1]))) |
| 1054 | |
| 1055 | dnl autoconf < 2.63 compatibility |
| 1056 | m4_ifndef([AS_VAR_APPEND], |
| 1057 | AC_DEFUN([AS_VAR_APPEND], $1=$$1$2)) |
| 1058 | |
| 1059 | dnl convenience function so that INFO messages go to config.log and to stdout, |
| 1060 | dnl useful when debugging user problems only config.log is needed |
| 1061 | AC_DEFUN([INFO], |
| 1062 | AS_ECHO(["$1"]) >&AS_MESSAGE_LOG_FD |
| 1063 | AS_ECHO(["$1"]) >&AS_MESSAGE_FD) |
| 1064 | |
| 1065 | dnl as above, but no newline at the end |
| 1066 | AC_DEFUN([INFO_N], |
| 1067 | AS_ECHO_N(["$1"]) >&AS_MESSAGE_LOG_FD |
| 1068 | AS_ECHO_N(["$1"]) >&AS_MESSAGE_FD) |
| 1069 | |
| 1070 | echo |
| 1071 | echo |
| 1072 | INFO([Compile $PACKAGE $VERSION for ${host}]) |
| 1073 | echo "configuration summary, pass V=1 to configure for verbose output" |
| 1074 | |
| 1075 | dnl mandatory libs, outputted only if verbose |
| 1076 | VRB([= SDL]) |
| 1077 | VRB([ LIBS : $SDL_LIBS]) |
| 1078 | VRB([ CFLAGS : $SDL_CFLAGS]) |
| 1079 | |
| 1080 | VRB([= ogg-theora (xiph.org)]) |
| 1081 | VRB([ LIBS : $XIPH_LIBS]) |
| 1082 | VRB([ CFLAGS: $XIPH_CFLAGS]) |
| 1083 | |
| 1084 | VRB([= Jack]) |
| 1085 | VRB([ LIBS : $JACK_LIBS]) |
| 1086 | VRB([ CFLAGS: $JACK_CFLAGS]) |
| 1087 | |
| 1088 | VRB([= Fftw / harmonics analysis]) |
| 1089 | VRB([ LIBS : $FFTW_LIBS]) |
| 1090 | VRB([ CFLAGS: $FFTW_CFLAGS]) |
| 1091 | |
| 1092 | VRB([= Samplerate]) |
| 1093 | VRB([ LIBS : $SAMPLERATE_LIBS]) |
| 1094 | VRB([ CFLAGS: $SAMPLERATE_CFLAGS]) |
| 1095 | |
| 1096 | VRB([= ffmpeg]) |
| 1097 | VRB([ CFLAGS: $FFMPEG_CFLAGS]) |
| 1098 | VRB([ LIBS : $FFMPEG_LIBS]) |
| 1099 | |
| 1100 | VRB([= OSC controller (liblo)]) |
| 1101 | VRB([ LIBS : $LIBLO_LIBS]) |
| 1102 | VRB([ CFLAGS : $LIBLO_CFLAGS]) |
| 1103 | |
| 1104 | VRB([= Shout library]) |
| 1105 | VRB([ LIBS : $SHOUT_LIBS]) |
| 1106 | VRB([ CFLAGS: $SHOUT_CFLAGS]) |
| 1107 | |
| 1108 | dnl #### bindings |
| 1109 | |
| 1110 | enabled_bindings="" |
| 1111 | disabled_bindings="" |
| 1112 | |
| 1113 | if test x$enable_python = xyes; then |
| 1114 | AS_VAR_APPEND(enabled_bindings, " python") |
| 1115 | VRB([= Python:]) |
| 1116 | VRB([ LIBS : $PYTHON_LDFLAGS]) |
| 1117 | VRB([ CFLAGS : $PYTHON_CPPFLAGS]) |
| 1118 | else |
| 1119 | AS_VAR_APPEND(disabled_bindings, " python") |
| 1120 | fi |
| 1121 | |
| 1122 | if test x$enable_ruby = xyes; then |
| 1123 | AS_VAR_APPEND(enabled_bindings, " ruby") |
| 1124 | VRB([= Ruby:]) |
| 1125 | VRB([ LIBS : $RUBY_LDFLAGS]) |
| 1126 | VRB([ CFLAGS : $RUBY_CPPFLAGS]) |
| 1127 | else |
| 1128 | AS_VAR_APPEND(disabled_bindings, " ruby") |
| 1129 | fi |
| 1130 | |
| 1131 | if test x$enable_java = xyes; then |
| 1132 | AS_VAR_APPEND(enabled_bindings, " java") |
| 1133 | VRB([= Java:]) |
| 1134 | VRB([ LIBS : $JAVA_LDFLAGS]) |
| 1135 | VRB([ CFLAGS : $JAVA_CFLAGS]) |
| 1136 | else |
| 1137 | AS_VAR_APPEND(disabled_bindings, " java") |
| 1138 | fi |
| 1139 | |
| 1140 | if test x$enable_perl = xyes; then |
| 1141 | AS_VAR_APPEND(enabled_bindings, " perl") |
| 1142 | VRB([= Perl:]) |
| 1143 | VRB([ LIBS : $PERL_LDFLAGS]) |
| 1144 | VRB([ CFLAGS : $PERL_CFLAGS]) |
| 1145 | else |
| 1146 | AS_VAR_APPEND(disabled_bindings, " perl") |
| 1147 | fi |
| 1148 | |
| 1149 | INFO([= Enabled language bindings : $enabled_bindings]) |
| 1150 | INFO([= Disabled language bindings : $disabled_bindings]) |
| 1151 | |
| 1152 | |
| 1153 | dnl #### shipped libraries, can be static or dynamic |
| 1154 | |
| 1155 | if test x$have_mozjs = xyes; then |
| 1156 | INFO([= javascript interpreter (dynamic)]) |
| 1157 | else |
| 1158 | INFO([= javascript interpreter (static)]) |
| 1159 | fi |
| 1160 | VRB([ LIBS : $MOZJS_LIBS]) |
| 1161 | VRB([ CFLAGS: $MOZJS_CFLAGS]) |
| 1162 | |
| 1163 | if test x$have_sdlgfx = xyes; then |
| 1164 | INFO([= SDL_gfx (dynamic)]) |
| 1165 | else |
| 1166 | INFO([= SDL_gfx (static)]) |
| 1167 | fi |
| 1168 | VRB([ LIBS : $SDLGFX_LIBS]) |
| 1169 | VRB([ CFLAGS: $SDLGFX_CFLAGS]) |
| 1170 | |
| 1171 | if test x$have_sdlttf = xyes; then |
| 1172 | INFO([= SDL_ttf (dynamic)]) |
| 1173 | else |
| 1174 | INFO([= SDL_ttf (static)]) |
| 1175 | fi |
| 1176 | VRB([ LIBS : $SDLTTF_LIBS]) |
| 1177 | VRB([ CFLAGS: $SDLTTF_CFLAGS]) |
| 1178 | |
| 1179 | if test x$have_sdlimage = xyes; then |
| 1180 | INFO([= SDL_image (dynamic)]) |
| 1181 | else |
| 1182 | INFO([= SDL_image (static)]) |
| 1183 | fi |
| 1184 | VRB([ LIBS : $SDLIMAGE_LIBS]) |
| 1185 | VRB([ CFLAGS: $SDLIMAGE_CFLAGS]) |
| 1186 | |
| 1187 | if test x$have_gd = xyes; then |
| 1188 | INFO([= libGD (dynamic)]) |
| 1189 | VRB([ LIBS : $GD_LIBS]) |
| 1190 | fi |
| 1191 | |
| 1192 | dnl #### optional stuff |
| 1193 | INFO_N([= AAlib : ]) |
| 1194 | if test x$have_aa = xyes; then |
| 1195 | INFO(yes) |
| 1196 | VRB([ AA LIBS : $AA_LIBS]) |
| 1197 | else |
| 1198 | INFO(no) |
| 1199 | fi |
| 1200 | |
| 1201 | INFO_N([= OpenGL : ]) |
| 1202 | if test x$enable_opengl = xyes; then |
| 1203 | INFO(yes) |
| 1204 | VRB([ GLU LIBS : $GLU_LIBS]) |
| 1205 | VRB([ GLU CFLAGS : $GLU_CFLAGS]) |
| 1206 | else |
| 1207 | INFO(no) |
| 1208 | fi |
| 1209 | |
| 1210 | INFO_N([= unicap library : ]) |
| 1211 | if test x$have_unicap = xyes; then |
| 1212 | INFO(yes) |
| 1213 | VRB([ LIBS : $UNICAP_LIBS]) |
| 1214 | VRB([ CFLAGS: $UNICAP_CFLAGS]) |
| 1215 | else |
| 1216 | INFO(no) |
| 1217 | fi |
| 1218 | |
| 1219 | |
| 1220 | dnl #### layers |
| 1221 | |
| 1222 | INFO_N([= vector layer : ]) |
| 1223 | if test x$have_cairo = xyes; then |
| 1224 | INFO(yes) |
| 1225 | VRB([= cairo]) |
| 1226 | VRB([ LIBS : $CAIRO_LIBS]) |
| 1227 | VRB([ CFLAGS: $CAIRO_CFLAGS]) |
| 1228 | else |
| 1229 | INFO(no) |
| 1230 | fi |
| 1231 | |
| 1232 | |
| 1233 | INFO_N([= text layer : ]) |
| 1234 | if test x$have_textlayer = xyes; then |
| 1235 | INFO(yes) |
| 1236 | VRB([= freetype2]) |
| 1237 | VRB([ LIBS : $FT2_LIBS]) |
| 1238 | VRB([ CFLAGS: $FT2_CFLAGS]) |
| 1239 | VRB([= fontconfig]) |
| 1240 | VRB([ LIBS : $FC_LIBS]) |
| 1241 | VRB([ CFLAGS: $FC_CFLAGS]) |
| 1242 | else |
| 1243 | INFO(no) |
| 1244 | fi |
| 1245 | |
| 1246 | INFO_N([= xgrab layer : ]) |
| 1247 | if test x$have_xgrab = xyes; then |
| 1248 | INFO(yes) |
| 1249 | else |
| 1250 | INFO(no) |
| 1251 | fi |
| 1252 | |
| 1253 | INFO_N([= Flash layer : ]) |
| 1254 | if test x$have_flash = xyes; then |
| 1255 | INFO([yes (v3 animations only)]) |
| 1256 | VRB([ LIBS : $FLASH_LIBS (static)]) |
| 1257 | else |
| 1258 | INFO(no) |
| 1259 | fi |
| 1260 | |
| 1261 | INFO_N([= goom layer : ]) |
| 1262 | if test x$enable_goom = xyes; then |
| 1263 | INFO(yes) |
| 1264 | else |
| 1265 | INFO(no) |
| 1266 | fi |
| 1267 | |
| 1268 | INFO_N([= OpenCV cam layer : ]) |
| 1269 | if test x$have_opencv = xyes; then |
| 1270 | INFO(yes) |
| 1271 | else |
| 1272 | INFO(no) |
| 1273 | fi |
| 1274 | |
| 1275 | |
| 1276 | dnl #### controllers |
| 1277 | |
| 1278 | INFO_N([= ALSA / MidiController : ]) |
| 1279 | if test x$have_midi = xyes; then |
| 1280 | INFO(yes) |
| 1281 | VRB([ LIBS : $ALSA_LIBS]) |
| 1282 | VRB([ CFLAGS: $ALSA_CFLAGS]) |
| 1283 | else |
| 1284 | INFO(no) |
| 1285 | fi |
| 1286 | |
| 1287 | INFO_N([= WiiMote controller (cwiid) : ]) |
| 1288 | if test x$have_cwiid = xyes; then |
| 1289 | INFO(yes) |
| 1290 | VRB([ LIBS : $CWIID_LIBS]) |
| 1291 | VRB([ CFLAGS : $CWIID_CFLAGS]) |
| 1292 | else |
| 1293 | INFO(no) |
| 1294 | fi |
| 1295 | |
| 1296 | |
| 1297 | dnl #### misc stuff |
| 1298 | |
| 1299 | INFO_N([= Building binary with support for machine specific advanced instructions : ]) |
| 1300 | if test x$enable_cpuflags = xyes; then |
| 1301 | INFO(yes) |
| 1302 | else |
| 1303 | INFO(no) |
| 1304 | fi |
| 1305 | |
| 1306 | INFO_N([= Building machine specific lubricated binary : ]) |
| 1307 | if test x$enable_lubrication = xyes; then |
| 1308 | INFO(yes) |
| 1309 | else |
| 1310 | INFO(no) |
| 1311 | fi |
| 1312 | |
| 1313 | INFO_N([= Compiling with debugging symbols : ]) |
| 1314 | if test x$enable_debug = xyes; then |
| 1315 | INFO(yes) |
| 1316 | else |
| 1317 | INFO(no) |
| 1318 | fi |
| 1319 | |
| 1320 | INFO_N([= Including support for the GNU Profiler : ]) |
| 1321 | if test x$enable_profiling = xyes; then |
| 1322 | INFO(yes) |
| 1323 | else |
| 1324 | INFO(no) |
| 1325 | fi |
| 1326 | |
| 1327 | |
| 1328 | INFO([= COMPILER FLAGS : $CFLAGS]) |
| 1329 | INFO([= LINKER FLAGS : $LDFLAGS]) |
| 1330 | INFO([= INSTALL PREFIX : $prefix]) |
| 1331 | echo "============================== now type make, may the source be with you!" |
| 1332 | echo |
| 1333 | |
| 1334 | # vim:et:ts=3:sw=3 |
| 1335 | |