source: libpipi/trunk/configure.ac @ 3075

Last change on this file since 3075 was 3075, checked in by Jean-Yves Lamoureux, 12 years ago
  • Added 'Modular' codec as a testbed for hand-written codecs, as well as a JPEG decoder (libjpeg). Some stuff are

temporary, though.

File size: 7.5 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
58AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h)
59
60ac_cv_have_getopt_long="no"
61AC_CHECK_FUNCS(getopt_long,
62 [ac_cv_have_getopt_long="yes"],
63 [AC_CHECK_LIB(gnugetopt, getopt_long,
64   [ac_cv_have_getopt_long="yes"
65    GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
66if test "$ac_cv_have_getopt_long" != "no"; then
67  AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)
68fi
69AM_CONDITIONAL(NEED_GETOPT_LONG, test "$ac_cv_have_getopt_long" = "no")
70AC_SUBST(GETOPT_LIBS)
71
72# How to get the C99 types. See pipi/pipi_types.h.in for details about
73# the PIPI_TYPES variable
74if test "${ac_cv_my_have_vga}" = "yes"; then
75  PIPI_TYPES=0
76else
77  AC_CHECK_HEADERS(stdint.h,
78    [PIPI_TYPES=1],
79    [AC_CHECK_HEADERS(inttypes.h,
80      [PIPI_TYPES=2],
81      [AC_CHECK_HEADERS(windows.h,
82        [PIPI_TYPES=3],
83        [PIPI_TYPES=0])])])
84fi
85AC_SUBST(PIPI_TYPES)
86
87# Optimizations
88CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
89# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
90CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
91
92
93AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
94
95# Use DevIL?
96#AC_CHECK_HEADERS(IL/il.h,
97# [ac_cv_my_have_il="yes"],
98# [ac_cv_my_have_il="no"])
99#CPPFLAGS="${save_CPPFLAGS}"
100#AM_CONDITIONAL(USE_IL, test "${ac_cv_my_have_il}" = "yes")
101
102# Use Windows?
103#AC_CHECK_HEADERS(olectl.h,
104# [ac_cv_my_have_ole="yes"],
105# [ac_cv_my_have_ole="no"])
106#CPPFLAGS="${save_CPPFLAGS}"
107#AM_CONDITIONAL(USE_OLE, test "${ac_cv_my_have_ole}" = "yes")
108
109# Use SDL?
110ac_cv_my_have_sdl="no"
111save_CPPFLAGS="${CPPFLAGS}"
112AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
113if test "${SDL_CONFIG}" != "no"; then
114  CPPFLAGS="${CPPFLAGS} `sdl-config --cflags`"
115fi
116AC_CHECK_HEADERS(SDL_image.h,
117 [ac_cv_my_have_sdl="yes"],
118 [ac_cv_my_have_sdl="no"])
119CPPFLAGS="${save_CPPFLAGS}"
120if test "${ac_cv_my_have_sdl}" != "no"; then
121  AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL_image)
122fi
123AM_CONDITIONAL(USE_SDL, test "${ac_cv_my_have_sdl}" = "yes")
124
125# Use OpenCV?
126ac_cv_my_have_opencv="no"
127OPENCV="no"
128PKG_CHECK_MODULES(OPENCV, opencv, [ac_cv_my_have_opencv="yes"], [:])
129if test "${ac_cv_my_have_opencv}" != "no"; then
130  AC_DEFINE(USE_OPENCV, 1, Define to 1 to use OpenCV)
131fi
132AM_CONDITIONAL(USE_OPENCV, test "${ac_cv_my_have_opencv}" = "yes")
133
134# Use Imlib2?
135ac_cv_my_have_imlib2="no"
136IMLIB2="no"
137PKG_CHECK_MODULES(IMLIB2, imlib2, [ac_cv_my_have_imlib2="yes"], [:])
138if test "${ac_cv_my_have_imlib2}" != "no"; then
139  AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2)
140fi
141AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes")
142
143# Use Windows GDI?
144ac_cv_my_have_gdi="no"
145GDI="no"
146AC_CHECK_HEADERS(windows.h,
147 [ac_cv_my_have_gdi="yes"],
148 [ac_cv_my_have_gdi="no"])
149if test "${ac_cv_my_have_gdi}" != "no"; then
150  AC_DEFINE(USE_GDI, 1, Define to 1 to use GDI)
151fi
152AM_CONDITIONAL(USE_GDI, test "${ac_cv_my_have_gdi}" = "yes")
153
154# Use Windows GDI+?
155ac_cv_my_have_gdiplus="no"
156AC_LANG_PUSH(C++)
157AC_CHECK_HEADERS(Gdiplus.h,
158 [ac_cv_my_have_gdiplus="yes"],
159 [ac_cv_my_have_gdiplus="no"],
160 [#include <windows.h>])
161AC_LANG_POP(C++)
162if test "${ac_cv_my_have_gdiplus}" != "no"; then
163  AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+)
164fi
165AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes")
166
167# Use Cocoa?
168ac_cv_my_have_cocoa="no"
169AC_CHECK_HEADERS(/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h,
170[
171 MACOSX_SDK_FRAMEWORKS="-F${MACOSX_SDK}/System/Library/Frameworks"
172 CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
173 CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
174 CXXFLAGS="${CXXFLAGS} ${MACOSX_SDK_CXXFLAGS}"
175 OBJCFLAGS="${OBJCFLAGS} ${MACOSX_SDK_CFLAGS}"
176 LDFLAGS="${ARCH} ${MACOSX_SDK_LDFLAGS} ${LDFLAGS}"
177 AC_DEFINE(USE_COCOA, 1, Define to 1 to activate the Cocoa backend driver)
178#    CACA_LIBS="${CACA_LIBS} -Wl,-syslibroot,${MACOSX_SDK},-framework,Cocoa"
179#    CACA_DRIVERS="${CACA_DRIVERS} cocoa"
180 ac_cv_my_have_cocoa="yes"],
181 [ac_cv_my_have_cocoa="no"]
182 )
183AM_CONDITIONAL(USE_COCOA, test "${ac_cv_my_have_cocoa}" = "yes")
184
185
186# Use Modular codecs ?
187MODULAR_CODEC=""
188ac_cv_my_have_modular="no"
189
190ac_cv_my_have_libjpeg="no"
191AC_CHECK_HEADERS(jpeglib.h,
192 [ac_cv_my_have_libjpeg="yes"],
193 [ac_cv_my_have_libjpeg="no"])
194if test "${ac_cv_my_have_libjpeg}" != "no"; then
195  ac_cv_my_have_modular="yes"
196  AC_DEFINE(USE_LIBJPEG, 1, Define to 1 to use libjpeg)
197  AC_DEFINE(USE_MODULAR, 1, Define to 1 to use modular codecs)
198  MODULAR_CODEC="${MODULAR_CODEC} libjpeg"
199fi
200AM_CONDITIONAL(USE_LIBJPEG, test "${ac_cv_my_have_libjpeg}" = "yes")
201AM_CONDITIONAL(USE_MODULAR, test "${ac_cv_my_have_modular}" = "yes")
202
203AC_MSG_CHECKING(valid modular codecs)
204if test -z "${MODULAR_CODEC}"; then
205  AC_MSG_RESULT(none)
206else
207  MODULAR_CODEC="${MODULAR_CODEC# *}"
208  AC_MSG_RESULT([${MODULAR_CODEC}])
209fi
210
211
212
213if test "${ac_cv_my_have_il}" = "no" -a "${ac_cv_my_have_ole}" = "no" -a "${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
214  AC_MSG_ERROR([[cannot find DevIL, OLE, SDL_Image, Imlib2, Cocoa, or OpenCV, please install one of them]])
215fi
216
217AC_SUBST(MATH_LIBS)
218
219# Build pipi-sharp?
220AC_PATH_PROG(GMCS, gmcs, no)
221AC_PATH_PROG(GACUTIL, gacutil, no)
222AM_CONDITIONAL(USE_CSHARP, test "${GMCS}" != "no" -a "${GACUTIL}" != "no")
223
224# Build The Pimp?
225ac_cv_my_have_gtksharp=yes
226PKG_CHECK_MODULES([GLIB_SHARP_20], [glib-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
227PKG_CHECK_MODULES([GTK_SHARP_20], [gtk-sharp-2.0], [:], [ac_cv_my_have_gtksharp=no])
228AM_CONDITIONAL(USE_GTKSHARP, test "${ac_cv_my_have_gtksharp}" != no)
229
230AC_CONFIG_FILES([
231  Makefile
232  pipi/Makefile
233  src/Makefile
234  genethumb/Makefile
235  examples/Makefile
236  test/Makefile
237  pipi-sharp/Makefile
238  ThePimp/Makefile
239  win32/Makefile
240])
241AC_CONFIG_FILES([
242  pipi/pipi_types.h
243  pipi/pipi.pc
244  pipi-sharp/pipi-sharp.pc
245  pipi-sharp/pipi-sharp.dll.config
246])
247AC_CONFIG_FILES([ThePimp/pimp], [chmod +x ThePimp/pimp])
248
249AC_OUTPUT
250
Note: See TracBrowser for help on using the repository browser.