|
- # $Id$
-
- AC_INIT(libpipi, 0.0)
- AC_PREREQ(2.50)
- AC_CONFIG_AUX_DIR(.auto)
- AC_CANONICAL_SYSTEM
- AM_INIT_AUTOMAKE([no-define tar-ustar])
- dnl AM_MAINTAINER_MODE
-
- AM_CONFIG_HEADER(config.h)
-
- LT_MAJOR="0"
- LT_MINOR="0"
- LT_MICRO="0"
- AC_SUBST(LT_MAJOR)
- AC_SUBST(LT_MINOR)
- AC_SUBST(LT_MICRO)
- LT_VERSION="$LT_MAJOR:$LT_MINOR:$LT_MICRO"
- AC_SUBST(LT_VERSION)
-
- AM_PROG_CC_C_O
- AC_PROG_CPP
- AC_PROG_CXX
- AC_PROG_CXXCPP
- AC_PROG_OBJC
- _AM_DEPENDENCIES([OBJC])
- OBJC="${CC}"
- AC_SUBST(OBJC)
- AC_SUBST(OBJCFLAGS)
-
- AC_LIBTOOL_WIN32_DLL
- AM_PROG_LIBTOOL
- AC_LIBTOOL_CXX
-
- AC_C_CONST
- AC_C_INLINE
-
- dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
- dnl now otherwise it might be set in an obscure if statement. Same thing for
- dnl PKG_PROG_PKG_CONFIG which needs to be called first.
- AC_EGREP_CPP(yes, foo)
- PKG_PROG_PKG_CONFIG()
- m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
- if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
- export PKG_CONFIG_LIBDIR=/dev/null
- fi
-
- AC_MSG_CHECKING(for library suffix)
- LT_SUFFIX="`./libtool -n --tag CC --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`"
- if test "$LT_SUFFIX" = ""; then
- LT_SUFFIX=".so.$LT_MAJOR"
- AC_MSG_RESULT([unknown, defaulting to $LT_SUFFIX])
- else
- AC_MSG_RESULT($LT_SUFFIX)
- fi
- AC_SUBST(LT_SUFFIX)
-
- dnl language bindings
- AC_ARG_ENABLE(csharp,
- [ --enable-csharp C# bindings (autodetected)])
-
- dnl conditional builds
- AC_ARG_ENABLE(debug,
- [ --enable-debug build debug versions of the library (default no)])
- AC_ARG_ENABLE(tiles,
- [ --enable-tiles experimental tiles support (default no)])
-
- AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h)
-
- ac_cv_have_getopt_long="no"
- AC_CHECK_FUNCS(getopt_long,
- [ac_cv_have_getopt_long="yes"],
- [AC_CHECK_LIB(gnugetopt, getopt_long,
- [ac_cv_have_getopt_long="yes"
- GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
- if test "$ac_cv_have_getopt_long" != "no"; then
- AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the ‘getopt_long’ function.)
- fi
- AM_CONDITIONAL(NEED_GETOPT_LONG, test "$ac_cv_have_getopt_long" = "no")
- AC_SUBST(GETOPT_LIBS)
-
- # How to get the C99 types. See pipi/pipi_types.h.in for details about
- # the PIPI_TYPES variable
- if test "${ac_cv_my_have_vga}" = "yes"; then
- PIPI_TYPES=0
- else
- AC_CHECK_HEADERS(stdint.h,
- [PIPI_TYPES=1],
- [AC_CHECK_HEADERS(inttypes.h,
- [PIPI_TYPES=2],
- [AC_CHECK_HEADERS(windows.h,
- [PIPI_TYPES=3],
- [PIPI_TYPES=0])])])
- fi
- AC_SUBST(PIPI_TYPES)
-
- # Optimizations
- CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
- # Code qui fait des warnings == code de porc == deux baffes dans ta gueule
- CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
-
- AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
-
- # Use SDL?
- ac_cv_my_have_sdl="no"
- save_CPPFLAGS="${CPPFLAGS}"
- AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
- if test "${SDL_CONFIG}" != "no"; then
- CPPFLAGS="${CPPFLAGS} `sdl-config --cflags`"
- fi
- AC_CHECK_HEADERS(SDL_image.h,
- [ac_cv_my_have_sdl="yes"],
- [ac_cv_my_have_sdl="no"])
- CPPFLAGS="${save_CPPFLAGS}"
- if test "${ac_cv_my_have_sdl}" != "no"; then
- AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL_image)
- fi
- AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
-
- # Use OpenCV?
- ac_cv_my_have_opencv="no"
- OPENCV="no"
- PKG_CHECK_MODULES(OPENCV, opencv, [ac_cv_my_have_opencv="yes"], [:])
- if test "${ac_cv_my_have_opencv}" != "no"; then
- AC_DEFINE(USE_OPENCV, 1, Define to 1 to use OpenCV)
- fi
- AM_CONDITIONAL(USE_OPENCV, test "${ac_cv_my_have_opencv}" = "yes")
-
- # Use Imlib2?
- ac_cv_my_have_imlib2="no"
- IMLIB2="no"
- PKG_CHECK_MODULES(IMLIB2, imlib2, [ac_cv_my_have_imlib2="yes"], [:])
- if test "${ac_cv_my_have_imlib2}" != "no"; then
- AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2)
- fi
- AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes")
-
- # Use Windows GDI?
- ac_cv_my_have_gdi="no"
- GDI="no"
- AC_CHECK_HEADERS(windows.h,
- [ac_cv_my_have_gdi="yes"],
- [ac_cv_my_have_gdi="no"])
- if test "${ac_cv_my_have_gdi}" != "no"; then
- AC_DEFINE(USE_GDI, 1, Define to 1 to use GDI)
- fi
- AM_CONDITIONAL(USE_GDI, test "${ac_cv_my_have_gdi}" = "yes")
-
- # Use Windows GDI+?
- ac_cv_my_have_gdiplus="no"
- AC_LANG_PUSH(C++)
- AC_CHECK_HEADERS(Gdiplus.h,
- [ac_cv_my_have_gdiplus="yes"],
- [ac_cv_my_have_gdiplus="no"],
- [#include <windows.h>])
- AC_LANG_POP(C++)
- if test "${ac_cv_my_have_gdiplus}" != "no"; then
- AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+)
- fi
- AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes")
-
- # Use Cocoa?
- ac_cv_my_have_cocoa="no"
- AC_CHECK_HEADERS(/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h,
- [
- MACOSX_SDK_FRAMEWORKS="-F${MACOSX_SDK}/System/Library/Frameworks"
- CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
- CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
- CXXFLAGS="${CXXFLAGS} ${MACOSX_SDK_CXXFLAGS}"
- OBJCFLAGS="${OBJCFLAGS} ${MACOSX_SDK_CFLAGS}"
- LDFLAGS="${ARCH} ${MACOSX_SDK_LDFLAGS} ${LDFLAGS}"
- AC_DEFINE(USE_COCOA, 1, Define to 1 to activate the Cocoa backend driver)
- # CACA_LIBS="${CACA_LIBS} -Wl,-syslibroot,${MACOSX_SDK},-framework,Cocoa"
- # CACA_DRIVERS="${CACA_DRIVERS} cocoa"
- ac_cv_my_have_cocoa="yes"],
- [ac_cv_my_have_cocoa="no"]
- )
- AM_CONDITIONAL(USE_COCOA, test "${ac_cv_my_have_cocoa}" = "yes")
-
-
- # Use Modular codecs ?
- MODULAR_CODEC=""
- ac_cv_my_have_modular="no"
-
- ac_cv_my_have_libjpeg="no"
- AC_CHECK_HEADERS(jpeglib.h,
- [ac_cv_my_have_libjpeg="yes"],
- [ac_cv_my_have_libjpeg="no"])
- if test "${ac_cv_my_have_libjpeg}" != "no"; then
- ac_cv_my_have_modular="yes"
- AC_DEFINE(USE_LIBJPEG, 1, Define to 1 to use libjpeg)
- AC_DEFINE(USE_MODULAR, 1, Define to 1 to use modular codecs)
- MODULAR_CODEC="${MODULAR_CODEC} libjpeg"
- fi
- AM_CONDITIONAL(USE_LIBJPEG, test "${ac_cv_my_have_libjpeg}" = "yes")
- AM_CONDITIONAL(USE_MODULAR, test "${ac_cv_my_have_modular}" = "yes")
-
- AC_MSG_CHECKING(valid modular codecs)
- if test -z "${MODULAR_CODEC}"; then
- AC_MSG_RESULT(none)
- else
- MODULAR_CODEC="${MODULAR_CODEC# *}"
- AC_MSG_RESULT([${MODULAR_CODEC}])
- fi
-
- if test "${ac_cv_my_have_sdl}" = "no" -a "${ac_cv_my_have_imlib2}" = "no" -a "${ac_cv_my_have_opencv}" = "no" -a "${ac_cv_my_have_cocoa}" = "no" -a "${ac_cv_my_have_modular}" = "no"; then
- AC_MSG_ERROR([[cannot find GDI+, SDL_Image, Imlib2, Cocoa or OpenCV, please install one of them]])
- fi
-
- if test "${enable_debug}" = "yes"; then
- AC_DEFINE(DEBUG, 1, Define to 1 to activate debug)
- fi
-
- if test "${enable_tiles}" = "yes"; then
- AC_DEFINE(USE_TILES, 1, Define to 1 to activate experimental tiles)
- fi
-
- AC_SUBST(MATH_LIBS)
-
- # Build the .NET bindings?
- ac_cv_my_have_csharp="no"
- if test "${enable_csharp}" != "no"; then
- AC_PATH_PROG(GMCS, gmcs, no)
- AC_PATH_PROG(GACUTIL, gacutil, no)
- if test "${GMCS}" != "no" -a "${GACUTIL}" != "no"; then
- ac_cv_my_have_csharp="yes"
- fi
- fi
- AM_CONDITIONAL(USE_CSHARP, test "${ac_cv_my_have_csharp}" = "yes")
-
- # Build The Pimp?
- ac_cv_my_have_gtksharp="${ac_cv_my_have_csharp}"
- PKG_CHECK_MODULES([GLIB_SHARP_20], [glib-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
- PKG_CHECK_MODULES([GTK_SHARP_20], [gtk-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
- AM_CONDITIONAL(USE_GTKSHARP, test "${ac_cv_my_have_gtksharp}" != no)
-
- AC_CONFIG_FILES([
- Makefile
- pipi/Makefile
- src/Makefile
- genethumb/Makefile
- examples/Makefile
- test/Makefile
- pipi-sharp/Makefile
- ThePimp/Makefile
- win32/Makefile
- ])
- AC_CONFIG_FILES([
- pipi/pipi_types.h
- pipi/pipi.pc
- pipi-sharp/pipi-sharp.pc
- pipi-sharp/pipi-sharp.dll.config
- ])
- AC_CONFIG_FILES([ThePimp/pimp], [chmod +x ThePimp/pimp])
-
- AC_OUTPUT
|