source: libpipi/trunk/configure.ac @ 4819

Last change on this file since 4819 was 4692, checked in by Sam Hocevar, 10 years ago

Look for highgui.h in addition to the opencv package.

File size: 8.8 KB
Line 
1# $Id$
2
3AC_INIT(libpipi, 0.0)
4AC_PREREQ(2.50)
5AC_CONFIG_AUX_DIR(.auto)
6AC_CANONICAL_SYSTEM
7AM_INIT_AUTOMAKE([no-define tar-ustar])
8dnl AM_MAINTAINER_MODE
9
10AM_CONFIG_HEADER(config.h)
11
12LT_MAJOR="0"
13LT_MINOR="0"
14LT_MICRO="0"
15AC_SUBST(LT_MAJOR)
16AC_SUBST(LT_MINOR)
17AC_SUBST(LT_MICRO)
18LT_VERSION="$LT_MAJOR:$LT_MINOR:$LT_MICRO"
19AC_SUBST(LT_VERSION)
20
21AM_PROG_CC_C_O
22AC_PROG_CPP
23AC_PROG_CXX
24AC_PROG_CXXCPP
25AC_PROG_OBJC
26_AM_DEPENDENCIES([OBJC])
27OBJC="${CC}"
28AC_SUBST(OBJC)
29AC_SUBST(OBJCFLAGS)
30
31AC_LIBTOOL_WIN32_DLL
32AM_PROG_LIBTOOL
33AC_LIBTOOL_CXX
34
35AC_C_CONST
36AC_C_INLINE
37
38dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
39dnl now otherwise it might be set in an obscure if statement. Same thing for
40dnl PKG_PROG_PKG_CONFIG which needs to be called first.
41AC_EGREP_CPP(yes, foo)
42PKG_PROG_PKG_CONFIG()
43m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
44if test "${build}" != "${host}" -a "${PKG_CONFIG_LIBDIR}" = ""; then
45  export PKG_CONFIG_LIBDIR=/dev/null
46fi
47
48AC_MSG_CHECKING(for library suffix)
49LT_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`"
50if test "$LT_SUFFIX" = ""; then
51  LT_SUFFIX=".so.$LT_MAJOR"
52  AC_MSG_RESULT([unknown, defaulting to $LT_SUFFIX])
53else
54  AC_MSG_RESULT($LT_SUFFIX)
55fi
56AC_SUBST(LT_SUFFIX)
57
58dnl language bindings
59AC_ARG_ENABLE(csharp,
60  [  --enable-csharp         C# bindings (autodetected)])
61
62dnl conditional builds
63AC_ARG_ENABLE(debug,
64  [  --enable-debug          build debug versions of the library (default no)])
65AC_ARG_ENABLE(tiles,
66  [  --enable-tiles          experimental tiles support (default no)])
67
68AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h)
69
70ac_cv_have_getopt_long="no"
71AC_CHECK_FUNCS(getopt_long,
72 [ac_cv_have_getopt_long="yes"],
73 [AC_CHECK_LIB(gnugetopt, getopt_long,
74   [ac_cv_have_getopt_long="yes"
75    GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
76if test "$ac_cv_have_getopt_long" != "no"; then
77  AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the ‘getopt_long’ function.)
78fi
79AM_CONDITIONAL(NEED_GETOPT_LONG, test "$ac_cv_have_getopt_long" = "no")
80AC_SUBST(GETOPT_LIBS)
81
82# How to get the C99 types. See pipi/pipi_types.h.in for details about
83# the PIPI_TYPES variable
84if test "${ac_cv_my_have_vga}" = "yes"; then
85  PIPI_TYPES=0
86else
87  AC_CHECK_HEADERS(stdint.h,
88    [PIPI_TYPES=1],
89    [AC_CHECK_HEADERS(inttypes.h,
90      [PIPI_TYPES=2],
91      [AC_CHECK_HEADERS(windows.h,
92        [PIPI_TYPES=3],
93        [PIPI_TYPES=0])])])
94fi
95AC_SUBST(PIPI_TYPES)
96
97# Optimizations
98CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
99# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
100CFLAGS="${CFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
101CXXFLAGS="${CXXFLAGS} -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wsign-compare"
102
103AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
104
105# Use SDL?
106ac_cv_my_have_sdl="no"
107save_CPPFLAGS="${CPPFLAGS}"
108AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
109if test "${SDL_CONFIG}" != "no"; then
110  CPPFLAGS="${CPPFLAGS} `sdl-config --cflags`"
111fi
112AC_CHECK_HEADERS(SDL_image.h,
113 [ac_cv_my_have_sdl="yes"],
114 [ac_cv_my_have_sdl="no"])
115CPPFLAGS="${save_CPPFLAGS}"
116if test "${ac_cv_my_have_sdl}" != "no"; then
117  AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL_image)
118fi
119AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
120
121# Use OpenCV?
122ac_cv_my_have_opencv="no"
123OPENCV="no"
124#FIXME: check for highgui, too.
125PKG_CHECK_MODULES(OPENCV, opencv,
126 [save_CPPFLAGS="${CPPFLAGS}"
127  CPPFLAGS="${CPPFLAGS} ${OPENCV_CFLAGS}"
128  AC_CHECK_HEADERS(highgui.h,
129   [ac_cv_my_have_opencv="yes"],
130   [:])
131  CPPFLAGS="${save_CPPFLAGS}"],
132 [:])
133if test "${ac_cv_my_have_opencv}" != "no"; then
134  AC_DEFINE(USE_OPENCV, 1, Define to 1 to use OpenCV)
135fi
136AM_CONDITIONAL(USE_OPENCV, test "${ac_cv_my_have_opencv}" = "yes")
137
138# Use Imlib2?
139ac_cv_my_have_imlib2="no"
140IMLIB2="no"
141PKG_CHECK_MODULES(IMLIB2, imlib2, [ac_cv_my_have_imlib2="yes"], [:])
142if test "${ac_cv_my_have_imlib2}" != "no"; then
143  AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2)
144fi
145AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes")
146
147# Use Windows GDI?
148ac_cv_my_have_gdi="no"
149GDI="no"
150AC_CHECK_HEADERS(windows.h,
151 [ac_cv_my_have_gdi="yes"],
152 [ac_cv_my_have_gdi="no"])
153if test "${ac_cv_my_have_gdi}" != "no"; then
154  AC_DEFINE(USE_GDI, 1, Define to 1 to use GDI)
155fi
156AM_CONDITIONAL(USE_GDI, test "${ac_cv_my_have_gdi}" = "yes")
157
158# Use Windows GDI+?
159ac_cv_my_have_gdiplus="no"
160AC_LANG_PUSH(C++)
161AC_CHECK_HEADERS(Gdiplus.h,
162 [ac_cv_my_have_gdiplus="yes"],
163 [ac_cv_my_have_gdiplus="no"],
164 [#include <windows.h>])
165AC_LANG_POP(C++)
166if test "${ac_cv_my_have_gdiplus}" != "no"; then
167  AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+)
168fi
169AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes")
170
171# Use Cocoa?
172ac_cv_my_have_cocoa="no"
173AC_CHECK_HEADERS(/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h,
174[
175 MACOSX_SDK_FRAMEWORKS="-F${MACOSX_SDK}/System/Library/Frameworks"
176 CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
177 CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
178 CXXFLAGS="${CXXFLAGS} ${MACOSX_SDK_CXXFLAGS}"
179 OBJCFLAGS="${OBJCFLAGS} ${MACOSX_SDK_CFLAGS}"
180 LDFLAGS="${ARCH} ${MACOSX_SDK_LDFLAGS} ${LDFLAGS}"
181 AC_DEFINE(USE_COCOA, 1, Define to 1 to activate the Cocoa backend driver)
182#    CACA_LIBS="${CACA_LIBS} -Wl,-syslibroot,${MACOSX_SDK},-framework,Cocoa"
183#    CACA_DRIVERS="${CACA_DRIVERS} cocoa"
184 ac_cv_my_have_cocoa="yes"],
185 [ac_cv_my_have_cocoa="no"]
186 )
187AM_CONDITIONAL(USE_COCOA, test "${ac_cv_my_have_cocoa}" = "yes")
188
189# Use libjpeg?
190ac_cv_my_have_jpeg="no"
191AC_CHECK_HEADERS(jpeglib.h,
192 [ac_cv_my_have_jpeg="yes"],
193 [ac_cv_my_have_jpeg="no"])
194if test "${ac_cv_my_have_jpeg}" != "no"; then
195  AC_DEFINE(USE_JPEG, 1, Define to 1 to use libjpeg)
196fi
197AM_CONDITIONAL(USE_JPEG, test "${ac_cv_my_have_jpeg}" = "yes")
198
199if 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
200  AC_MSG_ERROR([[cannot find GDI+, SDL_Image, Imlib2, Cocoa or OpenCV, please install one of them]])
201fi
202
203if test "${enable_debug}" = "yes"; then
204  AC_DEFINE(DEBUG, 1, Define to 1 to activate debug)
205fi
206
207if test "${enable_tiles}" = "yes"; then
208  AC_DEFINE(USE_TILES, 1, Define to 1 to activate experimental tiles)
209fi
210
211AC_SUBST(MATH_LIBS)
212
213# Build the .NET bindings?
214ac_cv_my_have_csharp="no"
215if test "${enable_csharp}" != "no"; then
216  AC_PATH_PROG(GMCS, gmcs, no)
217  AC_PATH_PROG(GACUTIL, gacutil, no)
218  if test "${GMCS}" != "no" -a "${GACUTIL}" != "no"; then
219    ac_cv_my_have_csharp="yes"
220  fi
221fi
222AM_CONDITIONAL(USE_CSHARP, test "${ac_cv_my_have_csharp}" = "yes")
223
224# Build the movie thumbnailer?
225ac_cv_my_have_ffmpeg="yes"
226PKG_CHECK_MODULES([LIBAVCODEC], [libavcodec-uninstalled], [:], [ac_cv_my_have_ffmpeg=no])
227PKG_CHECK_MODULES([LIBAVFORMAT], [libavformat-uninstalled], [:], [ac_cv_my_have_ffmpeg=no])
228PKG_CHECK_MODULES([LIBSWSCALE], [libswscale-uninstalled], [:], [ac_cv_my_have_ffmpeg=no])
229if test "${ac_cv_my_have_ffmpeg}" = "no"; then
230  ac_cv_my_have_ffmpeg="yes"
231  PKG_CHECK_MODULES([LIBAVCODEC], [libavcodec], [:], [ac_cv_my_have_ffmpeg=no])
232  PKG_CHECK_MODULES([LIBAVFORMAT], [libavformat], [:], [ac_cv_my_have_ffmpeg=no])
233  PKG_CHECK_MODULES([LIBSWSCALE], [libswscale], [:], [ac_cv_my_have_ffmpeg=no])
234fi
235if test "${ac_cv_my_have_ffmpeg}" != "no"; then
236  AC_DEFINE(USE_FFMPEG, 1, Define to 1 to use FFmpeg)
237fi
238AM_CONDITIONAL(USE_FFMPEG, test "${ac_cv_my_have_ffmpeg}" = "yes")
239
240# Build CGAL stuff?
241ac_cv_my_have_cgal="no"
242AC_LANG_PUSH(C++)
243AC_CHECK_HEADERS(CGAL/version.h,
244 [ac_cv_my_have_cgal="yes"],
245 [ac_cv_my_have_cgal="no"])
246AC_LANG_POP(C++)
247if test "${ac_cv_my_have_cgal}" != "no"; then
248  AC_DEFINE(USE_CGAL, 1, Define to 1 to use CGAL)
249fi
250AM_CONDITIONAL(USE_CGAL, test "${ac_cv_my_have_cgal}" = "yes")
251
252# Build The Pimp?
253ac_cv_my_have_gtksharp="${ac_cv_my_have_csharp}"
254PKG_CHECK_MODULES([GLIB_SHARP_20], [glib-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
255PKG_CHECK_MODULES([GTK_SHARP_20], [gtk-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
256AM_CONDITIONAL(USE_GTKSHARP, test "${ac_cv_my_have_gtksharp}" != no)
257
258AC_CONFIG_FILES([
259  Makefile
260  pipi/Makefile
261  src/Makefile
262  genethumb/Makefile
263  examples/Makefile
264  test/Makefile
265  pipi-sharp/Makefile
266  ThePimp/Makefile
267  win32/Makefile
268])
269AC_CONFIG_FILES([
270  pipi/pipi_types.h
271  pipi/pipi.pc
272  pipi-sharp/pipi-sharp.pc
273  pipi-sharp/pipi-sharp.dll.config
274])
275AC_CONFIG_FILES([ThePimp/pimp], [chmod +x ThePimp/pimp])
276
277AC_OUTPUT
278
Note: See TracBrowser for help on using the repository browser.