configure.in 58.1 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 44
m4_define([babl_required_version], [0.0.21])
m4_define([gegl_required_version], [0.0.17])
45
m4_define([glib_required_version], [2.16.1])
46
m4_define([gtk_required_version], [2.12.1])
47
m4_define([gdk_pixbuf_required_version], [gtk_required_version])
Michael Natterer's avatar
Michael Natterer committed
48
m4_define([pangoft2_required_version], [1.18.0])
49
m4_define([fontconfig_required_version], [2.2.0])
50
m4_define([cairo_required_version], [1.4.10])
51 52
m4_define([gtkdoc_required_version], [1.0])
m4_define([gtkhtml2_required_version], [2.0.0])
53
m4_define([alsa_required_version], [1.0.0])
54
m4_define([rsvg_required_version], [2.14.0])
55
m4_define([wmf_required_version], [0.2.8])
56
m4_define([pygtk_required_version], [2.10.4])
57
m4_define([poppler_required_version], [0.4.1])
58 59
m4_define([gnome_vfs_required_version], [2.10.0])
m4_define([gnomeui_required_version], [2.10.0])
60
m4_define([gnome_keyring_required_version], [0.4.5])
61
m4_define([libcurl_required_version], [7.15.1])
62
m4_define([dbus_glib_required_version], [0.70])
63
m4_define([libhal_required_version], [0.5.7])
64
m4_define([exif_required_version], [0.6.15])
65

66 67 68 69 70 71 72

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

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

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

76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
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
91 92
GIMP_UNSTABLE=gimp_unstable
GIMP_FULL_NAME="gimp_full_name"
93 94 95
AC_SUBST(GIMP_MAJOR_VERSION)
AC_SUBST(GIMP_MINOR_VERSION)
AC_SUBST(GIMP_MICRO_VERSION)
96 97
AC_SUBST(GIMP_INTERFACE_AGE)
AC_SUBST(GIMP_BINARY_AGE)
98
AC_SUBST(GIMP_VERSION)
99 100 101 102 103 104 105 106 107
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)
108 109
AC_SUBST(GIMP_UNSTABLE)
AC_SUBST(GIMP_FULL_NAME)
110

111

112 113 114 115 116 117 118 119 120
# 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.
121
if test "x$GIMP_UNSTABLE" = "xyes"; then
122
  AC_DEFINE(GIMP_UNSTABLE, 1,
123
            [Define to 1 if this is an unstable version of GIMP])
124
fi
125 126
AM_CONDITIONAL(GIMP_UNSTABLE, test "x$GIMP_UNSTABLE" = "xyes")

127 128

# libtool versioning
129
m4_define([lt_current], [m4_eval(100 * gimp_minor_version + gimp_micro_version - gimp_interface_age)])
130 131 132 133 134
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)
135 136
AC_SUBST(LT_CURRENT_MINUS_AGE)

137

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

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

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

153
AM_PROG_AS
Elliot Lee's avatar
Elliot Lee committed
154

155
# Initialize maintainer mode
156 157
AM_MAINTAINER_MODE

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

161

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


166 167 168 169 170 171 172 173 174 175 176 177 178 179
###########################
# 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
180
  i*86-*-*)
181 182 183
    have_x86=yes
    AC_DEFINE(ARCH_X86, 1, [Define to 1 if you are compiling for ix86.])
    ;;
184 185 186 187 188
  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
189
  ppc-*-* | powerpc-*)
190 191 192
    have_ppc=yes
    AC_DEFINE(ARCH_PPC, 1, [Define to 1 if you are compiling for PowerPC.])
    ;;
Manish Singh's avatar
Manish Singh committed
193 194 195 196 197
  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.])
    ;;
198 199 200 201 202
  *)
    ;;
esac


203 204 205
#################
# Check for Win32
#################
206

207
AC_MSG_CHECKING([for some Win32 platform])
208 209
case "$target_or_host" in
  *-*-mingw* | *-*-cygwin*)
210 211 212 213 214 215 216 217 218 219
    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])
220
case "$target_or_host" in
221 222 223 224 225 226 227 228 229 230 231 232
  *-*-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")
233
AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes")
234 235 236

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

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

AC_SUBST(WINDRES)
246

247

248 249 250 251
###############
# Generic stuff
###############

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

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

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

267
if test -n "$DEBUGFLAG"; then
268
  AC_MSG_RESULT([yes])
269
  CFLAGS="$DEBUGFLAG $CFLAGS"
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
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])
286
fi
287

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

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

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

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

313

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

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

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

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

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

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

333

334 335 336 337
# 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".
338 339
if test "x$os_win32" = xyes; then
  if test "x$GCC" = xyes; then
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358
    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
359
    if test "x$msnative_struct" = x ; then
360
      AC_MSG_RESULT([no way])
361
      AC_MSG_WARN([build will be incompatible with GTK+ DLLs])
362 363 364 365 366 367 368
    else
      CFLAGS="$CFLAGS $msnative_struct"
      AC_MSG_RESULT([${msnative_struct}])
    fi
  fi
fi

369

370 371 372 373 374 375 376 377 378 379 380 381
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

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

385 386
AM_BINRELOC

387

388 389 390 391 392 393 394 395 396 397 398 399
# _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


400 401 402
######################
# Internationalisation
######################
403

404 405 406
# 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
407
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"
408

409
AC_PROG_INTLTOOL
410
AM_GLIB_GNU_GETTEXT
411

412

413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
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)


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

432

433 434 435 436
PKG_CHECK_MODULES(BABL, babl >= babl_required_version, :,
  AC_MSG_ERROR([Test for BABL failed. Please get it from http://gegl.org/]))


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


441
AM_PATH_GLIB_2_0(glib_required_version, :,
Sven Neumann's avatar
Sven Neumann committed
442
  AC_MSG_ERROR(Test for GLIB failed. See the file 'INSTALL' for help.),
443
  gobject gthread)
444

445
PKG_CHECK_MODULES(GMODULE_NO_EXPORT, gmodule-no-export-2.0)
446

447 448
PKG_CHECK_MODULES(GIO, gio-2.0)

449 450 451
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
452
else
453
  have_glib_2_19=no
454
fi
455
AC_MSG_RESULT($have_glib_2_19)
456

457

458
# Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
459 460
gimp_save_LIBS=$LIBS
LIBS="$LIBS $GLIB_LIBS"
461 462 463 464
AC_CHECK_FUNCS(bind_textdomain_codeset,,
  AC_MSG_ERROR([
*** Check for bind_textdomain_codeset() failed!  This is required.
]))
465 466 467 468 469
LIBS=$gimp_save_LIBS


AC_PATH_XTRA

470
AM_PATH_GTK_2_0(gtk_required_version, :,
471 472
  AC_MSG_ERROR(Test for GTK+ failed. See the file 'INSTALL' for help.),
  gthread)
Elliot Lee's avatar
Elliot Lee committed
473

474 475
AC_MSG_CHECKING([if GTK+ is version 2.17.0 or newer])
if $PKG_CONFIG --atleast-version=2.17.0 gtk+-2.0; then
476
  have_gtk_2_15=yes
477
else
478
  have_gtk_2_15=no
479
fi
480
AC_MSG_RESULT($have_gtk_2_15)
481

482
PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0 >= gdk_pixbuf_required_version)
483

484
AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
485
if test "x$GDK_PIXBUF_CSOURCE" = xno; then
486 487 488
  AC_MSG_ERROR(Could not find gdk-pixbuf-csource in your PATH)
fi

489
PKG_CHECK_MODULES(CAIRO, cairo >= cairo_required_version)
490

491 492
PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= fontconfig_required_version)

493
PKG_CHECK_MODULES(PANGOFT2, pangoft2 >= pangoft2_required_version, :,
494 495 496
  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.]))
497

498 499 500
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
501
else
502
  have_pango_1_21=no
503
fi
504
AC_MSG_RESULT($have_pango_1_21)
505

506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529
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
530

531 532
AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
if test "x$FREETYPE_CONFIG" != "xno" ; then
533
  AC_MSG_CHECKING([for freetype libraries])
534 535 536 537 538 539
  FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
  AC_MSG_RESULT($FREETYPE_LIBS)
fi
AC_SUBST(FREETYPE_LIBS)


540 541 542
##########################################
# Check for some special functions we need
##########################################
Elliot Lee's avatar
Elliot Lee committed
543

David Neary's avatar
David Neary committed
544 545
AC_CHECK_HEADERS(math.h ieeefp.h)

546
# DU4 native cc currently needs -std1 for ANSI mode (instead of K&R)
Manish Singh's avatar
Manish Singh committed
547 548 549 550 551 552 553 554 555 556 557 558 559
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
560 561 562 563
    AC_MSG_WARN([No ANSI prototypes found in library. (-std1 didn't work.)]),
    AC_MSG_RESULT),
  AC_MSG_RESULT())

564
# Check for finite or isfinite
565 566 567 568 569 570 571 572 573 574 575 576 577 578
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)

579 580 581
LIBS=$gimp_save_LIBS


582
# NeXTStep cc seems to need this
583 584 585 586 587 588 589 590 591 592 593
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.)])))

594
# check for rint
595 596 597 598 599 600
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)])])


601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616
######################################################
# 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)


617 618 619
########################
# Check for MMX assembly
########################
620

621 622 623 624 625 626
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)],,
627
  enable_sse=$enable_mmx)
628 629

if test "x$enable_mmx" = xyes; then
630 631
  GIMP_DETECT_CFLAGS(MMX_EXTRA_CFLAGS, '-mmmx')
  SSE_EXTRA_CFLAGS=
632

633
  AC_MSG_CHECKING(whether we can compile MMX code)
634

635 636
  mmx_save_CFLAGS="$CFLAGS"
  CFLAGS="$mmx_save_CFLAGS $MMX_EXTRA_CFLAGS"
637

638 639
  AC_COMPILE_IFELSE([asm ("movq 0, %mm0");],

640 641 642
    AC_DEFINE(USE_MMX, 1, [Define to 1 if MMX assembly is available.])
    AC_MSG_RESULT(yes)

643
    if test "x$enable_sse" = xyes; then
644 645
      GIMP_DETECT_CFLAGS(sse_flag, '-msse')
      SSE_EXTRA_CFLAGS="$MMX_EXTRA_CFLAGS $sse_flag"
646 647 648

      AC_MSG_CHECKING(whether we can compile SSE code)

649 650
      CFLAGS="$CFLAGS $sse_flag"

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

660
    fi
661
  ,
662 663
    enable_mmx=no
    AC_MSG_RESULT(no)
664
    AC_MSG_WARN([The assembler does not support the MMX command set.])
665
  )
666

667 668 669 670
  CFLAGS="$mmx_save_CFLAGS"

  AC_SUBST(MMX_EXTRA_CFLAGS)
  AC_SUBST(SSE_EXTRA_CFLAGS)
671
fi
672

673 674

############################
675
# Check for AltiVec assembly
676 677 678
############################

AC_ARG_ENABLE(altivec,
679
  [  --enable-altivec        enable AltiVec support (default=auto)],,
680 681 682
  enable_altivec=$have_ppc)

if test "x$enable_altivec" = xyes; then
683

684
  GIMP_DETECT_CFLAGS(altivec_flag, '-faltivec' '-maltivec -mabi=altivec')
685 686 687 688 689 690 691 692 693 694 695 696 697

  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
698
  AC_SUBST(ALTIVEC_EXTRA_CFLAGS)
699

700
  AC_MSG_CHECKING(whether we can compile AltiVec code)
701

702
  can_use_altivec=no
703
  if test -z "$ALTIVEC_EXTRA_CFLAGS"; then
704
    AC_MSG_RESULT(no)
Manish Singh's avatar
Manish Singh committed
705
    AC_MSG_WARN([The compiler does not support the AltiVec command set.])
706 707 708 709 710 711 712 713 714 715 716 717 718
  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)
719

720 721 722 723 724 725 726
    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
727 728

  enable_altivec="$can_use_altivec"
729
fi
730

731

732 733 734
###################################
# Checks for shared memory handling
###################################
735

736
# MacOS X has broken SysV shm
737 738
case "$target_or_host" in
  *-*-darwin* | *-*-rhapsody* | *-*-machten*)
739
    shmdefault=posix
740 741 742 743 744 745 746
    ;;
  *)
    shmdefault=sysv
    ;;
esac

shmtype=auto
747
AC_ARG_WITH(shm, [  --with-shm=none|sysv|posix|auto    shared memory transport type (default=auto)], shmtype=$with_shm)
748 749

case $shmtype in
750
  none|sysv|posix) ;;
751
  auto) shmtype=$shmdefault ;;
752
  *) AC_MSG_ERROR([Invalid shared memory transport type: use none, sysv, posix, or auto.]);;
753 754
esac

755 756 757 758

if test "x$platform_win32" = "xyes"; then
  shmtype=win32
elif test "x$shmtype" = "xsysv"; then
759 760
  AC_CHECK_HEADER(sys/ipc.h,
    [AC_DEFINE(HAVE_IPC_H, 1,
761
               [Define to 1 if you have the <sys/ipc.h> header file.])],
762 763 764 765 766
    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)
767

768 769 770
  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
771 772 773 774 775 776 777
	#include <sys/types.h>
	#include <sys/ipc.h>
	#include <sys/shm.h>
	int main()
	{
	  int id;
	  char *shmaddr;
778
	id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0600);
Elliot Lee's avatar
Elliot Lee committed
779 780 781 782 783 784 785 786 787 788 789 790 791
	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);
	}
792 793 794 795 796 797
      ],
      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))
798 799 800 801 802 803

    AC_DEFINE(USE_SYSV_SHM, 1, [Define to 1 to use SYSV shared memory])
  else
    shmtype=none
  fi
elif test "x$shmtype" = "xposix"; then
804 805 806 807 808 809
  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
810
    AC_CHECK_LIB(rt, shm_open, RT_LIBS="-lrt" have_shm_open=yes)
811 812
  fi
  AC_SUBST(RT_LIBS)
813 814 815

  AC_CHECK_HEADER(sys/mman.h,
    [AC_DEFINE(HAVE_MMAN_H, 1,
816
               [Define to 1 if you have the <sys/mman.h> header file.])],
817 818 819
    no_sys_mman=yes)

  if test "$ac_cv_func_mmap" = "yes" &&
820 821
     test "$ac_cv_header_sys_mman_h" = "yes" &&
     test "$have_shm_open" = "yes"; then
822 823 824
    AC_DEFINE(USE_POSIX_SHM, 1, [Define to 1 to use POSIX shared memory])
  else
    shmtype=none
825
  fi
Elliot Lee's avatar
Elliot Lee committed
826 827
fi

828 829
AC_MSG_CHECKING(for shared memory transport type)
AC_MSG_RESULT($shmtype)
830

831

832 833 834 835 836 837
########################
# Define a symbol prefix
########################

AC_MSG_CHECKING([whether symbols are prefixed])

838 839
case "$host_os" in
  mingw*)
840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857
    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)


858 859 860
############################
# Check for select and fdset
############################
Elliot Lee's avatar
Elliot Lee committed
861

862
if test "x$os_win32" != xyes; then
863 864 865
  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)
866
  if test "x$gimp_ok" = xno; then
867
      AC_EGREP_HEADER(fd_mask, sys/select.h, gimp_ok=yes)
868
      if test "x$gimp_ok" = xyes; then
869 870 871 872 873
	  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)
874
  if test "x$gimp_ok" = xno; then
875 876 877
      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
878 879
fi

880

881
#############################
882
# Threads and multi processor
883
#############################
884

885
AC_ARG_ENABLE(mp, [  --disable-mp            disable support for multiple processors])
886
if test "x$enable_mp" != "xno"; then
887 888
  AC_DEFINE(ENABLE_MP, 1,
	    [Define to 1 to enable support for multiple processors.])
Sven Neumann's avatar
Sven Neumann committed
889 890
fi

891 892 893 894

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

896 897
GIMP_COMMAND='gimp-gimp_app_version'

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

Sven Neumann's avatar
Sven Neumann committed
901
if test "$gdk_target" = x11; then
902

903
   # doc-shooter is X11 specific
904 905
   DOC_SHOOTER=doc-shooter

906
   # screenshot plug-in needs to link to X11 explicitely
907 908
   LIBSCREENSHOT="$X_LIBS -lX11"

909 910 911 912 913
   gimp_save_CFLAGS="$CFLAGS"
   gimp_save_LDFLAGS="$LDFLAGS"
   CFLAGS="$CFLAGS $GTK_CFLAGS"
   LDFLAGS="$LDFLAGS $X_LIBS"

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

928
   # Check for shaped window extension
929 930 931 932 933 934 935
   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"
936

937
   # check for the XFixes extension
938 939 940
   PKG_CHECK_MODULES(XFIXES, xfixes,
      AC_DEFINE(HAVE_XFIXES, 1,
                [Define to 1 to if the XFIXES X extension is available])
941 942
      LIBSCREENSHOT="$LIBSCREENSHOT $XFIXES_LIBS",
      AC_MSG_RESULT([no]))
943

944 945
else
   enable_gimp_remote="no (building for $gdk_target)"
946
fi
Sven Neumann's avatar
Sven Neumann committed
947

948
AC_SUBST(LIBXMU)
949
AC_SUBST(LIBSCREENSHOT)
950

951
AC_SUBST(DOC_SHOOTER)
952

953 954 955
AC_SUBST(GIMP_REMOTE)
AC_SUBST(GIMP_COMMAND)

956

957 958 959 960 961 962 963 964 965
############
# 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"


966 967 968 969
###################
# Check for libtiff
###################

970
have_libtiff=no
Sven Neumann's avatar
Sven Neumann committed
971
AC_ARG_WITH(libtiff,  [  --without-libtiff       build without TIFF support])
972
  if test "x$with_libtiff" != xno && test -z "$LIBTIFF"; then
973
    have_libtiff=yes
Sven Neumann's avatar
Sven Neumann committed
974 975
    AC_CHECK_LIB(tiff, TIFFReadScanline,
      [AC_CHECK_HEADER(tiffio.h,
976
	TIFF_LOAD='tiff-load$(EXEEXT)'; TIFF_SAVE='tiff-save$(EXEEXT)'; LIBTIFF='-ltiff',
977
	[have_libtiff="no (TIFF header files not found)"])],
Sven Neumann's avatar
Sven Neumann committed
978 979
      [AC_CHECK_LIB(tiff, TIFFWriteScanline,
	[AC_CHECK_HEADER(tiffio.h,
980
          TIFF_LOAD='tiff-load$(EXEEXT)'; TIFF_SAVE='tiff-save$(EXEEXT)'; LIBTIFF='-ltiff -ljpeg -lz',
981
	  [have_libtiff="no (TIFF header files not found)"])],
Sven Neumann's avatar
Sven Neumann committed
982 983
	[AC_CHECK_LIB(tiff34, TIFFFlushData,
	  [AC_CHECK_HEADER(tiffio.h,
984
            TIFF_LOAD='tiff-load$(EXEEXT)'; TIFF_SAVE='tiff-save$(EXEEXT)'; LIBTIFF='-ltiff34 -ljpeg -lz',
985 986
	    [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
987 988
  fi

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

995 996 997 998
  if test "x$have_libtiff" = xyes; then
    MIME_TYPES="$MIME_TYPES;image/tiff"
  fi

999 1000
AC_SUBST(TIFF_LOAD)
AC_SUBST(TIFF_SAVE)
1001 1002 1003 1004 1005 1006
AC_SUBST(LIBTIFF)


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

1008 1009
jpeg_ok=no

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

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

1044 1045 1046 1047
  if test "x$jpeg_ok" = xyes; then
    MIME_TYPES="$MIME_TYPES;image/jpeg"
  fi

1048
AM_CONDITIONAL(BUILD_JPEG, test "x$jpeg_ok" = xyes)
1049
AC_SUBST(LIBJPEG)
Sven Neumann's avatar
Sven Neumann committed
1050

1051

1052 1053
## 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
1054 1055
AM_CONDITIONAL(BUILD_XJT, test "x$jpeg_ok" = xyes && test "x$os_win32" = xno)
if test "x$jpeg_ok" != xyes; then
1056
  have_xjt="no (no JPEG library)"
1057
elif test "x$os_win32" = xyes; then
1058 1059 1060 1061
  have_xjt="no (not built on Windows)"
else
  have_xjt=yes
fi
1062

Sven Neumann's avatar
Sven Neumann committed
1063

1064 1065 1066 1067
################
# Check for libz
################

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

1077 1078 1079 1080
if test "x$have_zlib" = xyes; then
  MIME_TYPES="$MIME_TYPES;image/x-psd"
fi

1081 1082 1083 1084 1085 1086 1087 1088
AC_SUBST(LIBZ)
AC_SUBST(PSP)


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

1089
have_libpng=no
Sven Neumann's avatar
Sven Neumann committed
1090
AC_ARG_WITH(libpng,  [  --without-libpng        build without PNG support])
1091
if test "x$with_libpng" != xno; then
1092
  have_libpng=yes
1093 1094 1095 1096
  PKG_CHECK_MODULES(PNG, libpng,
    PNG='png$(EXEEXT)'
    LIBPNG="$PNG_LIBS",
    [have_libpng="no (libpng not found)"
Sven Neumann's avatar
Sven Neumann committed
1097
     AC_MSG_ERROR([
1098 1099 1100
*** 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
1101

1102 1103 1104 1105
if test "x$have_libpng" = xyes; then
  MIME_TYPES="$MIME_TYPES;image/png;image/x-icon"
fi

1106 1107
AC_SUBST(PNG)
AC_SUBST(LIBPNG)
Sven Neumann's avatar
Sven Neumann committed
1108

1109
AM_CONDITIONAL(HAVE_PNG, test "x$have_libpng" = xyes)
1110

Sven Neumann's avatar
Sven Neumann committed
1111

1112 1113 1114 1115
##################
# Check for libmng
##################

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

AC_SUBST(MNG)
AC_SUBST(LIBMNG)


1135 1136 1137 1138 1139 1140
############################################################
# 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.
############################################################

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

1151 1152
AC_SUBST(EXIF_CFLAGS)
AC_SUBST(EXIF_LIBS)
1153

1154

1155 1156 1157
#################
# Check for libaa
#################
1158

1159

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

1171 1172
AC_SUBST(AA)
AC_SUBST(LIBAA)
1173

1174

1175 1176 1177
##################
# Check for libxpm
##################
1178

1179 1180
gimp_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $X_CFLAGS"
1181 1182 1183 1184
gimp_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $X_LIBS"
if test "$gdk_target" = x11; then
  lib_X11=-lX11
1185
fi
1186
have_libxpm=yes
1187 1188 1189
if test -z "$LIBXPM"; then
  AC_CHECK_LIB(Xpm, XpmReadFileToXpmImage,
    [AC_CHECK_HEADER(X11/xpm.h,
1190
      XPM='xpm$(EXEEXT)'; LIBXPM="$X_LIBS $X_PRE_LIBS $lib_X11 -lXpm",
1191 1192
      [have_libxpm="no (XPM header file not found)"])],
    [have_libxpm="no (XPM library not found)"], $X_PRE_LIBS $lib_X11)
Sven Neumann's avatar
Sven Neumann committed
1193
fi
1194
CFLAGS="$gimp_save_CFLAGS"
1195
LDFLAGS="$gimp_save_LDFLAGS"
1196

1197 1198 1199 1200
if test "x$have_libxpm" = xyes; then
  MIME_TYPES="$MIME_TYPES;image/x-xpixmap"
fi

1201 1202
AC_SUBST(XPM)
AC_SUBST(LIBXPM)
1203

1204

1205 1206 1207 1208
####################
# Check for gtkhtml2
####################

1209 1210 1211 1212 1213 1214
AC_ARG_WITH(gtkhtml2, [  --without-gtkhtml2      build without gtkhtml2 support])

have_gtkhtml2=no
if test "x$with_gtkhtml2" != xno; then
  PKG_CHECK_MODULES(GTKHTML2, libgtkhtml-2.0 >= gtkhtml2_required_version,
    have_gtkhtml2=yes,
1215
    AC_MSG_RESULT([no])
1216
    have_gtkhtml2="no (GtkHtml2 not found)")
1217
else
1218
  have_gtkhtml2="no (GtkHtml2 support disabled)"
1219
fi
1220

1221
AM_CONDITIONAL(BUILD_HELP_BROWSER, test "x$have_gtkhtml2" = xyes)
1222

1223

1224 1225 1226 1227
###################
# Check for librsvg
###################

1228 1229
AC_ARG_WITH(librsvg,[  --without-librsvg       build without librsvg support])

1230
have_librsvg=no
1231
if test "x$with_librsvg" != xno; then
1232
  have_librsvg=yes
1233 1234 1235
  PKG_CHECK_MODULES(SVG, librsvg-2.0 >= rsvg_required_version,
    SVG='svg$(EXEEXT)'
    LIBSVG=$SVG_LIBS,
1236
    AC_MSG_RESULT([no])
1237
    have_librsvg="no (librsvg not found)")
1238
else
1239
   have_librsvg="no (librsvg support disabled)"
1240
fi
1241

1242 1243 1244 1245
if test "x$have_librsvg" = xyes; then
  MIME_TYPES="$MIME_TYPES;image/svg+xml"
fi

1246 1247 1248
AC_SUBST(SVG)
AC_SUBST(LIBSVG)

Sven Neumann's avatar
Sven Neumann committed
1249

1250
####################################
1251
# Allow to disable the print plug-in
1252 1253
####################################

1254
enable_print="no (disabled)"
1255
AC_ARG_WITH(print,[  --without-print         build without print support])
1256 1257

if test "x$with_print" != xno; then
1258
    enable_print="yes"
1259 1260 1261 1262
fi
AM_CONDITIONAL(BUILD_PRINT, test "x$enable_print" == xyes)


Sven Neumann's avatar
Sven Neumann committed
1263 1264 1265
######################
# Check for libpoppler
######################
1266

1267
have_poppler=no
1268 1269 1270 1271 1272 1273 1274 1275 1276
AC_ARG_WITH(poppler,[  --without-poppler       build without poppler support])

if test "x$with_poppler" != xno; then
  PKG_CHECK_MODULES(POPPLER,
    poppler-glib >= poppler_required_version gthread-2.0,
    POPPLER='poppler$(EXEEXT)'
    LIBPOPPLER=$POPPLER_LIBS
    AC_DEFINE(HAVE_POPPLER, 1, [Define to 1 if libpoppler is available])
    have_poppler=yes,
1277
    AC_MSG_RESULT([no])
1278
    have_poppler="Using PostScript plug-in (libpoppler not found)")
1279
else
1280
  have_poppler="Using PostScript plug-in (libpoppler support disabled)"
1281
fi
1282 1283 1284 1285

AC_SUBST(POPPLER)
AC_SUBST(LIBPOPPLER)

1286

1287
###############################################
1288
# Check for gio/gvfs, gnome-vfs and libcurl
1289 1290
# (and optionally libgnomeui and gnome-keyring)
###############################################
1291

1292
uri_plugin=no
1293 1294


1295
AC_ARG_WITH(gvfs, [  --without-gvfs          build without GIO/GVfs support])
1296

1297
AM_CONDITIONAL(HAVE_GVFS, test "x$with_gvfs" != xno)
1298 1299


1300
gnome_vfs_modules="gnome-vfs-2.0 >= gnome_vfs_required_version"
1301

1302
AC_ARG_WITH(gnomevfs, [  --without-gnomevfs      build without gnomevfs support])
1303 1304 1305 1306 1307

have_gnomeui="no (disabled)"
have_gnome_keyring="no (disabled)"
have_gnomevfs="no (disabled)"

1308
if test "x$with_gnomevfs" != xno; then
1309

1310 1311
if $PKG_CONFIG --atleast-version=gnomeui_required_version libgnomeui-2.0; then
  have_gnomeui=yes
1312
  gnome_vfs_modules="$gnome_vfs_modules libgnomeui-2.0"
1313
else
1314
  have_gnomeui="no (libgnomeui-2.0 not found)"
1315 1316
fi

1317 1318
if $PKG_CONFIG --atleast-version=gnome_keyring_required_version gnome-keyring-1; then
  have_gnome_keyring=yes
1319
  gnome_vfs_modules="$gnome_vfs_modules gnome-keyring-1"
1320
else
1321
  have_gnome_keyring="no (gnome-keyring-1 not found)"
1322 1323
fi

1324
PKG_CHECK_MODULES(URI_GNOME_VFS, $gnome_vfs_modules,
1325
  have_gnomevfs=yes,
1326
  AC_MSG_RESULT([no])
1327