File: configure.in

package info (click to toggle)
libgdiplus 2.10-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 12,636 kB
  • sloc: ansic: 102,856; sh: 13,336; makefile: 870
file content (393 lines) | stat: -rw-r--r-- 12,810 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
AC_INIT(README)
AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(libgdiplus,2.10)

AM_MAINTAINER_MODE
AM_PROG_LIBTOOL

AC_C_BIGENDIAN

AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test "x$PKG_CONFIG" = "xno"; then
	AC_MSG_ERROR([You need to install pkg-config])
fi
GLIB_REQUIRED_VERSION="2.2.3"
PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)

GDIPLUS_LIBS="`pkg-config --libs glib-2.0 `"
GDIPLUS_CFLAGS="`pkg-config --cflags glib-2.0 `"

# libgdiplus bundles its own cairo 1.6.4 but if the system cairo is more recent then we use it instead
CAIRO_BUNDLED_VERSION="1.6.4"
PKG_CHECK_MODULES(CAIRO, cairo > $CAIRO_BUNDLED_VERSION, [cairo_v=system], [cairo_v=internal])

# Optional use (experimental and unsupported) of Pango's text rendering on top of Cairo
AC_ARG_WITH(pango, [  --with-pango],[text_v=pango],[text_v=cairo])

if test $cairo_v = "internal"; then
	# force subdirectories (cairo, specifically) to build their static
	# libraries using position independent code.
	ac_configure_args="$ac_configure_args --with-pic=yes"

	# disable the PNG, PDF and SVG surface backends of Cairo (unrequired for GDI+)
# cairo 1.6.4 bug - we can't disable PDF and keep PS backend - reported at https://bugs.freedesktop.org/show_bug.cgi?id=15532
#	ac_configure_args="$ac_configure_args --disable-png --disable-pdf --disable-svg"
	ac_configure_args="$ac_configure_args --disable-png --disable-svg"
# gdiplus mac note; if we have quartz and ft fonts, quartz is the default and gdi+ assumes the latter everywhere, force it out
# of the internal build
	ac_configure_args="$ac_configure_args --disable-quartz-font"

	AC_CONFIG_SUBDIRS([pixman cairo])
	CAIRO_DIR="pixman cairo"
	CAIRO_LIBS='$(top_builddir)/cairo/src/libcairo.la'
	CAIRO_CFLAGS='-I$(top_builddir)/pixman/pixman -I$(top_srcdir)/pixman/pixman -I$(top_builddir)/cairo/src -I$(top_srcdir)/cairo/src'
	cairo_info+="$CAIRO_BUNDLED_VERSION (internal)"
	AC_DEFINE(USE_INCLUDED_CAIRO,1,[Use Cairo/pixman bundled in libgdiplus])

	if test $text_v = "pango"; then
		AC_MSG_ERROR("Pango text rendering is only possible with --with-cairo=system")
	fi
else
	CAIRO_DIR=""
	CAIRO_LIBS="`pkg-config --libs cairo `"
	CAIRO_CFLAGS="`pkg-config --cflags cairo `"
	cairo_info="`pkg-config --modversion cairo ` (system)"
	GDIPLUS_PKG_REQ="cairo"

	if test $text_v = "pango"; then
		PANGO_REQUIRED_VERSION="1.10"
		PKG_CHECK_MODULES(PANGO, pango >= $PANGO_REQUIRED_VERSION)
		PANGO_LIBS="`pkg-config --libs pangocairo `"
		PANGO_CFLAGS="`pkg-config --cflags pangocairo `"
		AC_DEFINE(USE_PANGO_RENDERING,1,[Use Pango to measure and draw text (INCOMPLETE and UNSUPPORTED)])
		GDIPLUS_PKG_REQ="$GDIPLUS_PKG_REQ pangocairo-1.0"
	fi
fi

GDIPLUS_LIBS="$GDIPLUS_LIBS $CAIRO_LIBS $PANGO_LIBS"
GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS $CAIRO_CFLAGS $PANGO_CFLAGS"

# Fall back to using fontconfig/freetype-config if their .pc is not found
PKG_CHECK_MODULES(FONTCONFIG, fontconfig,
	[fontconfig_pkgconfig=yes], [fontconfig_pkgconfig=no])
if test "x$FONTCONFIG" = "xno"; then
	AC_PATH_PROG(FONTCONFIG_CONFIG, fontconfig-config, no)
	if test "x$FONTCONFIG_CONFIG" = "xyes"; then
		FONTCONFIG_CFLAGS="`fontconfig-config --cflags`"
		FONTCONFIG_LIBS="`fontconfig-config --libs`"
	fi
fi
AC_CHECK_LIB(fontconfig, FcInit)
AC_CHECK_FUNCS(FcFini)

PKG_CHECK_MODULES(FREETYPE2, freetype2,
	[freetype2_pkgconfig=yes], freetype2_pkgconfig=no])
if test "x$FREETYPE2" = "xno"; then
	AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
	if test "x$FREETYPE_CONFIG" = "xyes"; then
		FREETYPE2_CFLAGS="`freetype-config --cflags`"
		FREETYPE2_LIBS="`freetype-config --libs`"
	fi
fi

GDIPLUS_LIBS="$GDIPLUS_LIBS $FONTCONFIG_LIBS $FREETYPE2_LIBS"
GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS $FONTCONFIG_CFLAGS $FREETYPE2_CFLAGS"

# Add xrender here so that we don't fail to find glib if we won't have xrender.pc
GDIPLUS_LIBS="$GDIPLUS_LIBS `pkg-config --libs xrender `"
GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS `pkg-config --cflags xrender `"

AC_CHECK_HEADERS(byteswap.h)

AC_MSG_CHECKING([host threading settings])
case "$host" in
	*-*-mingw*|*-*-cygwin*)
		AC_DEFINE_UNQUOTED(CYGWIN,1,[Win32])
		AC_CHECK_LIB(intl, gettext)
		;;

	*-*-*netbsd*)
		AC_DEFINE_UNQUOTED(BSDOS,1,[NetBSD])
		;;

	*-*-*freebsd*)
		AC_DEFINE_UNQUOTED(BSDOS,1,[FreeBSD])
		CFLAGS="-D_THREAD_SAFE $CFLAGS"
		;;

	*-*-*openbsd*)
		AC_DEFINE_UNQUOTED(BSDOS,1,[OpenBSD])
		CFLAGS="$CFLAGS"
		LIBS="$LIBS"
		;;

	*-*-linux*)
		AC_DEFINE_UNQUOTED(LINUX,1,[Linux])
		AC_CHECK_LIB(pthread, pthread_create)
		;;

	*-*-solaris*)
		AC_DEFINE_UNQUOTED(SOLARIS,1,[Solaris])
		AC_DEFINE_UNQUOTED(_REENTRANT,1,[For libc reentrancy])
		CFLAGS="-pthreads $CFLAGS"
		;;

	*-*-darwin*)
		AC_DEFINE_UNQUOTED(OSX,1,[OS X])
		CFLAGS="-no-cpp-precomp $CFLAGS"
		LDFLAGS="-flat_namespace -undefined suppress $LDFLAGS"
		;;

	*)
		AC_MSG_RESULT(Unrecognized host $host)
		AC_DEFINE_UNQUOTED(OTHEROS,1,[Unknown])
		;;
esac

# Apparently for BSD special handling needs to happen
# See http://archives/neohapsis.com/archives/openbsd/2001-11/2142.html
# by Miod Vallat <miod@online.fr>
AC_CACHE_CHECK(
  [if compiler recognizes -pthread],
   myapp_cv_gcc_pthread,
   ac_save_CFLAGS=$CFLAGS
   CFLAGS="$CFLAGS -pthread"
   AC_LANG_SAVE
   AC_LANG_C
   AC_TRY_LINK([#include <pthread.h>],
               [void *p = pthread_create;],
                myapp_cv_gcc_pthread=yes,
                myapp_cv_gcc_pthread=no)
   AC_LANG_RESTORE
   CFLAGS=$ac_save_CFLAGS
)
if test $myapp_cv_gcc_pthread = yes
then
   myapp_threads=""
   CFLAGS="$CFLAGS -pthread"
else
   AC_CHECK_LIB(pthread,pthread_create,myapp_threads=-lpthread,
                [AC_CHECK_LIB(c_r,pthread_create,myapp_threads=-lc_r)])
fi


# sigsetjmp is a macro on some platforms, so can't use AC_CHECK_FUNCS
AC_MSG_CHECKING(for sigsetjmp)
AC_TRY_LINK([#include <setjmp.h>], [
sigjmp_buf env;
sigsetjmp(env, 0);
], gdip_ok=yes, gdip_ok=no)
AC_MSG_RESULT($gdip_ok)
if test "$gdip_ok" = "yes"; then
  AC_DEFINE(HAVE_SIGSETJMP, 1, sigsetjmp is available)
fi


# when possible hide stuff we don't want to export
AC_MSG_CHECKING(for visibility __attribute__)
AC_TRY_COMPILE([], [
   void __attribute__ ((visibility ("hidden"))) doit (void) {}
   void main () { doit (); }
], [
   have_visibility_hidden=yes
   AC_MSG_RESULT(yes)
], [
   have_visibility_hidden=no
   AC_MSG_RESULT(no)
])

case "$host" in
	i*86-*-*)
		case $host_os in
		  solaris*)
			# On solaris 10 x86, gcc prints a warning saying 'visibility attribute not supported on this configuration; ignored', but linking fails.
			have_visibility_hidden=no
		esac
		;;
esac

if test "x$have_visibility_hidden" = "xyes"; then
   AC_DEFINE(HAVE_VISIBILITY_HIDDEN, 1, [Support for the visibility ("hidden") attribute])
fi


AC_ARG_WITH(libjpeg,
	[AC_HELP_STRING([--without-libjpeg], [disable JPEG file IO])])
AC_ARG_WITH(libtiff,
	[AC_HELP_STRING([--without-libtiff], [disable TIFF file IO])])
AC_ARG_WITH(libgif,
	[AC_HELP_STRING([--without-libgif], [disable GIF file IO])])
AC_ARG_WITH(libexif,
	[AC_HELP_STRING([--without-libexif], [disable EXIF support])])

dnl Test for libtiff
  if test x$with_libtiff != xno && test -z "$LIBTIFF"; then
    AC_CHECK_LIB(tiff, TIFFReadScanline,
      [AC_CHECK_HEADER(tiffio.h,
        TIFF='tiff'; LIBTIFF='-ltiff',
        AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
      [AC_CHECK_LIB(tiff, TIFFWriteScanline,
        [AC_CHECK_HEADER(tiffio.h,
          TIFF='tiff'; LIBTIFF='-ltiff -ljpeg -lz',
          AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
        [AC_CHECK_LIB(tiff34, TIFFFlushData,
          [AC_CHECK_HEADER(tiffio.h,
            TIFF='tiff'; LIBTIFF='-ltiff34 -ljpeg -lz',
            AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
        AC_MSG_WARN(*** TIFF plug-in will not be built (TIFF library not found) ***),  -lz -lm)], -ljpeg -lz -lm)], -lm)
  fi

if test x$TIFF != x; then
  GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBTIFF"
  AC_DEFINE(HAVE_LIBTIFF, 1, Define if tiff support is available)
fi

dnl Test for libjpeg
  if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then
    AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
      jpeg_ok=yes,
      jpeg_ok=no
      AC_MSG_WARN(*** JPEG loader will not be built (JPEG library not found) ***))
    if test "$jpeg_ok" = yes; then
      AC_MSG_CHECKING([for jpeglib.h])
      AC_TRY_CPP(
[#include <stdio.h>
#undef PACKAGE
#undef VERSION
#undef HAVE_STDLIB_H
#include <jpeglib.h>],
        jpeg_ok=yes,
        jpeg_ok=no)
      AC_MSG_RESULT($jpeg_ok)
      if test "$jpeg_ok" = yes; then
        JPEG='jpeg'; LIBJPEG='-ljpeg'
      else
        AC_MSG_WARN(*** JPEG loader will not be built (JPEG header file not found) ***)
      fi
    fi
  fi

if test x$JPEG != x; then
  GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBJPEG"
  AC_DEFINE(HAVE_LIBJPEG, 1, Define if jpeg support is available)
fi

dnl Test for libgif or libungif
  if test x$with_libgif != xno && test -z "$LIBGIF"; then
    AC_CHECK_LIB(gif, DGifOpenFileName,
      [AC_CHECK_HEADER(gif_lib.h,
        GIF='gif'; LIBGIF='-lgif',
	AC_MSG_WARN(*** GIF loader will not be built (giflibrary not found) ***))],
      AC_MSG_WARN(*** GIF loader will not be built (giflibrary not found) ***))

    AC_CHECK_LIB(ungif, DGifOpenFileName,
      [AC_CHECK_HEADER(gif_lib.h,
	GIF='ungif'; LIBGIF='-lungif',
	AC_MSG_WARN(*** GIF loader will not be built (ungiflibrary not found) ***))],
      AC_MSG_WARN(*** GIF loader will not be built (ungiflibrary not found) ***))
  fi

if test x$GIF != x; then
  GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBGIF"
  AC_DEFINE(HAVE_LIBGIF, 1, Define if gif support is available)
fi

dnl Test for libpng
    AC_MSG_CHECKING(for libpng12)
    if $PKG_CONFIG --exists libpng12 ; then
        AC_MSG_RESULT(yes)
        PNG='png'
	PNG_DEP_CFLAGS_PACKAGES=libpng12
	LIBPNG=`$PKG_CONFIG --libs libpng12`
    else
      AC_MSG_RESULT(no)
      AC_CHECK_LIB(png, png_read_info,
        [AC_CHECK_HEADER(png.h,
          png_ok=yes,
          png_ok=no)],
        AC_MSG_ERROR(*** libpng12 not found. See http://www.libpng.org/pub/png/libpng.html.), -lz -lm)
      if test "$png_ok" = yes; then
        AC_MSG_CHECKING([for png_structp in png.h])
        AC_TRY_COMPILE([#include <png.h>],
          [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;],
          png_ok=yes,
          png_ok=no)
        AC_MSG_RESULT($png_ok)
        if test "$png_ok" = yes; then
          PNG='png'; LIBPNG='-lpng -lz'
        else
          AC_MSG_ERROR(*** libpng12 found, but it is too old. See http://www.libpng.org/pub/png/libpng.html.)
        fi
      else
          AC_MSG_ERROR(*** libpng12 not found. See http://www.libpng.org/pub/png/libpng.html.)
      fi
    fi


GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBPNG"
AC_DEFINE(HAVE_LIBPNG, 1, Define if png support is available. Always defined.)

dnl Test for libexif
if test x$with_libexif != xno && test -z "$LIBEXIF"; then
  PKG_CHECK_MODULES(LIBEXIF, libexif, [libexif_pkgconfig=yes], libexif_pkgconfig=no])
  if test x$libexif_pkgconfig = xyes ; then
	GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS $LIBEXIF_CFLAGS"
	GDIPLUS_LIBS="$GDIPLUS_LIBS $LIBEXIF_LIBS"
	AC_DEFINE(HAVE_LIBEXIF, 1, Define if libexif is available.)
  else
	libexif_pkgconfig="No. Get it from http://libexif.sourceforge.net/"
  fi
else
	libexif_pkgconfig="No. You disabled it."
fi
AM_CONDITIONAL(HAVE_LIBEXIF, test x$libexif_pkgconfig = xyes)

dnl
dnl Produce a diagnostic, to reduce support time
dnl
AC_TRY_COMPILE([#include <X11/Xlib.h>],
			 [],[x11_failed=false],[x11_failed=true])
if $x11_failed; then
   AC_ERROR("Failed to compile with X11/Xlib.h include.  You must fix your compiler paths")
fi

GDIPLUS_PKG_LIBS="$GDIPLUS_LIBS"
GDIPLUS_PKG_CFLAGS="$GDIPLUS_CFLAGS"
 
AC_SUBST(GDIPLUS_LIBS)
AC_SUBST(GDIPLUS_CFLAGS)
AC_SUBST(GDIPLUS_PKG_LIBS)
AC_SUBST(GDIPLUS_PKG_CFLAGS)
AC_SUBST(GDIPLUS_PKG_REQ)
AC_SUBST(CAIRO_DIR)

AC_OUTPUT([
Makefile
libgdiplus.pc
libgdiplus0.spec
src/Makefile
tests/Makefile])

echo "---"
echo "Configuration summary"
echo ""
echo "   * Installation prefix = $prefix"
echo "   * Cairo = $cairo_info"
echo "   * Text = $text_v"
echo "   * EXIF tags = $libexif_pkgconfig"
echo "   * Codecs supported:"
echo ""
echo $ECHO_N "      - TIFF: "
test ! x$TIFF = x && echo yes || echo "no (Get it from http://www.libtiff.org/)"
echo $ECHO_N "      - JPEG: "
test ! x$JPEG = x && echo yes || echo "no (Get it from http://freshmeat.net/projects/libjpeg)"
echo $ECHO_N "      - GIF: "
test ! x$GIF = x && echo yes || echo "no (See http://sourceforge.net/projects/libgif)"
echo $ECHO_N "      - PNG: yes"
echo ""
echo "      NOTE: if any of the above say 'no' you may install the"
echo "            corresponding development packages for them, rerun"
echo "            autogen.sh to include them in the build."
echo ""
echo "---"