]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/libsdl-image/contrib/configure.in
update
[l4.git] / l4 / pkg / libsdl-image / contrib / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(README)
3
4 dnl Set various version strings - taken gratefully from the GTk sources
5
6 # Making releases:
7 #   MICRO_VERSION += 1;
8 #   INTERFACE_AGE += 1;
9 #   BINARY_AGE += 1;
10 # if any functions have been added, set INTERFACE_AGE to 0.
11 # if backwards compatibility has been broken,
12 # set BINARY_AGE and INTERFACE_AGE to 0.
13
14 MAJOR_VERSION=1
15 MINOR_VERSION=2
16 MICRO_VERSION=11
17 INTERFACE_AGE=3
18 BINARY_AGE=11
19 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
20
21 AC_SUBST(MAJOR_VERSION)
22 AC_SUBST(MINOR_VERSION)
23 AC_SUBST(MICRO_VERSION)
24 AC_SUBST(INTERFACE_AGE)
25 AC_SUBST(BINARY_AGE)
26 AC_SUBST(VERSION)
27
28 # libtool versioning
29 LT_INIT([win32-dll])
30
31 LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
32 LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
33 LT_REVISION=$INTERFACE_AGE
34 LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
35
36 AC_SUBST(LT_RELEASE)
37 AC_SUBST(LT_CURRENT)
38 AC_SUBST(LT_REVISION)
39 AC_SUBST(LT_AGE)
40
41 dnl Detect the canonical build and host environments
42 AC_CANONICAL_HOST
43
44 dnl Setup for automake
45 AM_INIT_AUTOMAKE(SDL_image, $VERSION)
46
47 dnl Check for tools
48 AC_PROG_LIBTOOL
49 AC_PROG_CC
50 AC_C_INLINE
51 AC_PROG_INSTALL
52 AC_PROG_MAKE_SET
53 if test -z "$host_alias"; then
54     hostaliaswindres=
55 else
56     hostaliaswindres="$host_alias-windres"
57 fi
58 AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres])
59
60 case "$host" in
61     *-*-beos*)
62         ac_default_prefix=/boot/develop/tools/gnupro
63         ;;
64     *-*-cygwin* | *-*-mingw32*)
65         if test "$build" != "$host"; then # cross-compiling
66             # Default cross-compile location
67             ac_default_prefix=/usr/local/cross-tools/i386-mingw32
68         else
69             # Look for the location of the tools and install there
70             if test "$BUILD_PREFIX" != ""; then
71                 ac_default_prefix=$BUILD_PREFIX
72             fi
73         fi
74         if test x$WINDRES != x; then
75             use_version_rc=true
76         fi
77         ;;
78     *-*-darwin*)
79         AC_ARG_ENABLE([imageio], [AC_HELP_STRING([--enable-imageio], [use native Mac OS X frameworks for loading images [default=yes]])],
80                       [], [enable_imageio=yes])
81         if test x$enable_imageio = xyes; then
82             IMG_LIBS="-Wl,-framework,ApplicationServices $IMG_LIBS"
83         else
84             CFLAGS="$CFLAGS -DSDL_IMAGE_USE_COMMON_BACKEND"
85         fi
86         ;;
87 esac
88 AM_CONDITIONAL(USE_VERSION_RC, test x$use_version_rc = xtrue)
89
90 dnl set this to use on systems that use lib64 instead of lib
91 base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
92
93 dnl Function to find a library in the compiler search path
94 find_lib()
95 {
96     gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
97     gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
98     env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
99     if test "$cross_compiling" = yes; then
100         host_lib_path=""
101     else
102         host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
103     fi
104     for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do
105         lib=[`ls -- $path/$1 2>/dev/null | sort | sed 's/.*\/\(.*\)/\1/; q'`]
106         if test x$lib != x; then
107             echo $lib
108             return
109         fi
110     done
111 }
112
113 dnl Check for SDL
114 SDL_VERSION=1.2.10
115 AC_SUBST(SDL_VERSION)
116 AM_PATH_SDL($SDL_VERSION,
117             :,
118            AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
119 )
120 CFLAGS="$CFLAGS $SDL_CFLAGS"
121 LIBS="$LIBS $SDL_LIBS"
122 saved_LIBS="$LIBS"
123
124 dnl Check command-line options
125 AC_ARG_ENABLE([bmp], [AC_HELP_STRING([--enable-bmp], [support loading BMP/ICO/CUR images [default=yes]])],
126  [], [enable_bmp=yes])
127 AC_ARG_ENABLE([gif], [AC_HELP_STRING([--enable-gif], [support loading GIF images [default=yes]])],
128  [], [enable_gif=yes])
129 AC_ARG_ENABLE([jpg], [AC_HELP_STRING([--enable-jpg], [support loading JPG images [default=yes]])],
130  [], [enable_jpg=yes])
131 AC_ARG_ENABLE([jpg-shared], AC_HELP_STRING([--enable-jpg-shared], [dynamically load JPG support [[default=yes]]]),
132  [], [enable_jpg_shared=yes])
133 AC_ARG_ENABLE([lbm], [AC_HELP_STRING([--enable-lbm], [support loading LBM images [default=yes]])],
134  [], [enable_lbm=yes])
135 AC_ARG_ENABLE([pcx], [AC_HELP_STRING([--enable-pcx], [support loading PCX images [default=yes]])],
136  [], [enable_pcx=yes])
137 AC_ARG_ENABLE([png], [AC_HELP_STRING([--enable-png], [support loading PNG images [default=yes]])],
138  [], [enable_png=yes])
139 AC_ARG_ENABLE([png-shared], AC_HELP_STRING([--enable-png-shared], [dynamically load PNG support [[default=yes]]]),
140  [], [enable_png_shared=yes])
141 AC_ARG_ENABLE([pnm], [AC_HELP_STRING([--enable-pnm], [support loading PNM images [default=yes]])],
142  [], [enable_pnm=yes])
143 AC_ARG_ENABLE([tga], [AC_HELP_STRING([--enable-tga], [support loading TGA images [default=yes]])],
144  [], [enable_tga=yes])
145 AC_ARG_ENABLE([tif], [AC_HELP_STRING([--enable-tif], [support loading TIFF images [default=yes]])],
146  [], [enable_tif=yes])
147 AC_ARG_ENABLE([tif-shared], AC_HELP_STRING([--enable-tif-shared], [dynamically load TIFF support [[default=yes]]]),
148  [], [enable_tif_shared=yes])
149 AC_ARG_ENABLE([xcf], [AC_HELP_STRING([--enable-xcf], [support loading XCF images [default=yes]])],
150  [], [enable_xcf=yes])
151 AC_ARG_ENABLE([xpm], [AC_HELP_STRING([--enable-xpm], [support loading XPM images [default=yes]])],
152  [], [enable_xpm=yes])
153 AC_ARG_ENABLE([xv], [AC_HELP_STRING([--enable-xv], [support loading XV images [default=yes]])],
154  [], [enable_xv=yes])
155
156 if test x$enable_jpg = xyes || test x$enable_tif = xyes; then
157     AC_CHECK_HEADER([jpeglib.h], [have_jpg_hdr=yes])
158     AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], [have_jpg_lib=yes])
159     if test x$have_jpg_hdr = xyes -a x$have_jpg_lib = xyes; then
160         if test x$enable_jpg = xyes; then
161             AC_DEFINE([LOAD_JPG])
162         fi
163         LIBS="-ljpeg $LIBS"
164
165         case "$host" in
166             *-*-darwin*)
167                 jpg_lib=[`find_lib libjpeg.dylib`]
168                 ;;
169             *-*-cygwin* | *-*-mingw32*)
170                 jpg_lib=[`find_lib "jpeg.dll"`]
171                 ;;
172             *)
173                 jpg_lib=[`find_lib "libjpeg.so.[0-9]"`]
174                 if test x$jpg_lib = x; then
175                     jpg_lib=[`find_lib "libjpeg.so.[0-9][0-9]"`]
176                 fi
177                 if test x$jpg_lib = x; then
178                     jpg_lib=[`find_lib "libjpeg.so.[0-9]*"`]
179                 fi
180                 ;;
181         esac
182     elif test x$enable_jpg = xyes; then
183         AC_MSG_WARN([*** Unable to find JPEG library (http://www.ijg.org/)])
184         AC_MSG_WARN([JPG image loading disabled])
185     fi
186 fi
187
188 if test "x$enable_png" = xyes; then
189     PKG_CHECK_MODULES([LIBPNG], [libpng], [dnl
190         have_png_hdr=yes
191         CFLAGS="$LIBPNG_CFLAGS $CFLAGS"
192         have_png_lib=yes
193       ], [dnl
194         AC_CHECK_HEADER([png.h], [have_png_hdr=yes])
195         AC_CHECK_LIB([png], [png_create_read_struct], [have_png_lib=yes], [], [-lz])
196       ])
197     if test x$have_png_hdr = xyes -a x$have_png_lib = xyes; then
198         AC_DEFINE([LOAD_PNG])
199
200         case "$host" in
201             *-*-darwin*)
202                 png_lib=[`find_lib libpng.dylib`]
203                 ;;
204             *-*-cygwin* | *-*-mingw32*)
205                 png_lib=[`find_lib "libpng*.dll"`]
206                 ;;
207             *)
208                 png_lib=[`find_lib "libpng.so.[0-9]"`]
209                 if test x$png_lib = x; then
210                     png_lib=[`find_lib "libpng.so.[0-9]*"`]
211                 fi
212                 if test x$png_lib = x; then
213                     png_lib=[`find_lib "libpng*.so.[0-9]"`]
214                 fi
215                 if test x$png_lib = x; then
216                     png_lib=[`find_lib "libpng*.so.[0-9]*"`]
217                 fi
218                 ;;
219         esac
220     else
221         AC_MSG_WARN([*** Unable to find PNG library (http://www.libpng.org/pub/png/libpng.html)])
222         AC_MSG_WARN([PNG image loading disabled])
223     fi
224 fi
225
226 if test x$enable_tif = xyes; then
227     AC_CHECK_HEADER([tiffio.h], [have_tif_hdr=yes])
228     AC_CHECK_LIB([tiff], [TIFFClientOpen], [have_tif_lib=yes], [], [-lz])
229     if test x$have_tif_hdr = xyes -a x$have_tif_lib = xyes; then
230         AC_DEFINE([LOAD_TIF])
231
232         case "$host" in
233             *-*-darwin*)
234                 tif_lib=[`find_lib libtiff.dylib`]
235                 ;;
236             *-*-cygwin* | *-*-mingw32*)
237                 tif_lib=[`find_lib "libtiff-*.dll"`]
238                 ;;
239             *)
240                 tif_lib=[`find_lib "libtiff.so.[0-9]"`]
241                 if test x$tif_lib = x; then
242                     tif_lib=[`find_lib "libtiff.so.[0-9]*"`]
243                 fi
244                 ;;
245         esac
246     else
247         AC_MSG_WARN([*** Unable to find Tiff library (http://www.remotesensing.org/libtiff/)])
248         AC_MSG_WARN([TIF image loading disabled])
249     fi
250 fi
251
252 if test x$enable_bmp = xyes; then
253     AC_DEFINE([LOAD_BMP])
254 fi
255
256 if test x$enable_gif = xyes; then
257     AC_DEFINE([LOAD_GIF])
258 fi
259
260 if test x$enable_lbm = xyes; then
261     AC_DEFINE([LOAD_LBM])
262 fi
263
264 if test x$enable_pcx = xyes; then
265     AC_DEFINE([LOAD_PCX])
266 fi
267
268 if test x$enable_pnm = xyes; then
269     AC_DEFINE([LOAD_PNM])
270 fi
271
272 if test x$enable_tga = xyes; then
273     AC_DEFINE([LOAD_TGA])
274 fi
275
276 if test x$enable_xcf = xyes; then
277     AC_DEFINE([LOAD_XCF])
278 fi
279
280 if test x$enable_xpm = xyes; then
281     AC_DEFINE([LOAD_XPM])
282 fi
283
284 if test x$enable_xv = xyes; then
285     AC_DEFINE([LOAD_XV])
286 fi
287
288 if test x$enable_tif = xyes -a x$have_tif_hdr = xyes -a x$have_tif_lib = xyes; then
289     if test x$enable_tif_shared = xyes && test x$tif_lib != x; then
290         echo "-- dynamic libtiff -> $tif_lib"
291         AC_DEFINE_UNQUOTED(LOAD_TIF_DYNAMIC, "$tif_lib")
292     else
293         if test x$have_libjpeg = xyes; then
294             # Disable dynamic jpeg since we're linking it explicitly
295             jpg_lib=''
296         fi
297         IMG_LIBS="-ltiff -lz $IMG_LIBS"
298     fi
299 fi
300 if test x$enable_jpg = xyes -a x$have_jpg_hdr = xyes -a x$have_jpg_lib = xyes; then
301     if test x$enable_jpg_shared = xyes && test x$jpg_lib != x; then
302         echo "-- dynamic libjpeg -> $jpg_lib"
303         AC_DEFINE_UNQUOTED(LOAD_JPG_DYNAMIC, "$jpg_lib")
304     else
305         IMG_LIBS="-ljpeg $IMG_LIBS"
306     fi
307 fi
308 if test x$enable_png = xyes -a x$have_png_hdr = xyes -a x$have_png_lib = xyes; then
309     if test x$enable_png_shared = xyes && test x$png_lib != x; then
310         echo "-- dynamic libpng -> $png_lib"
311         AC_DEFINE_UNQUOTED(LOAD_PNG_DYNAMIC, "$png_lib")
312     else
313         IMG_LIBS="-lpng -lz $IMG_LIBS"
314     fi
315 fi
316
317 LIBS="$saved_LIBS"
318
319 AC_SUBST([WINDRES])
320 AC_SUBST([IMG_LIBS])
321
322 # Finally create all the generated files
323 AC_OUTPUT([
324 Makefile
325 SDL_image.spec
326 SDL_image.pc
327 ])