configure.in 57.9 KB
Newer Older
1
# Process this file with autoconf to produce a configure script.
Elliot Lee's avatar
Elliot Lee committed
2

3
AC_PREREQ(2.54)
4

5
# Making releases on the stable branch:
6 7
#   GIMP_MICRO_VERSION += 1;
#   GIMP_INTERFACE_AGE += 1;
8

9
m4_define([gimp_major_version], [2])
Sven Neumann's avatar
Sven Neumann committed
10
m4_define([gimp_minor_version], [5])
Sven Neumann's avatar
Sven Neumann committed
11
m4_define([gimp_micro_version], [1])
12 13 14
m4_define([gimp_real_version],
          [gimp_major_version.gimp_minor_version.gimp_micro_version])
m4_define([gimp_version], [gimp_real_version])
Sven Neumann's avatar
Sven Neumann committed
15
m4_define([gimp_interface_age], [0])
16 17
m4_define([gimp_binary_age],
          [m4_eval(100 * gimp_minor_version + gimp_micro_version)])
18 19

# For overriding the version string. Comment out if not needed.
20
# m4_define([gimp_version], [2.5.0])
21 22

# This is the X.Y used in -lgimp-X.Y
23
m4_define([gimp_api_version], [2.0])
24 25 26

# Versions used for apps, plugins, tools, pkg-config files, and data,
# as well as global and user prefs
27
m4_define([gimp_app_version], [2.5])
28 29
m4_define([gimp_plugin_version], [2.0])
m4_define([gimp_tool_version], [2.0])
30
m4_define([gimp_pkgconfig_version], [2.0])
31 32
m4_define([gimp_data_version], [2.0])
m4_define([gimp_sysconf_version], [2.0])
33
m4_define([gimp_user_version], [2.5])
34

35 36
m4_define([gimp_unstable],
          m4_if(m4_eval(gimp_minor_version % 2), [1], [yes], [no]))
37 38
m4_define([gimp_stable],
          m4_if(m4_eval(gimp_minor_version % 2), [0], [yes], [no]))
39

40
m4_define([gimp_full_name], [GNU Image Manipulation Program])
41

42
# required versions of other packages
43
m4_define([gegl_required_version], [0.0.16])
44
m4_define([glib_required_version], [2.16.1])
45
m4_define([gtk_required_version], [2.12.1])
46
m4_define([gdk_pixbuf_required_version], [gtk_required_version])
Michael Natterer's avatar
Michael Natterer committed
47
m4_define([pangoft2_required_version], [1.18.0])
48
m4_define([fontconfig_required_version], [2.2.0])
49
m4_define([cairo_required_version], [1.4.10])
50 51
m4_define([gtkdoc_required_version], [1.0])
m4_define([gtkhtml2_required_version], [2.0.0])
52
m4_define([alsa_required_version], [1.0.0])
53
m4_define([rsvg_required_version], [2.14.0])
54
m4_define([wmf_required_version], [0.2.8])
55
m4_define([pygtk_required_version], [2.10.4])
56
m4_define([poppler_required_version], [0.4.1])
57 58
m4_define([gnome_vfs_required_version], [2.10.0])
m4_define([gnomeui_required_version], [2.10.0])
Michael Natterer's avatar
Michael Natterer committed
59
m4_define([gnome_keyring_required_version], [0.4.5])
60
m4_define([libcurl_required_version], [7.15.1])
61
m4_define([dbus_glib_required_version], [0.70])
62
m4_define([libhal_required_version], [0.5.7])
63
m4_define([exif_required_version], [0.6.15])
64

65 66 67 68 69 70 71

AC_INIT([GIMP], [gimp_version],
        [http://bugzilla.gnome.org/enter_bug.cgi?product=GIMP],
        [gimp])

AC_CONFIG_SRCDIR([app/core/gimp.c])

Sven Neumann's avatar
Sven Neumann committed
72
AM_INIT_AUTOMAKE(no-define dist-bzip2)
73
AM_CONFIG_HEADER(config.h)
Elliot Lee's avatar
Elliot Lee committed
74

75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
GIMP_MAJOR_VERSION=gimp_major_version
GIMP_MINOR_VERSION=gimp_minor_version
GIMP_MICRO_VERSION=gimp_micro_version
GIMP_INTERFACE_AGE=gimp_interface_age
GIMP_BINARY_AGE=gimp_binary_age
GIMP_VERSION=gimp_version
GIMP_REAL_VERSION=gimp_real_version
GIMP_API_VERSION=gimp_api_version
GIMP_APP_VERSION=gimp_app_version
GIMP_PLUGIN_VERSION=gimp_plugin_version
GIMP_TOOL_VERSION=gimp_tool_version
GIMP_PKGCONFIG_VERSION=gimp_pkgconfig_version
GIMP_DATA_VERSION=gimp_data_version
GIMP_SYSCONF_VERSION=gimp_sysconf_version
GIMP_USER_VERSION=gimp_user_version
90 91
GIMP_UNSTABLE=gimp_unstable
GIMP_FULL_NAME="gimp_full_name"
92 93 94
AC_SUBST(GIMP_MAJOR_VERSION)
AC_SUBST(GIMP_MINOR_VERSION)
AC_SUBST(GIMP_MICRO_VERSION)
95 96
AC_SUBST(GIMP_INTERFACE_AGE)
AC_SUBST(GIMP_BINARY_AGE)
97
AC_SUBST(GIMP_VERSION)
98 99 100 101 102 103 104 105 106
AC_SUBST(GIMP_REAL_VERSION)
AC_SUBST(GIMP_API_VERSION)
AC_SUBST(GIMP_APP_VERSION)
AC_SUBST(GIMP_PLUGIN_VERSION)
AC_SUBST(GIMP_TOOL_VERSION)
AC_SUBST(GIMP_PKGCONFIG_VERSION)
AC_SUBST(GIMP_DATA_VERSION)
AC_SUBST(GIMP_SYSCONF_VERSION)
AC_SUBST(GIMP_USER_VERSION)
107 108
AC_SUBST(GIMP_UNSTABLE)
AC_SUBST(GIMP_FULL_NAME)
109

110

111 112 113 114 115 116 117 118 119
# These are used in the .pc files
GLIB_REQUIRED_VERSION=glib_required_version
GTK_REQUIRED_VERSION=gtk_required_version
AC_SUBST(GLIB_REQUIRED_VERSION)
AC_SUBST(GTK_REQUIRED_VERSION)

# The symbol GIMP_UNSTABLE is defined above for substitution in
# Makefiles and conditionally defined here as a preprocessor symbol
# and automake conditional.
120
if test "x$GIMP_UNSTABLE" = "xyes"; then
121
  AC_DEFINE(GIMP_UNSTABLE, 1,
122
            [Define to 1 if this is an unstable version of GIMP])
123
fi
124 125
AM_CONDITIONAL(GIMP_UNSTABLE, test "x$GIMP_UNSTABLE" = "xyes")

126 127

# libtool versioning
128
m4_define([lt_current], [m4_eval(100 * gimp_minor_version + gimp_micro_version - gimp_interface_age)])
129 130 131 132 133
m4_define([lt_revision], [gimp_interface_age])
m4_define([lt_age], [m4_eval(gimp_binary_age - gimp_interface_age)])
LT_VERSION_INFO="lt_current:lt_revision:lt_age"
LT_CURRENT_MINUS_AGE=m4_eval(lt_current - lt_age)
AC_SUBST(LT_VERSION_INFO)
134 135
AC_SUBST(LT_CURRENT_MINUS_AGE)

136

137
# gettext i18n support
138 139 140 141
GETTEXT_PACKAGE=gimp20
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
                   [The prefix for our gettext translation domains.])
142

143 144 145
# Determine a C compiler to use
AC_PROG_CC
AM_PROG_CC_C_O
Manish Singh's avatar
Manish Singh committed
146

147
# Initialize libtool
148 149 150
AM_DISABLE_STATIC
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
Elliot Lee's avatar
Elliot Lee committed
151

152
AM_PROG_AS
Elliot Lee's avatar
Elliot Lee committed
153

154
# Initialize maintainer mode
155 156
AM_MAINTAINER_MODE

157
# Honor aclocal flags
158 159
ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"

160

161 162 163 164
# Check for pkg-config
PKG_PROG_PKG_CONFIG(0.16)


165 166 167 168 169 170 171 172 173 174 175 176 177 178
###########################
# Check target architecture
###########################

AC_MSG_CHECKING([for target architecture])
case x"$target" in
  xNONE | x)
    target_or_host="$host" ;;
  *)
    target_or_host="$target" ;;
esac
AC_MSG_RESULT([$target_or_host])

case "$target_or_host" in
Manish Singh's avatar
Manish Singh committed
179
  i*86-*-*)
180 181 182
    have_x86=yes
    AC_DEFINE(ARCH_X86, 1, [Define to 1 if you are compiling for ix86.])
    ;;
Manish Singh's avatar
Manish Singh committed
183 184 185 186 187
  x86_64-*-*)
    have_x86=yes
    AC_DEFINE(ARCH_X86, 1, [Define to 1 if you are compiling for ix86.])
    AC_DEFINE(ARCH_X86_64, 1, [Define to 1 if you are compiling for amd64.])
    ;;
Manish Singh's avatar
Manish Singh committed
188
  ppc-*-* | powerpc-*)
189 190 191
    have_ppc=yes
    AC_DEFINE(ARCH_PPC, 1, [Define to 1 if you are compiling for PowerPC.])
    ;;
Manish Singh's avatar
Manish Singh committed
192 193 194 195 196
  ppc64-*-* | powerpc64-*)
    have_ppc=yes
    AC_DEFINE(ARCH_PPC, 1, [Define to 1 if you are compiling for PowerPC.])
    AC_DEFINE(ARCH_PPC64, 1, [Define to 1 if you are compiling for PowerPC64.])
    ;;
197 198 199 200 201
  *)
    ;;
esac


202 203 204
#################
# Check for Win32
#################
205

206
AC_MSG_CHECKING([for some Win32 platform])
207 208
case "$target_or_host" in
  *-*-mingw* | *-*-cygwin*)
209 210 211 212 213 214 215 216 217 218
    platform_win32=yes
    ;;
  *)
    platform_win32=no
    ;;
esac
AC_MSG_RESULT([$platform_win32])
AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")

AC_MSG_CHECKING([for native Win32])
219
case "$target_or_host" in
220 221 222 223 224 225 226 227 228 229 230 231
  *-*-mingw*)
    os_win32=yes
    PATHSEP=';'
    ;;
  *)
    os_win32=no
    PATHSEP=':'
    ;;
esac
AC_MSG_RESULT([$os_win32])
AC_SUBST(PATHSEP)
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
232
AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes")
233 234 235

if test "$os_win32" = "yes"; then
  AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
Manish Singh's avatar
Manish Singh committed
236
  AC_CHECK_TOOL(WINDRES, windres, :)
237 238
else
  WINDRES=":"
239
fi
Manish Singh's avatar
Manish Singh committed
240

241
AM_CONDITIONAL(MS_LIB_AVAILABLE, test "x$ms_librarian" = xyes)
242
AM_CONDITIONAL(HAVE_WINDRES, test "x$WINDRES" != "x:")
Manish Singh's avatar
Manish Singh committed
243 244

AC_SUBST(WINDRES)
245

246

247 248 249 250
###############
# Generic stuff
###############

251
# Checks for programs.
252 253 254 255
AC_ISC_POSIX
AC_PROG_INSTALL
AC_PROG_MAKE_SET

256
# Large file support for the swap file
257
AC_SYS_LARGEFILE
258

259
AC_MSG_CHECKING([whether to turn on debugging])
260
AC_ARG_ENABLE(debug,
261
              [  --enable-debug          turn on debugging (default=no)],
262 263 264
              if eval "test x$enable_debug = xyes"; then
                DEBUGFLAG="-g"
              fi)
265

266
if test -n "$DEBUGFLAG"; then
267
  AC_MSG_RESULT([yes])
268
  CFLAGS="$DEBUGFLAG $CFLAGS"
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
else
  AC_MSG_RESULT([no])
fi

AC_MSG_CHECKING([whether to turn on profiling])
AC_ARG_ENABLE(profile,
              [  --enable-profile        turn on profiling (default=no)],
              if eval "test x$enable_profile = xyes"; then
                PROFFLAG="-pg"
              fi)

if test -n "$PROFFLAG"; then
  AC_MSG_RESULT([yes])
  CFLAGS="$PROFFLAG $CFLAGS"
else
  AC_MSG_RESULT([no])
285
fi
286

287
AC_ARG_ENABLE(ansi,
288
              [  --enable-ansi           turn on strict ansi (default=no)],,
289
              enable_ansi=no)
290

291
changequote(,)dnl
292 293 294 295 296
if eval "test x$GCC = xyes"; then
  case " $CFLAGS " in
  *[\ \	]-Wall[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wall" ;;
  esac
Elliot Lee's avatar
Elliot Lee committed
297

298 299 300 301 302
  if test "x$enable_ansi" = "xyes"; then
    case " $CFLAGS " in
    *[\ \	]-ansi[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -ansi" ;;
    esac
303

304 305 306 307
    case " $CFLAGS " in
    *[\ \	]-pedantic[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -pedantic" ;;
    esac
Elliot Lee's avatar
Elliot Lee committed
308 309
  fi
fi
310
changequote([,])dnl
Elliot Lee's avatar
Elliot Lee committed
311

312

313
# If possible, warn if C99isms are used
314 315 316
GIMP_DETECT_CFLAGS(extra_warnings, '-Wdeclaration-after-statement')
CFLAGS="$CFLAGS $extra_warnings"

317 318 319 320 321 322
GIMP_DETECT_CFLAGS(extra_warnings, '-Wmissing-prototypes')
CFLAGS="$CFLAGS $extra_warnings"

GIMP_DETECT_CFLAGS(extra_warnings, '-Wmissing-declarations')
CFLAGS="$CFLAGS $extra_warnings"

323 324 325 326 327
GIMP_DETECT_CFLAGS(extra_warnings, '-Winit-self')
CFLAGS="$CFLAGS $extra_warnings"

GIMP_DETECT_CFLAGS(extra_warnings, '-Wpointer-arith')
CFLAGS="$CFLAGS $extra_warnings"
328 329 330

GIMP_DETECT_CFLAGS(extra_warnings, '-Wold-style-definition')
CFLAGS="$CFLAGS $extra_warnings"
331

332

333 334 335 336
# Ensure MSVC-compatible struct packing convention is used when
# compiling for Win32 with gcc.
# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
# gcc2 uses "-fnative-struct".
337 338
if test "x$os_win32" = xyes; then
  if test "x$GCC" = xyes; then
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357
    msnative_struct=''
    AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
    if test -z "$ac_cv_prog_CC"; then
      our_gcc="$CC"
    else
      our_gcc="$ac_cv_prog_CC"
    fi
    case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
      2.)
	if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
	  msnative_struct='-fnative-struct'
	fi
	;;
      *)
	if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
	  msnative_struct='-mms-bitfields'
	fi
	;;
    esac
358
    if test "x$msnative_struct" = x ; then
359
      AC_MSG_RESULT([no way])
Tor Lillqvist's avatar
Tor Lillqvist committed
360
      AC_MSG_WARN([build will be incompatible with GTK+ DLLs])
361 362 363 364 365 366 367
    else
      CFLAGS="$CFLAGS $msnative_struct"
      AC_MSG_RESULT([${msnative_struct}])
    fi
  fi
fi

368

369 370 371 372 373 374 375 376 377 378 379 380
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME

AC_CHECK_HEADERS(sys/param.h sys/time.h sys/times.h sys/wait.h unistd.h)

AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF

AC_FUNC_ALLOCA

381
# check some more funcs
382
AC_CHECK_FUNCS(difftime mmap)
383

384 385
AM_BINRELOC

386

387 388 389 390 391 392 393 394 395 396 397 398
# _NL_MEASUREMENT_MEASUREMENT is an enum and not a define
AC_MSG_CHECKING([for _NL_MEASUREMENT_MEASUREMENT])
AC_TRY_LINK([#include <langinfo.h>], [
char c = *((unsigned char *)  nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));
], nl_ok=yes, nl_ok=no)
AC_MSG_RESULT($nl_ok)
if test "$nl_ok" = "yes"; then
  AC_DEFINE(HAVE__NL_MEASUREMENT_MEASUREMENT, 1,
	    [Define to 1 if _NL_MEASUREMENT_MEASUREMENT is available])
fi


399 400 401
######################
# Internationalisation
######################
402

403 404 405
# Note to translators: you MUST have .po files in all 5 directories: po,
# po-libgimp, po-plug-ins, po-python and po-script-fu before adding your
# language code to ALL_LINGUAS.
Sven Neumann's avatar
Sven Neumann committed
406
ALL_LINGUAS="ar bg ca ca@valencia cs da de dz el en_CA en_GB eo es et eu fa fi fr ga gl gu he hu hr id is it ja km ko lt mk ms nb ne nl nn oc pa pl pt pt_BR ro ru rw sk sl sr sr@Latn sv tr tt uk vi xh yi zh_CN zh_TW"
407

408
AC_PROG_INTLTOOL
409
AM_GLIB_GNU_GETTEXT
410

411

412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
AC_MSG_CHECKING([for iso-codes])
PKG_CHECK_EXISTS(iso-codes,
  have_iso_codes="yes"
  AC_DEFINE(HAVE_ISO_CODES, 1,
  	    [Define to 1 if the iso-codes package is available])
  ISO_CODES_PREFIX=`$PKG_CONFIG --variable=prefix iso-codes`   
  ISO_CODES_LOCATION="$ISO_CODES_PREFIX/share/xml/iso-codes"
  ISO_CODES_LOCALEDIR="$ISO_CODES_PREFIX/$DATADIRNAME/locale",
  have_iso_codes="no (iso-codes package not found)")
AC_MSG_RESULT($have_iso_codes)

AC_SUBST(ISO_CODES_LOCATION)
AC_SUBST(ISO_CODES_LOCALEDIR)


427 428 429
###############################
# Checks for required libraries
###############################
430

431 432 433 434 435

PKG_CHECK_MODULES(GEGL, gegl >= gegl_required_version, :,
  AC_MSG_ERROR([Test for GEGL failed. Please get it from http://gegl.org/]))


436
AM_PATH_GLIB_2_0(glib_required_version, :,
Sven Neumann's avatar
Sven Neumann committed
437
  AC_MSG_ERROR(Test for GLIB failed. See the file 'INSTALL' for help.),
438
  gobject gthread)
Sven Neumann's avatar
Sven Neumann committed
439

440
PKG_CHECK_MODULES(GMODULE_NO_EXPORT, gmodule-no-export-2.0)
441

442 443
PKG_CHECK_MODULES(GIO, gio-2.0)

444 445 446
AC_MSG_CHECKING([if GLib is version 2.19.0 or newer])
if $PKG_CONFIG --atleast-version=2.19.0 glib-2.0; then
  have_glib_2_19=yes
447
else
448
  have_glib_2_19=no
449
fi
450
AC_MSG_RESULT($have_glib_2_19)
451

452

453
# Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
454 455
gimp_save_LIBS=$LIBS
LIBS="$LIBS $GLIB_LIBS"
456 457 458 459
AC_CHECK_FUNCS(bind_textdomain_codeset,,
  AC_MSG_ERROR([
*** Check for bind_textdomain_codeset() failed!  This is required.
]))
460 461 462 463 464
LIBS=$gimp_save_LIBS


AC_PATH_XTRA

465
AM_PATH_GTK_2_0(gtk_required_version, :,
466 467
  AC_MSG_ERROR(Test for GTK+ failed. See the file 'INSTALL' for help.),
  gthread)
Elliot Lee's avatar
Elliot Lee committed
468

469 470
AC_MSG_CHECKING([if GTK+ is version 2.17.0 or newer])
if $PKG_CONFIG --atleast-version=2.17.0 gtk+-2.0; then
471
  have_gtk_2_15=yes
472
else
473
  have_gtk_2_15=no
474
fi
475
AC_MSG_RESULT($have_gtk_2_15)
476

477
PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0 >= gdk_pixbuf_required_version)
478

479
AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
480
if test "x$GDK_PIXBUF_CSOURCE" = xno; then
481 482 483
  AC_MSG_ERROR(Could not find gdk-pixbuf-csource in your PATH)
fi

484
PKG_CHECK_MODULES(CAIRO, cairo >= cairo_required_version)
485

486 487
PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= fontconfig_required_version)

488
PKG_CHECK_MODULES(PANGOFT2, pangoft2 >= pangoft2_required_version, :,
489 490 491
  AC_MSG_ERROR([Test for PangoFT2 failed.
*** We require Pango with the optional support for FreeType2 compiled in.
*** See the file 'INSTALL' for more help.]))
492

493 494 495
AC_MSG_CHECKING([if Pango is version 1.21.0 or newer])
if $PKG_CONFIG --atleast-version=1.21.0 pango; then
  have_pango_1_21=yes
496
else
497
  have_pango_1_21=no
498
fi
499
AC_MSG_RESULT($have_pango_1_21)
500

501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524
gimp_save_CFLAGS=$CFLAGS
CFLAGS="$PANGOFT2_CFLAGS $CFLAGS"

AC_MSG_CHECKING([if Pango is built with a recent fontconfig])
AC_TRY_COMPILE([#include <fontconfig/fontconfig.h>],
  [FcObjectSet *os; os = FcObjectSetBuild (FC_FAMILY, FC_WIDTH);],
  fontconfig_ok=yes, fontconfig_ok=no)
AC_MSG_RESULT($fontconfig_ok)

CFLAGS=$gimp_save_CFLAGS

if test "x$fontconfig_ok" = xno; then
  AC_MSG_ERROR([
*** You have a fontconfig >= fontconfig_required_version installed on your system, but your
*** PangoFT2 is using an older version. This old version is probably in
*** /usr/X11R6. Look at the above output, and note that the result for
*** FONTCONFIG_CFLAGS is not in the result for PANGOFT2_CFLAGS, and that
*** there is likely an extra -I line, other than the ones for GLIB,
*** Freetype, and Pango itself. That's where your old fontconfig files are.
*** Rebuild pango, and make sure that it uses the newer fontconfig. The
*** easiest way be sure of this is to simply get rid of the old fontconfig.
*** When you rebuild pango, make sure the result for FONTCONFIG_CFLAGS is
*** the same as the result here.])
fi
525

526 527
AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
if test "x$FREETYPE_CONFIG" != "xno" ; then
528
  AC_MSG_CHECKING([for freetype libraries])
529 530 531 532 533 534
  FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
  AC_MSG_RESULT($FREETYPE_LIBS)
fi
AC_SUBST(FREETYPE_LIBS)


535 536 537
##########################################
# Check for some special functions we need
##########################################
Elliot Lee's avatar
Elliot Lee committed
538

David Neary's avatar
ted  
David Neary committed
539 540
AC_CHECK_HEADERS(math.h ieeefp.h)

541
# DU4 native cc currently needs -std1 for ANSI mode (instead of K&R)
Manish Singh's avatar
Manish Singh committed
542 543 544 545 546 547 548 549 550 551 552 553 554
AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
gimp_save_LIBS=$LIBS
LIBS="$LIBS -lm"
AC_TRY_RUN([#include <math.h>
             int main (void) { return (log(1) != log(1.)); }],
  AC_MSG_RESULT(none needed),
  gimp_save_CFLAGS=$CFLAGS
  CFLAGS="$CFLAGS -std1"
  AC_TRY_RUN([#include <math.h>
               int main (void) { return (log(1) != log(1.)); }],
    AC_MSG_RESULT(-std1),
    AC_MSG_RESULT()
    CFLAGS=$gimp_save_CFLAGS
555 556 557 558
    AC_MSG_WARN([No ANSI prototypes found in library. (-std1 didn't work.)]),
    AC_MSG_RESULT),
  AC_MSG_RESULT())

559
# Check for finite or isfinite
560 561 562 563 564 565 566 567 568 569 570 571 572 573
AC_CHECK_FUNCS(finite, , [
  AC_MSG_CHECKING(for finite in <math.h>)
  AC_TRY_LINK([#include <math.h>], [double f = 0.0; finite (f)], [
    AC_DEFINE(HAVE_FINITE, 1)
    AC_MSG_RESULT(yes)], [
    AC_MSG_RESULT(no)
    AC_MSG_CHECKING(for isfinite in <math.h>)
    AC_TRY_LINK([#include <math.h>], [float f = 0.0; isfinite(f)], [
      AC_DEFINE(HAVE_ISFINITE, 1,
                [Define to 1 if you have the isfinite function.])
      AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))])])
AC_SUBST(HAVE_FINITE)
AC_SUBST(HAVE_ISFINITE)

574 575 576
LIBS=$gimp_save_LIBS


577
# NeXTStep cc seems to need this
578 579 580 581 582 583 584 585 586 587 588
AC_MSG_CHECKING([for extra flags for POSIX compliance])
AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
  AC_MSG_RESULT(none needed),
  gimp_save_CFLAGS=$CFLAGS
  CFLAGS="$CFLAGS -posix"
  AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
    AC_MSG_RESULT(-posix),
    AC_MSG_RESULT()
    CFLAGS=$gimp_save_CFLAGS
    AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))

589
# check for rint
590 591 592 593 594 595
AC_CHECK_FUNC(rint, AC_DEFINE(HAVE_RINT, 1,
                              [Define to 1 if you have the rint function.]), [
  AC_CHECK_LIB(m, rint, [
    AC_DEFINE(HAVE_RINT)])])


596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611
######################################################
# Check for extra libs needed for inet_ntoa and socket
######################################################

gimp_save_LIBS=$LIBS
LIBS=""

AC_CHECK_FUNCS(inet_ntoa, , AC_CHECK_LIB(nsl, inet_ntoa))
AC_CHECK_LIB(socket, socket)

SOCKET_LIBS="$LIBS"
LIBS=$gimp_save_LIBS

AC_SUBST(SOCKET_LIBS)


612 613 614
########################
# Check for MMX assembly
########################
615

616 617 618 619 620 621
AC_ARG_ENABLE(mmx,
  [  --enable-mmx            enable MMX support (default=auto)],,
  enable_mmx=$have_x86)

AC_ARG_ENABLE(sse,
  [  --enable-sse            enable SSE support (default=auto)],,
622
  enable_sse=$enable_mmx)
623 624

if test "x$enable_mmx" = xyes; then
625 626
  GIMP_DETECT_CFLAGS(MMX_EXTRA_CFLAGS, '-mmmx')
  SSE_EXTRA_CFLAGS=
627

628
  AC_MSG_CHECKING(whether we can compile MMX code)
629

630 631
  mmx_save_CFLAGS="$CFLAGS"
  CFLAGS="$mmx_save_CFLAGS $MMX_EXTRA_CFLAGS"
632

633 634
  AC_COMPILE_IFELSE([asm ("movq 0, %mm0");],

635 636 637
    AC_DEFINE(USE_MMX, 1, [Define to 1 if MMX assembly is available.])
    AC_MSG_RESULT(yes)

638
    if test "x$enable_sse" = xyes; then
639 640
      GIMP_DETECT_CFLAGS(sse_flag, '-msse')
      SSE_EXTRA_CFLAGS="$MMX_EXTRA_CFLAGS $sse_flag"
641 642 643

      AC_MSG_CHECKING(whether we can compile SSE code)

644 645
      CFLAGS="$CFLAGS $sse_flag"

646
      AC_COMPILE_IFELSE([asm ("movntps %xmm0, 0");],
647 648
        AC_DEFINE(USE_SSE, 1, [Define to 1 if SSE assembly is available.])
        AC_MSG_RESULT(yes)
649
      ,
650 651 652
        enable_sse=no
        AC_MSG_RESULT(no)
        AC_MSG_WARN([The assembler does not support the SSE command set.])
653
      )
654

655
    fi
656
  ,
657 658
    enable_mmx=no
    AC_MSG_RESULT(no)
659
    AC_MSG_WARN([The assembler does not support the MMX command set.])
660
  )
661

662 663 664 665
  CFLAGS="$mmx_save_CFLAGS"

  AC_SUBST(MMX_EXTRA_CFLAGS)
  AC_SUBST(SSE_EXTRA_CFLAGS)
666
fi
667

668 669

############################
670
# Check for AltiVec assembly
671 672 673
############################

AC_ARG_ENABLE(altivec,
674
  [  --enable-altivec        enable AltiVec support (default=auto)],,
675 676 677
  enable_altivec=$have_ppc)

if test "x$enable_altivec" = xyes; then
Manish Singh's avatar
Manish Singh committed
678

679
  GIMP_DETECT_CFLAGS(altivec_flag, '-faltivec' '-maltivec -mabi=altivec')
Manish Singh's avatar
Manish Singh committed
680 681 682 683 684 685 686 687 688 689 690 691 692

  ALTIVEC_EXTRA_CFLAGS=
  case "$altivec_flag" in
    -maltivec*)
      altivec_save_CPPFLAGS="$CPPFLAGS"
      CPPFLAGS="$altivec_save_CPPFLAGS $altivec_flag"
      AC_CHECK_HEADERS(altivec.h, [ALTIVEC_EXTRA_CFLAGS="$altivec_flag"])
      CPPFLAGS="$altivec_save_CPPFLAGS"
      ;;
    *)
      ALTIVEC_EXTRA_CFLAGS="$altivec_flag"
      ;;
  esac
693
  AC_SUBST(ALTIVEC_EXTRA_CFLAGS)
694

695
  AC_MSG_CHECKING(whether we can compile AltiVec code)
696

Manish Singh's avatar
Manish Singh committed
697
  can_use_altivec=no
698
  if test -z "$ALTIVEC_EXTRA_CFLAGS"; then
699
    AC_MSG_RESULT(no)
Manish Singh's avatar
Manish Singh committed
700
    AC_MSG_WARN([The compiler does not support the AltiVec command set.])
701 702 703 704 705 706 707 708 709 710 711 712 713
  else
    case "$target_or_host" in
      *-*-darwin*)
        can_use_altivec=yes
        AC_DEFINE(HAVE_ALTIVEC_SYSCTL, 1,
         [Define to 1 if the altivec runtime test should use a sysctl.])
        ;;
      *)
        AC_COMPILE_IFELSE([asm ("vand %v0, %v0, %v0");],
          can_use_altivec=yes, can_use_altivec=no)
        ;;
    esac
    AC_MSG_RESULT($can_use_altivec)
714

715 716 717 718 719 720 721
    if test "x$can_use_altivec" = "xyes"; then
      AC_DEFINE(USE_ALTIVEC, 1, [Define to 1 if AltiVec support is available.])
    else
      enable_altivec=no
      AC_MSG_WARN([The assembler does not support the AltiVec command set.])
    fi
  fi
Manish Singh's avatar
Manish Singh committed
722 723

  enable_altivec="$can_use_altivec"
724
fi
725

726

727 728 729
###################################
# Checks for shared memory handling
###################################
730

731
# MacOS X has broken SysV shm
732 733
case "$target_or_host" in
  *-*-darwin* | *-*-rhapsody* | *-*-machten*)
734
    shmdefault=posix
735 736 737 738 739 740 741
    ;;
  *)
    shmdefault=sysv
    ;;
esac

shmtype=auto
742
AC_ARG_WITH(shm, [  --with-shm=none|sysv|posix|auto    shared memory transport type (default=auto)], shmtype=$with_shm)
743 744

case $shmtype in
745
  none|sysv|posix) ;;
746
  auto) shmtype=$shmdefault ;;
747
  *) AC_MSG_ERROR([Invalid shared memory transport type: use none, sysv, posix, or auto.]);;
748 749
esac

750 751 752 753

if test "x$platform_win32" = "xyes"; then
  shmtype=win32
elif test "x$shmtype" = "xsysv"; then
754 755
  AC_CHECK_HEADER(sys/ipc.h,
    [AC_DEFINE(HAVE_IPC_H, 1,
756
               [Define to 1 if you have the <sys/ipc.h> header file.])],
757 758 759 760 761
    no_sys_ipc=yes)
  AC_CHECK_HEADER(sys/shm.h,
    [AC_DEFINE(HAVE_SHM_H, 1,
               [Define to 1 if you have the <sys/shm.h> header file.])],
    no_sys_shm=yes)
762

763 764 765
  if test "$ac_cv_header_sys_shm_h" = "yes"; then
    AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
    AC_TRY_RUN([
Elliot Lee's avatar
Elliot Lee committed
766 767 768 769 770 771 772
	#include <sys/types.h>
	#include <sys/ipc.h>
	#include <sys/shm.h>
	int main()
	{
	  int id;
	  char *shmaddr;
773
	id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0600);
Elliot Lee's avatar
Elliot Lee committed
774 775 776 777 778 779 780 781 782 783 784 785 786
	if (id == -1)
	  exit (2);
	  shmaddr = shmat (id, 0, 0);
	  shmctl (id, IPC_RMID, 0);
	  if ((char*) shmat (id, 0, 0) == (char*) -1)
	  {
	    shmdt (shmaddr);
	    exit (1);
	  }
	  shmdt (shmaddr);
	  shmdt (shmaddr);
	  exit (0);
	}
787 788 789 790 791 792
      ],
      AC_DEFINE(IPC_RMID_DEFERRED_RELEASE, 1,
	        [Define to 1 if shared memory segments are released deferred.])
        AC_MSG_RESULT(yes),
      AC_MSG_RESULT(no),
      AC_MSG_RESULT(assuming no))
793 794 795 796 797 798

    AC_DEFINE(USE_SYSV_SHM, 1, [Define to 1 to use SYSV shared memory])
  else
    shmtype=none
  fi
elif test "x$shmtype" = "xposix"; then
799 800 801 802 803 804
  have_shm_open=no

  AC_CHECK_FUNC(shm_open, have_shm_open=yes)

  RT_LIBS=
  if test "$have_shm_open" != "yes"; then
Manish Singh's avatar
Manish Singh committed
805
    AC_CHECK_LIB(rt, shm_open, RT_LIBS="-lrt" have_shm_open=yes)
806 807
  fi
  AC_SUBST(RT_LIBS)
808 809 810

  AC_CHECK_HEADER(sys/mman.h,
    [AC_DEFINE(HAVE_MMAN_H, 1,
811
               [Define to 1 if you have the <sys/mman.h> header file.])],
812 813 814
    no_sys_mman=yes)

  if test "$ac_cv_func_mmap" = "yes" &&
815 816
     test "$ac_cv_header_sys_mman_h" = "yes" &&
     test "$have_shm_open" = "yes"; then
817 818 819
    AC_DEFINE(USE_POSIX_SHM, 1, [Define to 1 to use POSIX shared memory])
  else
    shmtype=none
820
  fi
Elliot Lee's avatar
Elliot Lee committed
821 822
fi

823 824
AC_MSG_CHECKING(for shared memory transport type)
AC_MSG_RESULT($shmtype)
825

826

827 828 829 830 831 832
########################
# Define a symbol prefix
########################

AC_MSG_CHECKING([whether symbols are prefixed])

833 834
case "$host_os" in
  mingw*)
835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852
    SYMPREFIX='_'
    ;;
  darwin* | rhapsody* | machten*)
    SYMPREFIX='_'
    ;;
  *)
    ;;
esac

if test -n "$SYMPREFIX"; then
  AC_MSG_RESULT([yes, with a $SYMPREFIX])
else
  AC_MSG_RESULT(no)
fi

AC_SUBST(SYMPREFIX)


853 854 855
############################
# Check for select and fdset
############################
Elliot Lee's avatar
Elliot Lee committed
856

857
if test "x$os_win32" != xyes; then
858 859 860
  AC_MSG_CHECKING([fd_set and sys/select])
  AC_TRY_COMPILE([#include <sys/types.h>],
	  [fd_set readMask, writeMask;], gimp_ok=yes, gimp_ok=no)
861
  if test "x$gimp_ok" = xno; then
862
      AC_EGREP_HEADER(fd_mask, sys/select.h, gimp_ok=yes)
863
      if test "x$gimp_ok" = xyes; then
864 865 866 867 868
	  AC_DEFINE(HAVE_SYS_SELECT_H, 1,
		    [Define to 1 if you have the <sys/select.h> header.])
      fi
  fi
  AC_MSG_RESULT($gimp_ok)
869
  if test "x$gimp_ok" = xno; then
870 871 872
      AC_DEFINE(NO_FD_SET, 1,
		[Define to 1 if you don't have the fd_set typedef.])
  fi
Elliot Lee's avatar
Elliot Lee committed
873 874
fi

875

876
#############################
877
# Threads and multi processor
878
#############################
879

880
AC_ARG_ENABLE(mp, [  --disable-mp            disable support for multiple processors])
881
if test "x$enable_mp" != "xno"; then
882 883
  AC_DEFINE(ENABLE_MP, 1,
	    [Define to 1 to enable support for multiple processors.])
Sven Neumann's avatar
Sven Neumann committed
884 885
fi

886 887 888 889

################################
# Some plug-ins are X11 specific
################################
Sven Neumann's avatar
Sven Neumann committed
890

891 892
GIMP_COMMAND='gimp-gimp_app_version'

893
# Check if building for GTK+-X11
Sven Neumann's avatar
Sven Neumann committed
894
gdk_target=`$PKG_CONFIG --variable=target gtk+-2.0`
895

Sven Neumann's avatar
Sven Neumann committed
896
if test "$gdk_target" = x11; then
897

898
   # doc-shooter is X11 specific
899 900
   DOC_SHOOTER=doc-shooter

901
   # screenshot plug-in needs to link to X11 explicitely
902 903
   LIBSCREENSHOT="$X_LIBS -lX11"

904 905 906 907 908
   gimp_save_CFLAGS="$CFLAGS"
   gimp_save_LDFLAGS="$LDFLAGS"
   CFLAGS="$CFLAGS $GTK_CFLAGS"
   LDFLAGS="$LDFLAGS $X_LIBS"

909
   # Test for Xmu
910 911
   enable_gimp_remote=yes
   if test -z "$LIBXMU"; then
Sven Neumann's avatar
Sven Neumann committed
912
      AC_CHECK_LIB(Xmu, XmuClientWindow,
913
        [AC_CHECK_HEADERS(X11/Xmu/WinUtil.h,
914
          GIMP_REMOTE='gimp-remote-gimp_app_version$(EXEEXT)';
915
	  GIMP_COMMAND='gimp-remote-gimp_app_version'
916
	  have_libxmu=yes
917
          LIBXMU="$X_LIBS $X_PRE_LIBS -lX11 -lXmu -lXt",
918 919
	  [enable_gimp_remote="no (XMU header file not found)"],[#include <gdk/gdkx.h>])],
	[enable_gimp_remote="no (XMU library not found)"], -lXt -lX11)
920
      LIBSCREENSHOT="$LIBXMU"
921
   fi
922

923
   # Check for shaped window extension
924 925 926 927 928 929 930
   AC_CHECK_LIB(Xext, XShapeGetRectangles,
     [AC_CHECK_HEADERS(X11/extensions/shape.h,
        LIBSCREENSHOT="$LIBSCREENSHOT -lXext",,[#include <gdk/gdkx.h>])],,
     -lX11 -lXext)

   CFLAGS="$gimp_save_CFLAGS"
   LDFLAGS="$gimp_save_LDFLAGS"
931

932
   # check for the XFixes extension
933 934 935
   PKG_CHECK_MODULES(XFIXES, xfixes,
      AC_DEFINE(HAVE_XFIXES, 1,
                [Define to 1 to if the XFIXES X extension is available])
936 937
      LIBSCREENSHOT="$LIBSCREENSHOT $XFIXES_LIBS",
      AC_MSG_RESULT([no]))
938

939 940
else
   enable_gimp_remote="no (building for $gdk_target)"
941
fi
Sven Neumann's avatar
Sven Neumann committed
942

943
AC_SUBST(LIBXMU)
944
AC_SUBST(LIBSCREENSHOT)
945

946
AC_SUBST(DOC_SHOOTER)
947

948 949 950
AC_SUBST(GIMP_REMOTE)
AC_SUBST(GIMP_COMMAND)

951

952 953 954 955 956 957 958 959 960
############
# MIME types
############

# The list of MIME types that are supported by plug-ins that are compiled
# unconditionally:
MIME_TYPES="application/postscript;application/pdf;image/bmp;image/g3fax;image/gif;image/x-fits;image/pcx;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-psd;image/x-sgi;image/x-tga;image/x-xbitmap;image/x-xwindowdump;image/x-xcf;image/x-compressed-xcf"


961 962 963 964
###################
# Check for libtiff
###################

965
have_libtiff=no
Sven Neumann's avatar
Sven Neumann committed
966
AC_ARG_WITH(libtiff,  [  --without-libtiff       build without TIFF support])
967
  if test "x$with_libtiff" != xno && test -z "$LIBTIFF"; then
968
    have_libtiff=yes
Sven Neumann's avatar
Sven Neumann committed
969 970
    AC_CHECK_LIB(tiff, TIFFReadScanline,
      [AC_CHECK_HEADER(tiffio.h,
971
	TIFF_LOAD='tiff-load$(EXEEXT)'; TIFF_SAVE='tiff-save$(EXEEXT)'; LIBTIFF='-ltiff',
972
	[have_libtiff="no (TIFF header files not found)"])],
Sven Neumann's avatar
Sven Neumann committed
973 974
      [AC_CHECK_LIB(tiff, TIFFWriteScanline,
	[AC_CHECK_HEADER(tiffio.h,
975
          TIFF_LOAD='tiff-load$(EXEEXT)'; TIFF_SAVE='tiff-save$(EXEEXT)'; LIBTIFF='-ltiff -ljpeg -lz',
976
	  [have_libtiff="no (TIFF header files not found)"])],
Sven Neumann's avatar
Sven Neumann committed
977 978
	[AC_CHECK_LIB(tiff34, TIFFFlushData,
	  [AC_CHECK_HEADER(tiffio.h,
979
            TIFF_LOAD='tiff-load$(EXEEXT)'; TIFF_SAVE='tiff-save$(EXEEXT)'; LIBTIFF='-ltiff34 -ljpeg -lz',
980 981
	    [have_libtiff="no (TIFF header files not found)"])],
        [have_libtiff="no (TIFF library not found)"], -ljpeg -lz -lm)], -ljpeg -lz -lm)], -lm)
Sven Neumann's avatar
Sven Neumann committed
982 983
  fi

984
  if test "x$with_libtiff" != xno && test -z "$LIBTIFF"; then
985
    AC_MSG_ERROR([
986
*** Checks for TIFF libary failed. You can build without it by passing
Sven Neumann's avatar
Sven Neumann committed
987 988 989
*** --without-libtiff to configure but you won't be able to use TIFFs then.])
  fi

990 991 992 993
  if test "x$have_libtiff" = xyes; then
    MIME_TYPES="$MIME_TYPES;image/tiff"
  fi

994 995
AC_SUBST(TIFF_LOAD)
AC_SUBST(TIFF_SAVE)
996 997 998 999 1000 1001
AC_SUBST(LIBTIFF)


###################
# Check for libjpeg
###################
Sven Neumann's avatar
Sven Neumann committed
1002

1003 1004
jpeg_ok=no

Sven Neumann's avatar
Sven Neumann committed
1005
AC_ARG_WITH(libjpeg,  [  --without-libjpeg       build without JPEG support])
1006
  if test "x$with_libjpeg" != xno && test -z "$LIBJPEG"; then
Sven Neumann's avatar
Sven Neumann committed
1007 1008
    AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
      jpeg_ok=yes,
1009
      [jpeg_ok="no (JPEG library not found)"
Sven Neumann's avatar
Sven Neumann committed
1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020
      AC_MSG_WARN(*** XJT plug-in 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 HAVE_STDDEF_H
#undef HAVE_STDLIB_H
#undef PACKAGE
#undef VERSION
#include <jpeglib.h>],
	jpeg_ok=yes,
1021
	jpeg_ok="no (Can't include jpeglib.h)")
Sven Neumann's avatar
Sven Neumann committed
1022 1023
      AC_MSG_RESULT($jpeg_ok)
      if test "$jpeg_ok" = yes; then
1024 1025
	AC_CHECK_LIB(jpeg, jpeg_save_markers,
	JPEG='jpeg$(EXEEXT)'; LIBJPEG='-ljpeg',
1026
        jpeg_ok="no (JPEG library is too old)")
Sven Neumann's avatar
Sven Neumann committed
1027
      else
1028
	jpeg_ok="no (JPEG header file not found)"
Sven Neumann's avatar
Sven Neumann committed
1029 1030 1031 1032
      fi
    fi
  fi

1033
  if test "x$with_libjpeg" != xno && test -z "$LIBJPEG"; then
1034
    AC_MSG_ERROR([
1035
*** Checks for JPEG library failed. You can build without it by passing
Sven Neumann's avatar
Sven Neumann committed
1036 1037 1038
*** --without-libjpeg to configure but you won't be able to use JPEGs then.])
  fi

1039 1040 1041 1042
  if test "x$jpeg_ok" = xyes; then
    MIME_TYPES="$MIME_TYPES;image/jpeg"
  fi

1043
AM_CONDITIONAL(BUILD_JPEG, test "x$jpeg_ok" = xyes)
1044
AC_SUBST(LIBJPEG)
Sven Neumann's avatar
Sven Neumann committed
1045

1046

1047 1048
## xjt does build, but it is more confusing than useful on Win32,
## as it wants to run tar, mv and bzip2, which seldom are available
1049 1050
AM_CONDITIONAL(BUILD_XJT, test "x$jpeg_ok" = xyes && test "x$os_win32" = xno)
if test "x$jpeg_ok" != xyes; then
1051
  have_xjt="no (no JPEG library)"
1052
elif test "x$os_win32" = xyes; then
1053 1054 1055 1056
  have_xjt="no (not built on Windows)"
else
  have_xjt=yes
fi
1057

Sven Neumann's avatar
Sven Neumann committed
1058

1059 1060 1061 1062
################
# Check for libz
################

1063
have_zlib=yes
1064 1065 1066
if test -z "$LIBZ"; then
  AC_CHECK_LIB(z, gzsetparams,
    [AC_CHECK_HEADER(zlib.h,
1067
      PSP='psp$(EXEEXT)'; LIBZ='-lz',
1068 1069
      [have_zlib="no (ZLIB header files not found)"])],
    [have_zlib="no (ZLIB library not found)"])
1070 1071
fi

1072 1073 1074 1075
if test "x$have_zlib" = xyes; then
  MIME_TYPES="$MIME_TYPES;image/x-psd"
fi

1076 1077 1078 1079 1080 1081 1082 1083
AC_SUBST(LIBZ)
AC_SUBST(PSP)


##################
# Check for libpng
##################

1084
have_libpng=no
Sven Neumann's avatar
Sven Neumann committed
1085
AC_ARG_WITH(libpng,  [  --without-libpng        build without PNG support])
1086
if test "x$with_libpng" != xno; then
1087
  have_libpng=yes
1088 1089 1090 1091
  PKG_CHECK_MODULES(PNG, libpng,
    PNG='png$(EXEEXT)'
    LIBPNG="$PNG_LIBS",
    [have_libpng="no (libpng not found)"
Sven Neumann's avatar
Sven Neumann committed
1092
     AC_MSG_ERROR([
1093 1094 1095
*** Checks for PNG library failed. You can build without it by passing
*** --without-libpng to configure but you won't be able to use PNGs then.])])
fi
Sven Neumann's avatar
Sven Neumann committed
1096

1097 1098 1099 1100
if test "x$have_libpng" = xyes; then
  MIME_TYPES="$MIME_TYPES;image/png;image/x-icon"
fi

1101 1102
AC_SUBST(PNG)
AC_SUBST(LIBPNG)
Sven Neumann's avatar
Sven Neumann committed
1103

1104
AM_CONDITIONAL(HAVE_PNG, test "x$have_libpng" = xyes)
1105

Sven Neumann's avatar
Sven Neumann committed
1106

1107 1108 1109 1110
##################
# Check for libmng
##################

1111
have_libmng=no
1112
AC_ARG_WITH(libmng,  [  --without-libmng        build without MNG support])
1113
  have_libmng=yes
1114
  if test "x$with_libmng" != xno && test -z "$LIBMNG" &&
1115 1116 1117
     test -n "$LIBPNG" && test -n "$LIBJPEG" && test -n "$LIBZ"; then
    AC_CHECK_LIB(mng, mng_create,
      [AC_CHECK_HEADER(libmng.h, mng_ok=yes)],
1118
      [have_libmng="no (MNG library not found)"], -lz -lm)
1119
    if test "$mng_ok" = yes; then
1120
      MNG='mng$(EXEEXT)'; LIBMNG="-lmng $LIBJPEG $LIBPNG"
1121
    else
1122
      have_libmng="no (MNG header file not found)"
1123 1124 1125 1126 1127 1128 1129
    fi
  fi

AC_SUBST(MNG)
AC_SUBST(LIBMNG)


1130 1131 1132 1133 1134 1135
############################################################
# libexif: Library to allow exif tags to be read from, and
# saved to, jpeg files. Currently, this permits exif data to
# avoid destruction, but no data modification is performed.
############################################################

1136
have_libexif=no
1137
AC_ARG_WITH(libexif,  [  --without-libexif       build without EXIF support])
1138
if test "x$with_libexif" != xno && test -z "$LIBEXIF" && test -n "$LIBJPEG"; then
1139
  have_libexif=yes
Sven Neumann's avatar
Sven Neumann committed
1140
  PKG_CHECK_MODULES(EXIF, libexif >= exif_required_version,
1141
    AC_DEFINE(HAVE_EXIF, 1, [Define to 1 if libexif is available]),
1142 1143
    have_libexif="no (libexif not found or too old)"
    AC_MSG_RESULT([$have_libexif]))
1144 1145
fi

1146 1147
AC_SUBST(EXIF_CFLAGS)
AC_SUBST(EXIF_LIBS)
1148

1149

1150 1151 1152
#################
# Check for libaa
#################
1153

1154

1155
have_libaa=no
1156
AC_ARG_WITH(aa,  [  --without-aa            do not build the AA plug-in])
1157
if test "x$with_aa" != xno && test -z "$LIBAA"; then
1158
  have_libaa=yes
1159 1160
  AC_CHECK_LIB(aa, aa_printf,
    [AC_CHECK_HEADER(aalib.h,
1161
      AA='aa$(EXEEXT)'; LIBAA='-laa',
1162 1163
      [have_libaa="no (AA header file not found)"])],
    [have_libaa="no (AA library not found)"])
1164
fi
1165

1166 1167
AC_SUBST(AA)
AC_SUBST(LIBAA)
1168