|
- # $Id$
-
- AC_INIT(libpipi, 0.0)
- AC_PREREQ(2.50)
- AC_CONFIG_AUX_DIR(.auto)
- AC_CANONICAL_SYSTEM
- AM_INIT_AUTOMAKE([subdir-objects no-define tar-ustar silent-rules])
- 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 -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
- CXXFLAGS="${CXXFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -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"
- #FIXME: check for highgui, too.
- PKG_CHECK_MODULES(OPENCV, opencv,
- [save_CPPFLAGS="${CPPFLAGS}"
- CPPFLAGS="${CPPFLAGS} ${OPENCV_CFLAGS}"
- AC_CHECK_HEADERS(highgui.h,
- [ac_cv_my_have_opencv="yes"],
- [:])
- CPPFLAGS="${save_CPPFLAGS}"],
- [:])
- 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 libjpeg?
- ac_cv_my_have_jpeg="no"
- AC_CHECK_HEADERS(jpeglib.h,
- [ac_cv_my_have_jpeg="yes"],
- [ac_cv_my_have_jpeg="no"])
- if test "${ac_cv_my_have_jpeg}" != "no"; then
- AC_DEFINE(USE_JPEG, 1, Define to 1 to use libjpeg)
- fi
- AM_CONDITIONAL(USE_JPEG, test "${ac_cv_my_have_jpeg}" = "yes")
-
- 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_jpeg}" = "no" -a "${ac_cv_my_have_gdiplus}" = "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 movie thumbnailer?
- ac_cv_my_have_ffmpeg="yes"
- PKG_CHECK_MODULES([LIBAVCODEC], [libavcodec-uninstalled], [:], [ac_cv_my_have_ffmpeg=no])
- PKG_CHECK_MODULES([LIBAVFORMAT], [libavformat-uninstalled], [:], [ac_cv_my_have_ffmpeg=no])
- PKG_CHECK_MODULES([LIBSWSCALE], [libswscale-uninstalled], [:], [ac_cv_my_have_ffmpeg=no])
- if test "${ac_cv_my_have_ffmpeg}" = "no"; then
- ac_cv_my_have_ffmpeg="yes"
- PKG_CHECK_MODULES([LIBAVCODEC], [libavcodec], [:], [ac_cv_my_have_ffmpeg=no])
- PKG_CHECK_MODULES([LIBAVFORMAT], [libavformat], [:], [ac_cv_my_have_ffmpeg=no])
- PKG_CHECK_MODULES([LIBSWSCALE], [libswscale], [:], [ac_cv_my_have_ffmpeg=no])
- fi
- # Disable for now
- ac_cv_my_have_ffmpeg="no"
- if test "${ac_cv_my_have_ffmpeg}" != "no"; then
- AC_DEFINE(USE_FFMPEG, 1, Define to 1 to use FFmpeg)
- fi
- AM_CONDITIONAL(USE_FFMPEG, test "${ac_cv_my_have_ffmpeg}" = "yes")
-
- # Build CGAL stuff?
- ac_cv_my_have_cgal="no"
- AC_LANG_PUSH(C++)
- AC_CHECK_HEADERS(CGAL/version.h,
- [ac_cv_my_have_cgal="yes"],
- [ac_cv_my_have_cgal="no"])
- AC_LANG_POP(C++)
- if test "${ac_cv_my_have_cgal}" != "no"; then
- AC_DEFINE(USE_CGAL, 1, Define to 1 to use CGAL)
- fi
- AM_CONDITIONAL(USE_CGAL, test "${ac_cv_my_have_cgal}" = "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
|