1# Process this file with autoconf to produce a configure script.
2
3AC_PREREQ(2.54)
4
5# Making releases on the stable branch:
6#   gimp_micro_version += 1;
7#   gimp_interface_age += 1;
8#
9# For a description of libtool version variables, see:
10# devel-docs/libtool-instructions.txt
11
12m4_define([gimp_major_version], [2])
13m4_define([gimp_minor_version], [10])
14m4_define([gimp_micro_version], [30])
15m4_define([gimp_real_version],
16          [gimp_major_version.gimp_minor_version.gimp_micro_version])
17m4_define([gimp_version], [gimp_real_version])
18m4_define([gimp_interface_age], [30])
19m4_define([gimp_binary_age],
20          [m4_eval(100 * gimp_minor_version + gimp_micro_version)])
21
22# For overriding the version string. Comment out if not needed.
23# m4_define([gimp_version], [2.10.0])
24
25# This is the X.Y used in -lgimp-X.Y
26m4_define([gimp_api_version], [2.0])
27
28# Versions used for apps, plugins, tools, pkg-config files, and data,
29# as well as global and user prefs
30m4_define([gimp_app_version], [2.10])
31m4_define([gimp_plugin_version], [2.0])
32m4_define([gimp_tool_version], [2.0])
33m4_define([gimp_pkgconfig_version], [2.0])
34m4_define([gimp_data_version], [2.0])
35m4_define([gimp_sysconf_version], [2.0])
36m4_define([gimp_user_version], [2.10])
37
38m4_define([gimp_unstable],
39          m4_if(m4_eval(gimp_minor_version % 2), [1], [yes], [no]))
40m4_define([gimp_stable],
41          m4_if(m4_eval(gimp_minor_version % 2), [0], [yes], [no]))
42
43m4_define([gimp_full_name], [GNU Image Manipulation Program])
44
45# required versions of other packages
46m4_define([alsa_required_version], [1.0.0])
47m4_define([atk_required_version], [2.2.0])
48m4_define([babl_required_version], [0.1.78])
49m4_define([cairo_pdf_required_version], [1.12.2])
50m4_define([cairo_required_version], [1.12.2])
51m4_define([fontconfig_required_version], [2.12.4])
52m4_define([freetype2_required_version], [2.1.7])
53m4_define([gdk_pixbuf_required_version], [2.30.8])
54m4_define([gegl_major_minor_version], [0.4])
55m4_define([gegl_micro_version], [34])
56m4_define([gegl_required_version],
57          [gegl_major_minor_version.gegl_micro_version])
58m4_define([gexiv2_required_version], [0.10.6])
59m4_define([glib_required_version], [2.56.2])
60m4_define([gtk_mac_integration_required_version], [2.0.0])
61m4_define([gtk_required_version], [2.24.32])
62m4_define([gtkdoc_required_version], [1.0])
63m4_define([harfbuzz_required_version], [0.9.19])
64m4_define([intltool_required_version], [0.40.1])
65m4_define([json_glib_required_version], [1.2.6])
66m4_define([lcms_required_version], [2.8])
67m4_define([libgudev_required_version], [167])
68m4_define([libheif_required_version], [1.3.2])
69m4_define([liblzma_required_version], [5.0.0])
70m4_define([libmypaint_required_version], [1.3.0])
71m4_define([libpng_required_version], [1.6.25])
72m4_define([libunwind_required_version], [1.1.0])
73m4_define([openexr_required_version], [1.6.1])
74m4_define([openjpeg_required_version], [2.1.0])
75m4_define([pangocairo_required_version], [1.29.4])
76m4_define([perl_required_version], [5.10.0])
77m4_define([poppler_data_required_version], [0.4.7])
78m4_define([poppler_required_version], [0.50.0])
79m4_define([pycairo_required_version], [1.0.2])
80m4_define([pygtk_required_version], [2.10.4])
81m4_define([python2_required_version], [2.5.0])
82m4_define([rsvg_required_version], [2.40.6])
83m4_define([webkit_required_version], [1.6.1])
84m4_define([webp_required_version], [0.6.0])
85m4_define([wmf_required_version], [0.2.8])
86
87# Current test considers only 2 version numbers. If we update the recommended
88# version of gettext with more version numbers, please update the tests.
89m4_define([xgettext_required_version], [0.19])
90
91AC_INIT([GIMP], [gimp_version],
92        [https://gitlab.gnome.org/GNOME/gimp/issues/new],
93        [gimp])
94
95AC_CONFIG_HEADERS([config.h])
96AC_CONFIG_SRCDIR([app/core/gimp.c])
97AC_CONFIG_MACRO_DIR([m4macros])
98
99AM_INIT_AUTOMAKE(no-define dist-bzip2 dist-xz no-dist-gzip -Wno-portability)
100
101# Enable silent build rules by default, requires at least
102# Automake-1.11. Disable by either passing --disable-silent-rules to
103# configure or passing V=1 to make
104m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
105
106GIMP_MAJOR_VERSION=gimp_major_version
107GIMP_MINOR_VERSION=gimp_minor_version
108GIMP_MICRO_VERSION=gimp_micro_version
109GIMP_INTERFACE_AGE=gimp_interface_age
110GIMP_BINARY_AGE=gimp_binary_age
111GIMP_VERSION=gimp_version
112GIMP_REAL_VERSION=gimp_real_version
113GIMP_API_VERSION=gimp_api_version
114GIMP_APP_VERSION=gimp_app_version
115GIMP_PLUGIN_VERSION=gimp_plugin_version
116GIMP_TOOL_VERSION=gimp_tool_version
117GIMP_PKGCONFIG_VERSION=gimp_pkgconfig_version
118GIMP_DATA_VERSION=gimp_data_version
119GIMP_SYSCONF_VERSION=gimp_sysconf_version
120GIMP_USER_VERSION=gimp_user_version
121GIMP_UNSTABLE=gimp_unstable
122GIMP_FULL_NAME="gimp_full_name"
123AC_SUBST(GIMP_MAJOR_VERSION)
124AC_SUBST(GIMP_MINOR_VERSION)
125AC_SUBST(GIMP_MICRO_VERSION)
126AC_SUBST(GIMP_INTERFACE_AGE)
127AC_SUBST(GIMP_BINARY_AGE)
128AC_SUBST(GIMP_VERSION)
129AC_SUBST(GIMP_REAL_VERSION)
130AC_SUBST(GIMP_API_VERSION)
131AC_SUBST(GIMP_APP_VERSION)
132AC_SUBST(GIMP_PLUGIN_VERSION)
133AC_SUBST(GIMP_TOOL_VERSION)
134AC_SUBST(GIMP_PKGCONFIG_VERSION)
135AC_SUBST(GIMP_DATA_VERSION)
136AC_SUBST(GIMP_SYSCONF_VERSION)
137AC_SUBST(GIMP_USER_VERSION)
138AC_SUBST(GIMP_UNSTABLE)
139AC_SUBST(GIMP_FULL_NAME)
140
141# Version strings used in some source, though it seems unnecessary to
142# declare them in the public API (libgimpbase/gimpversion.h).
143AC_DEFINE(GIMP_PKGCONFIG_VERSION, "gimp_pkgconfig_version",
144          [libgimp pkg-config version])
145AC_DEFINE(GIMP_TOOL_VERSION, "gimp_tool_version",
146          [GIMP tools version])
147
148# These are used in the .pc files
149GLIB_REQUIRED_VERSION=glib_required_version
150GDK_PIXBUF_REQUIRED_VERSION=gdk_pixbuf_required_version
151GTK_REQUIRED_VERSION=gtk_required_version
152CAIRO_REQUIRED_VERSION=cairo_required_version
153CAIRO_PDF_REQUIRED_VERSION=cairo_pdf_required_version
154GEGL_MAJOR_MINOR_VERSION=gegl_major_minor_version
155GEGL_REQUIRED_VERSION=gegl_required_version
156GEXIV2_REQUIRED_VERSION=gexiv2_required_version
157LCMS_REQUIRED_VERSION=lcms_required_version
158LIBPNG_REQUIRED_VERSION=libpng_required_version
159LIBLZMA_REQUIRED_VERSION=liblzma_required_version
160LIBMYPAINT_REQUIRED_VERSION=libmypaint_required_version
161PANGOCAIRO_REQUIRED_VERSION=pangocairo_required_version
162BABL_REQUIRED_VERSION=babl_required_version
163FONTCONFIG_REQUIRED_VERSION=fontconfig_required_version
164FREETYPE2_REQUIRED_VERSION=freetype2_required_version
165HARFBUZZ_REQUIRED_VERSION=harfbuzz_required_version
166WEBKIT_REQUIRED_VERSION=webkit_required_version
167ATK_REQUIRED_VERSION=atk_required_version
168RSVG_REQUIRED_VERSION=rsvg_required_version
169WMF_REQUIRED_VERSION=wmf_required_version
170POPPLER_REQUIRED_VERSION=poppler_required_version
171POPPLER_DATA_REQUIRED_VERSION=poppler_data_required_version
172OPENEXR_REQUIRED_VERSION=openexr_required_version
173OPENJPEG_REQUIRED_VERSION=openjpeg_required_version
174INTLTOOL_REQUIRED_VERSION=intltool_required_version
175PERL_REQUIRED_VERSION=perl_required_version
176PYTHON2_REQUIRED_VERSION=python2_required_version
177WEBP_REQUIRED_VERSION=webp_required_version
178LIBHEIF_REQUIRED_VERSION=libheif_required_version
179LIBUNWIND_REQUIRED_VERSION=libunwind_required_version
180XGETTEXT_REQUIRED_VERSION=xgettext_required_version
181AC_SUBST(GLIB_REQUIRED_VERSION)
182AC_SUBST(GDK_PIXBUF_REQUIRED_VERSION)
183AC_SUBST(GTK_REQUIRED_VERSION)
184AC_SUBST(CAIRO_REQUIRED_VERSION)
185AC_SUBST(CAIRO_PDF_REQUIRED_VERSION)
186AC_SUBST(GEGL_MAJOR_MINOR_VERSION)
187AC_SUBST(GEGL_REQUIRED_VERSION)
188AC_SUBST(GEXIV2_REQUIRED_VERSION)
189AC_SUBST(LCMS_REQUIRED_VERSION)
190AC_SUBST(LIBPNG_REQUIRED_VERSION)
191AC_SUBST(LIBLZMA_REQUIRED_VERSION)
192AC_SUBST(LIBMYPAINT_REQUIRED_VERSION)
193AC_SUBST(PANGOCAIRO_REQUIRED_VERSION)
194AC_SUBST(BABL_REQUIRED_VERSION)
195AC_SUBST(FONTCONFIG_REQUIRED_VERSION)
196AC_SUBST(FREETYPE2_REQUIRED_VERSION)
197AC_SUBST(HARFBUZZ_REQUIRED_VERSION)
198AC_SUBST(WEBKIT_REQUIRED_VERSION)
199AC_SUBST(ATK_REQUIRED_VERSION)
200AC_SUBST(RSVG_REQUIRED_VERSION)
201AC_SUBST(WMF_REQUIRED_VERSION)
202AC_SUBST(POPPLER_REQUIRED_VERSION)
203AC_SUBST(POPPLER_DATA_REQUIRED_VERSION)
204AC_SUBST(OPENEXR_REQUIRED_VERSION)
205AC_SUBST(OPENJPEG_REQUIRED_VERSION)
206AC_SUBST(INTLTOOL_REQUIRED_VERSION)
207AC_SUBST(PERL_REQUIRED_VERSION)
208AC_SUBST(PYTHON2_REQUIRED_VERSION)
209AC_SUBST(WEBP_REQUIRED_VERSION)
210AC_SUBST(LIBHEIF_REQUIRED_VERSION)
211AC_SUBST(LIBUNWIND_REQUIRED_VERSION)
212AC_SUBST(XGETTEXT_REQUIRED_VERSION)
213
214# The symbol GIMP_UNSTABLE is defined above for substitution in
215# Makefiles and conditionally defined here as a preprocessor symbol
216# and automake conditional.
217if test "x$GIMP_UNSTABLE" = "xyes"; then
218  AC_DEFINE(GIMP_UNSTABLE, 1,
219            [Define to 1 if this is an unstable version of GIMP])
220fi
221AM_CONDITIONAL(GIMP_UNSTABLE, test "x$GIMP_UNSTABLE" = "xyes")
222
223
224# libtool versioning
225m4_define([lt_current], [m4_eval(100 * gimp_minor_version + gimp_micro_version - gimp_interface_age)])
226m4_define([lt_revision], [gimp_interface_age])
227m4_define([lt_age], [m4_eval(gimp_binary_age - gimp_interface_age)])
228LT_VERSION_INFO="lt_current:lt_revision:lt_age"
229LT_CURRENT_MINUS_AGE=m4_eval(lt_current - lt_age)
230AC_SUBST(LT_VERSION_INFO)
231AC_SUBST(LT_CURRENT_MINUS_AGE)
232
233
234# gettext i18n support
235GETTEXT_PACKAGE=gimp20
236AC_SUBST(GETTEXT_PACKAGE)
237AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
238                   [The prefix for our gettext translation domains.])
239
240# work around intltool-update issues during 'make distcheck'
241AS_IF([test "x$0" != "x./configure"], [
242        AC_SUBST([INTLTOOL_UPDATE], [/bin/true])
243])
244
245# Determine a C compiler to use
246AC_PROG_CC
247AX_PROG_CC_FOR_BUILD
248# Works around a bug in AX_PROG_CC_FOR_BUILD for build with MinGW on
249# Windows. See bug 780270, comment 18.
250case "$build_os" in
251  cygwin*|mingw32*|mingw64*)	BUILD_EXEEXT=.exe ;;
252esac
253AM_PROG_CC_C_O
254
255# Determine a C++ compiler to use
256AC_PROG_CXX
257AX_CXX_COMPILE_STDCXX([14], , [mandatory])
258
259# Initialize libtool
260LT_PREREQ([2.2])
261LT_INIT([disable-static win32-dll])
262
263AM_PROG_AS
264
265# Initialize maintainer mode
266AM_MAINTAINER_MODE([enable])
267
268# Check for pkg-config
269PKG_PROG_PKG_CONFIG(0.16)
270
271
272#########################
273# Check host architecture
274#########################
275
276AC_CANONICAL_HOST
277
278AC_MSG_CHECKING([for host type])
279AC_MSG_RESULT([$host])
280
281AC_MSG_CHECKING([for host processor])
282case "$host_cpu" in
283  i*86)
284    have_x86=yes
285    AC_DEFINE(ARCH_X86, 1, [Define to 1 if you are compiling for ix86.])
286    AC_MSG_RESULT([x86])
287    ;;
288  x86_64)
289    have_x86=yes
290    AC_DEFINE(ARCH_X86, 1, [Define to 1 if you are compiling for ix86.])
291    AC_DEFINE(ARCH_X86_64, 1, [Define to 1 if you are compiling for amd64.])
292    AC_MSG_RESULT([x86-64])
293    ;;
294  ppc | powerpc)
295    have_ppc=yes
296    AC_DEFINE(ARCH_PPC, 1, [Define to 1 if you are compiling for PowerPC.])
297    AC_MSG_RESULT([PowerPC])
298    ;;
299  ppc64 | powerpc64)
300    have_ppc=yes
301    AC_DEFINE(ARCH_PPC, 1, [Define to 1 if you are compiling for PowerPC.])
302    AC_DEFINE(ARCH_PPC64, 1, [Define to 1 if you are compiling for PowerPC64.])
303    AC_MSG_RESULT([64-bit PowerPC])
304    ;;
305  *)
306    AC_MSG_RESULT([unknown])
307    ;;
308esac
309
310
311#################
312# Check for Linux
313#################
314
315AC_MSG_CHECKING([if compiling for Linux])
316case "$host_os" in
317  linux*)
318    platform_linux=yes
319    ;;
320  *)
321    platform_linux=no
322    ;;
323esac
324AC_MSG_RESULT([$platform_linux])
325AM_CONDITIONAL(PLATFORM_LINUX, test "$platform_linux" = "yes")
326
327
328#################
329# Check for Win32
330#################
331
332AC_MSG_CHECKING([if compiling for Win32])
333case "$host_os" in
334  msys* | mingw* | cygwin*)
335    platform_win32=yes
336    ;;
337  *)
338    platform_win32=no
339    ;;
340esac
341AC_MSG_RESULT([$platform_win32])
342AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
343
344PATHSEP=':'
345os_win32=no
346if test "x$platform_win32" != xno; then
347  AC_MSG_CHECKING([if this is native Win32])
348  case "$host_os" in
349    msys* | mingw*)
350      os_win32=yes
351      case "$host_cpu" in
352        x86_64)
353        ;;
354        *)
355        WIN32_LARGE_ADDRESS_AWARE='-Wl,--large-address-aware'
356        ;;
357      esac
358      PATHSEP=';'
359      ;;
360    *)
361      ;;
362  esac
363  AC_MSG_RESULT([$os_win32])
364fi
365AC_SUBST(WIN32_LARGE_ADDRESS_AWARE)
366AC_SUBST(PATHSEP)
367AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
368AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes")
369
370if test "$os_win32" = "yes"; then
371  AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
372  AC_CHECK_TOOL(WINDRES, windres, :)
373else
374  WINDRES=":"
375fi
376
377AM_CONDITIONAL(MS_LIB_AVAILABLE, test "x$ms_librarian" = xyes)
378AM_CONDITIONAL(HAVE_WINDRES, test "x$WINDRES" != "x:")
379
380AC_SUBST(WINDRES)
381
382
383####################
384# Check for Mac OS X
385####################
386
387platform_osx=no
388AC_MSG_CHECKING([if compiling for Mac OS X])
389case "$host_os" in
390  darwin*)
391     AC_MSG_RESULT(yes)
392     AC_DEFINE(PLATFORM_OSX, 1, [define to 1 if compiling for Mac OS X])
393     platform_osx=yes
394     ;;
395  *)
396     ;;
397esac
398AC_MSG_RESULT($platform_osx)
399AM_CONDITIONAL(PLATFORM_OSX, test "x$platform_osx" = xyes)
400
401
402###############
403# Generic stuff
404###############
405
406# Checks for programs.
407AC_PROG_INSTALL
408AC_PROG_MAKE_SET
409AC_PROG_LN_S
410
411# Large file support for the swap file
412AC_SYS_LARGEFILE
413
414AC_MSG_CHECKING([whether to turn on debugging])
415AC_ARG_ENABLE(debug,
416              [  --enable-debug          turn on debugging (default=no)],
417              if eval "test x$enable_debug = xyes"; then
418                DEBUGFLAG="-g"
419              fi)
420
421if test -n "$DEBUGFLAG"; then
422  AC_MSG_RESULT([yes])
423  CFLAGS="$DEBUGFLAG $CFLAGS"
424else
425  AC_MSG_RESULT([no])
426fi
427
428AC_MSG_CHECKING([whether to turn on profiling])
429AC_ARG_ENABLE(profile,
430              [  --enable-profile        turn on profiling (default=no)],
431              if eval "test x$enable_profile = xyes"; then
432                PROFFLAG="-pg"
433              fi)
434
435if test -n "$PROFFLAG"; then
436  AC_MSG_RESULT([yes])
437  CFLAGS="$PROFFLAG $CFLAGS"
438else
439  AC_MSG_RESULT([no])
440fi
441
442AC_ARG_ENABLE(ansi,
443              [  --enable-ansi           turn on strict ansi (default=no)],,
444              enable_ansi=no)
445
446changequote(,)dnl
447if eval "test x$GCC = xyes"; then
448  case " $CFLAGS " in
449  *[\ \	]-Wall[\ \	]*) ;;
450  *) CFLAGS="$CFLAGS -Wall" ;;
451  esac
452
453  if test "x$enable_ansi" = "xyes"; then
454    case " $CFLAGS " in
455    *[\ \	]-ansi[\ \	]*) ;;
456    *) CFLAGS="$CFLAGS -ansi" ;;
457    esac
458
459    case " $CFLAGS " in
460    *[\ \	]-pedantic[\ \	]*) ;;
461    *) CFLAGS="$CFLAGS -pedantic" ;;
462    esac
463  fi
464fi
465changequote([,])dnl
466
467
468# If possible, warn if C99isms are used
469GIMP_DETECT_CFLAGS(extra_warnings, '-Wdeclaration-after-statement')
470CFLAGS="$CFLAGS $extra_warnings"
471
472GIMP_DETECT_CFLAGS(extra_warnings, '-Wmissing-prototypes')
473CFLAGS="$CFLAGS $extra_warnings"
474
475# We really don't want anyone using code with missing prototypes, which
476# can cause random behavior. If compile breaks due to the following,
477# come to us and we will point you to a newer version which works.
478#
479GIMP_DETECT_CFLAGS(extra_warnings, '-Werror=missing-prototypes')
480CFLAGS="$CFLAGS $extra_warnings"
481
482GIMP_DETECT_CFLAGS(extra_warnings, '-Wstrict-prototypes')
483CFLAGS="$CFLAGS $extra_warnings"
484
485GIMP_DETECT_CFLAGS(extra_warnings, '-Wmissing-declarations')
486CFLAGS="$CFLAGS $extra_warnings"
487
488GIMP_DETECT_CFLAGS(extra_warnings, '-Winit-self')
489CFLAGS="$CFLAGS $extra_warnings"
490
491GIMP_DETECT_CFLAGS(extra_warnings, '-Wpointer-arith')
492CFLAGS="$CFLAGS $extra_warnings"
493
494GIMP_DETECT_CFLAGS(extra_warnings, '-Wold-style-definition')
495CFLAGS="$CFLAGS $extra_warnings"
496
497GIMP_DETECT_CFLAGS(extra_warnings, '-Wmissing-format-attribute')
498CFLAGS="$CFLAGS $extra_warnings"
499
500GIMP_DETECT_CFLAGS(extra_warnings, '-Wformat-security')
501CFLAGS="$CFLAGS $extra_warnings"
502
503GIMP_DETECT_CFLAGS(extra_warnings, '-Wlogical-op')
504CFLAGS="$CFLAGS $extra_warnings"
505
506GIMP_DETECT_CFLAGS(extra_warnings, '-Wtype-limits')
507CFLAGS="$CFLAGS $extra_warnings"
508
509GIMP_DETECT_CFLAGS(extra_warnings, '-fno-common')
510CFLAGS="$CFLAGS $extra_warnings"
511
512GIMP_DETECT_CFLAGS(extra_warnings, '-fdiagnostics-show-option')
513CFLAGS="$CFLAGS $extra_warnings"
514
515GIMP_DETECT_CFLAGS(extra_warnings, '-Wreturn-type')
516CFLAGS="$CFLAGS $extra_warnings"
517
518# -Wreturn-type warns on forgotten return on non-void functions,
519# but not of g_return_if_fail() on non-void functions.
520# -Wsystem-headers is needed for that.
521# Unfortunately it pulls tons of warnings on some systems.
522# So we comment out for now.
523# GIMP_DETECT_CFLAGS(extra_warnings, '-Wsystem-headers')
524# CFLAGS="$CFLAGS $extra_warnings"
525
526# Extra optimization flags for super performance
527GIMP_DETECT_CFLAGS(extra_warnings, '--omg-optimized')
528CFLAGS="$CFLAGS $extra_warnings"
529
530GIMP_DETECT_CFLAGS(extra_warnings, '--disable-instructions')
531CFLAGS="$CFLAGS $extra_warnings"
532
533
534# Ensure MSVC-compatible struct packing convention is used when
535# compiling for Win32 with gcc.
536# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
537# gcc2 uses "-fnative-struct".
538if test "x$os_win32" = xyes; then
539  if test "x$GCC" = xyes; then
540    msnative_struct=''
541    AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
542    if test -z "$ac_cv_prog_CC"; then
543      our_gcc="$CC"
544    else
545      our_gcc="$ac_cv_prog_CC"
546    fi
547    case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
548      2.)
549	if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
550	  msnative_struct='-fnative-struct'
551	fi
552	;;
553      *)
554	if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
555	  msnative_struct='-mms-bitfields'
556	fi
557	;;
558    esac
559    if test "x$msnative_struct" = x ; then
560      AC_MSG_RESULT([no way])
561      AC_MSG_WARN([build will be incompatible with GTK+ DLLs])
562    else
563      CFLAGS="$CFLAGS $msnative_struct"
564      AC_MSG_RESULT([${msnative_struct}])
565    fi
566  fi
567fi
568
569if test "x$GCC" = xyes; then
570  gcc_version=`$CC -v 2>&1|grep 'gcc version'|sed -e 's/.*gcc version \([[0-9.]]\+\)[[^0-9.]].*/\1/'`
571  if test "x$gcc_version" = "x7.2.0" ; then
572    warning_gcc="
573WARNING: GCC 7.2.0 has a serious bug affecting GEGL/GIMP. We advise
574         against using this version of the compiler (previous and
575         further versions are fine).
576         See https://bugzilla.gnome.org/show_bug.cgi?id=787222"
577  fi
578  # For GCC, use -v which has more information than --version.
579  CC_VERSION_OPTS="-v"
580else
581  # This is the list of common options used by autotools to check
582  # versions for various compilers.
583  CC_VERSION_OPTS="--version -v -V -qversion"
584fi
585
586for CC_VERSION_OPT in $CC_VERSION_OPTS; do
587  # We run $CC, and escape and format its output, in a single step,
588  # since some shells expand escape sequences in "echo" arguments.
589  CC_VERSION="`$CC $CC_VERSION_OPT 2>&1 | sed -e 's/\\\\/\\\\\\\\\\\\\\\\/g;s/^/\\\\t/;s/$/\\\\n/' | tr -d '\n'`"
590  if test $? -eq 0; then
591    break
592  fi
593done
594
595AC_SUBST(CC_VERSION)
596
597AC_HEADER_STDC
598AC_HEADER_SYS_WAIT
599AC_HEADER_TIME
600
601AC_CHECK_HEADERS(execinfo.h fcntl.h sys/param.h sys/prctl.h sys/thr.h sys/time.h sys/times.h sys/wait.h unistd.h)
602AC_CHECK_FUNCS(backtrace, , AC_CHECK_LIB(execinfo, backtrace))
603
604AC_TYPE_PID_T
605AC_FUNC_VPRINTF
606
607AC_FUNC_ALLOCA
608
609# check some more funcs
610AC_CHECK_FUNCS(fsync)
611AC_CHECK_FUNCS(difftime mmap)
612AC_CHECK_FUNCS(thr_self)
613
614
615# _NL_MEASUREMENT_MEASUREMENT is an enum and not a define
616AC_MSG_CHECKING([for _NL_MEASUREMENT_MEASUREMENT])
617AC_LINK_IFELSE(
618  [AC_LANG_PROGRAM(
619    [[#include <langinfo.h>]],
620    [[char c = *((unsigned char *)  nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));]])],
621  [nl_ok=yes],
622  [nl_ok=no])
623AC_MSG_RESULT($nl_ok)
624if test "$nl_ok" = "yes"; then
625  AC_DEFINE(HAVE__NL_MEASUREMENT_MEASUREMENT, 1,
626	    [Define to 1 if _NL_MEASUREMENT_MEASUREMENT is available])
627fi
628
629# Macro to keep track of failed dependencies.
630
631required_deps=''
632
633# To add a required dependency error, call: add_deps_error([dependency]).
634# If details about the dependency are needed:
635# add_deps_error([dependency], [first line, second line])
636m4_define([add_deps_error], [
637  AC_MSG_NOTICE([Eeeeeeeeeeeeeeeeeeeeek! Missing dep: $1])
638  required_deps="$required_deps
639  - Error: missing dependency $1"
640  m4_foreach([more], [$2], [
641  required_deps="$required_deps
642      *** more"])])
643
644######################
645# Internationalisation
646######################
647
648IT_PROG_INTLTOOL(intltool_required_version)
649AM_GLIB_GNU_GETTEXT
650
651# Testing xgettext version since we had some problem with localizing script-fu. See bug 720052.
652AC_MSG_CHECKING([for xgettext version (>= xgettext_required_version)])
653XGETTEXT_REQUIRED_VERSION_MAJOR=`echo $XGETTEXT_REQUIRED_VERSION | awk -F. '{ print $ 1; }'`
654XGETTEXT_REQUIRED_VERSION_MINOR_1=`echo $XGETTEXT_REQUIRED_VERSION | awk -F. '{ print $ 2; }'`
655
656XGETTEXT_APPLIED_VERSION=`$XGETTEXT --version | head -1 | cut -d" " -f4`
657XGETTEXT_APPLIED_VERSION_MAJOR=`echo $XGETTEXT_APPLIED_VERSION | awk -F. '{ print $ 1; }'`
658XGETTEXT_APPLIED_VERSION_MINOR_1=`echo $XGETTEXT_APPLIED_VERSION | awk -F. '{ print $ 2; }'`
659
660have_required_xgettext="no"
661if test -n "$XGETTEXT_APPLIED_VERSION_MAJOR"; then
662    if test "$XGETTEXT_REQUIRED_VERSION_MAJOR" -lt "$XGETTEXT_APPLIED_VERSION_MAJOR"; then
663        have_required_xgettext="yes"
664    elif test "$XGETTEXT_REQUIRED_VERSION_MAJOR" -eq "$XGETTEXT_APPLIED_VERSION_MAJOR"; then
665        if test -n "$XGETTEXT_APPLIED_VERSION_MINOR_1"; then
666            if test "$XGETTEXT_REQUIRED_VERSION_MINOR_1" -le "$XGETTEXT_APPLIED_VERSION_MINOR_1"; then
667                have_required_xgettext="yes"
668            fi
669        fi
670    fi
671fi
672AC_MSG_RESULT($have_required_xgettext)
673
674if test "x$have_required_xgettext" = "xno"; then
675    add_deps_error([xgettext], [xgettext >= xgettext_required_version])
676fi
677
678###########
679# iso-codes
680###########
681
682AC_MSG_CHECKING([for iso-codes])
683PKG_CHECK_EXISTS(iso-codes,
684  have_iso_codes="yes"
685  AC_DEFINE(HAVE_ISO_CODES, 1,
686  	    [Define to 1 if the iso-codes package is available])
687  ISO_CODES_PREFIX=`$PKG_CONFIG --variable=prefix iso-codes`
688  ISO_CODES_LOCATION="$ISO_CODES_PREFIX/share/xml/iso-codes"
689  ISO_CODES_LOCALEDIR="$ISO_CODES_PREFIX/$DATADIRNAME/locale",
690  have_iso_codes="no (iso-codes package not found)")
691AC_MSG_RESULT($have_iso_codes)
692
693AC_SUBST(ISO_CODES_LOCATION)
694AC_SUBST(ISO_CODES_LOCALEDIR)
695
696
697###############################
698# Checks for required libraries
699###############################
700
701PKG_CHECK_MODULES(BABL, [babl >= babl_required_version],,
702                  [add_deps_error([babl >= babl_required_version])])
703PKG_CHECK_MODULES(GEGL, gegl-gegl_major_minor_version >= gegl_required_version,,
704                  [add_deps_error([gegl-gegl_major_minor_version >= gegl_required_version])])
705PKG_CHECK_MODULES(ATK, atk >= atk_required_version,,
706                  [add_deps_error([atk >= atk_required_version])])
707
708AM_PATH_GLIB_2_0(glib_required_version,,
709                 [add_deps_error([glib >= glib_required_version],
710                                 [Test for GLIB failed])],
711                 gobject)
712
713PKG_CHECK_MODULES(GMODULE_NO_EXPORT, gmodule-no-export-2.0,,
714                  [add_deps_error([gmodule-no-export-2.0])])
715
716PKG_CHECK_MODULES(GIO, gio-2.0,,
717                  [add_deps_error([gio-2.0])])
718
719if test "x$os_win32" = "xyes"; then
720  PKG_CHECK_MODULES(GIO_WINDOWS, gio-windows-2.0,,
721                    [add_deps_error([gio-windows-2.0])])
722else
723  PKG_CHECK_MODULES(GIO_UNIX, gio-unix-2.0,,
724                    [add_deps_error([gio-unix-2.0])])
725fi
726
727AC_MSG_CHECKING([for glib-networking (GIO TLS implementation)])
728gimp_save_CFLAGS="$CFLAGS"
729gimp_save_LIBS="$LIBS"
730CFLAGS="$CFLAGS $GIO_CFLAGS"
731LIBS="$LIBS $GIO_LIBS"
732AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <gio/gio.h>],
733                               [return !g_tls_backend_supports_tls (g_tls_backend_get_default ());])],
734              [have_glib_networking="yes"],
735              [have_glib_networking="no"],
736              [have_glib_networking="unknown (cross-compiling)"])
737CFLAGS="$gimp_save_CFLAGS"
738LIBS="$gimp_save_LIBS"
739AC_MSG_RESULT($have_glib_networking)
740
741if test "x$have_glib_networking" = "xno"; then
742  add_deps_error([glib-networking],
743      [Test for glib-networking failed. This is required.])
744elif test "x$have_glib_networking" != "xyes"; then
745  warning_glib_networking="
746WARNING: Test for glib-networking cannot be performed while cross-compiling.
747         Make sure glib-networking is installed, otherwise GIMP will not be able
748         to display the remote help pages through the help browser, nor will it
749         be able to open remote HTTPS (or other protocol using SSL/TLS) files.
750         HTTPS is becoming the expected standard and should not be considered
751         optional anymore."
752fi
753
754# AM_PATH_GLIB_2_0 already fills in the variable GLIB_COMPILE_RESOURCES.
755# Unfortunately it looks it up using $PKG_CONFIG, which search in
756# target-installed libraries, hence it would return a tool for the
757# target architecture in case of cross-compilation (which can't be run
758# during build, unless there is some compatibility layer in the OS).
759# Therefore we make our own check.
760AC_MSG_CHECKING([for native glib-compile-resources])
761if test -z "$HOST_GLIB_COMPILE_RESOURCES"; then
762  # Do not use $PKG_CONFIG as it will search target files.
763  HOST_GLIB_COMPILE_RESOURCES=`pkg-config --variable=glib_compile_resources gio-2.0`
764  if test -z "$HOST_GLIB_COMPILE_RESOURCES"; then
765    # As fallback, search in path.
766    AC_PATH_PROG(HOST_GLIB_COMPILE_RESOURCES, glib-compile-resources, no)
767    if test "x$HOST_GLIB_COMPILE_RESOURCES" = xno; then
768      add_deps_error([glib-compile-resources],
769                     [Could not find glib-compile-resources in your PATH.])
770    fi
771  fi
772fi
773AC_MSG_RESULT($HOST_GLIB_COMPILE_RESOURCES)
774AC_SUBST(HOST_GLIB_COMPILE_RESOURCES)
775
776AC_PATH_PROG(GDBUS_CODEGEN, gdbus-codegen, no)
777if test "x$GDBUS_CODEGEN" = xno; then
778  add_deps_error([gdbus-codegen], [Could not find gdbus-codegen in your PATH.])
779fi
780
781AC_MSG_CHECKING([if GLib is version 2.57.0 or newer])
782if $PKG_CONFIG --atleast-version=2.57.0 glib-2.0; then
783  have_glib_2_57=yes
784else
785  have_glib_2_57=no
786fi
787AC_MSG_RESULT($have_glib_2_57)
788
789AC_PATH_PROG(GEGL, gegl, no)
790if test "x$GEGL" = xno; then
791  add_deps_error([gegl], [Could not find native gegl executable in your PATH.])
792fi
793
794
795# Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
796gimp_save_LIBS=$LIBS
797LIBS="$LIBS $GLIB_LIBS"
798AC_CHECK_FUNCS(bind_textdomain_codeset,,
799  add_deps_error([bind_textdomain_codeset()],
800                 [Check for bind_textdomain_codeset() failed! This is required.]))
801LIBS=$gimp_save_LIBS
802
803
804AC_PATH_XTRA
805
806AM_PATH_GTK_2_0(gtk_required_version, :,
807  add_deps_error([gtk+-2.0 >= gtk_required_version],
808                 [Test for GTK+ failed.]))
809
810AC_PATH_PROG(GTK_UPDATE_ICON_CACHE, gtk-update-icon-cache, no)
811if test "x$GTK_UPDATE_ICON_CACHE" = xno; then
812  add_deps_error([gtk-update-icon-cache],
813                 [Could not find gtk-update-icon-cache in your PATH.])
814fi
815
816# GTK+ 2.26.0 will never be released, we keep the check around anyway
817# because we will need it again after the switch to GTK+ 3.x
818AC_MSG_CHECKING([if GTK+ is version 2.26.0 or newer (bogus placeholder check)])
819if $PKG_CONFIG --atleast-version=2.26.0 gtk+-2.0; then
820  have_gtk_2_26=yes
821else
822  have_gtk_2_26=no
823fi
824AC_MSG_RESULT($have_gtk_2_26)
825
826PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0 >= gdk_pixbuf_required_version,,
827                  [add_deps_error([gdk-pixbuf-2.0 >= gdk_pixbuf_required_version])])
828
829AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
830if test "x$GDK_PIXBUF_CSOURCE" = xno; then
831  add_deps_error([gdk-pixbuf-csource],
832                 [Could not find gdk-pixbuf-csource in your PATH.])
833fi
834
835PKG_CHECK_MODULES(CAIRO, cairo >= cairo_required_version,,
836                  [add_deps_error([cairo >= cairo_required_version])])
837
838PKG_CHECK_MODULES(PANGOCAIRO,
839                  [pangocairo >= pangocairo_required_version pangoft2], :,
840                  [add_deps_error([pangocairo >= pangocairo_required_version and pangoft2],
841                                  [We require Pango with the optional support for Cairo compiled in.])])
842
843gimp_save_CFLAGS=$CFLAGS
844CFLAGS="$PANGOCAIRO_CFLAGS $CFLAGS"
845
846# Windows platform had a few bugs fixed in earlier fontconfig.
847# The bugs are serious enough (for instance very slow startups at each
848# GIMP start, but also slowness when closing, broken font features,
849# etc.) that we should bump the requirement for Win32.
850# See bugs 708110 (fontconfig 2.11.0), 703331 (2.11.1) and 782676
851# (2.12.4).
852PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= fontconfig_required_version,,
853                  [add_deps_error([fontconfig >= fontconfig_required_version])])
854
855AC_MSG_CHECKING([if Pango is version 1.32.0 or newer])
856if $PKG_CONFIG --atleast-version=1.32.0 pango; then
857  have_pango_1_32=yes
858else
859  have_pango_1_32=no
860fi
861AC_MSG_RESULT($have_pango_1_32)
862
863CFLAGS="$PANGOCAIRO_CFLAGS $CFLAGS"
864
865AC_MSG_CHECKING([if Pango is built with a recent fontconfig])
866AC_COMPILE_IFELSE(
867  [AC_LANG_PROGRAM(
868    [[#include <fontconfig/fontconfig.h>]],
869    [[FcObjectSet *os; os = FcObjectSetBuild (FC_FAMILY, FC_WIDTH);]])],
870  [fontconfig_ok=yes],
871  [fontconfig_ok=no])
872AC_MSG_RESULT($fontconfig_ok)
873
874CFLAGS=$gimp_save_CFLAGS
875
876if test "x$fontconfig_ok" = xno; then
877  AC_MSG_ERROR([
878*** You have a fontconfig >= fontconfig_required_version installed on your system, but your
879*** Pango library is using an older version. This old version is probably in
880*** /usr/X11R6. Look at the above output, and note that the result for
881*** FONTCONFIG_CFLAGS is not in the result for PANGOCAIRO_CFLAGS, and that
882*** there is likely an extra -I line, other than the ones for GLIB,
883*** Freetype, and Pango itself. That's where your old fontconfig files are.
884*** Rebuild pango, and make sure that it uses the newer fontconfig. The
885*** easiest way be sure of this is to simply get rid of the old fontconfig.
886*** When you rebuild pango, make sure the result for FONTCONFIG_CFLAGS is
887*** the same as the result here.])
888fi
889
890
891PKG_CHECK_MODULES(FREETYPE, freetype2 >= freetype2_required_version,,
892                  [add_deps_error([freetype2_required_version >= freetype2_required_version])])
893
894PKG_CHECK_MODULES(HARFBUZZ, harfbuzz >= harfbuzz_required_version,,
895                 [add_deps_error([harfbuzz >= harfbuzz_required_version])])
896
897PKG_CHECK_MODULES(GEXIV2, gexiv2 >= gexiv2_required_version,,
898                 [add_deps_error([gexiv2 >= gexiv2_required_version])])
899
900#################################
901# Check for debug console (Win32)
902#################################
903
904AC_ARG_ENABLE(win32-debug-console,
905              [  --enable-win32-debug-console
906                          open a console when starting the program
907                          (default=auto)],,
908              enable_win32_debug_console=auto)
909
910AC_MSG_CHECKING([if GIMP should open a debug console at start])
911if test "x$platform_win32" != "xyes"; then
912   enable_win32_debug_console=no
913elif test "x$enable_win32_debug_console" != xno &&
914     test "x$enable_win32_debug_console" != xyes; then
915  # By default, we enable the debug console only for unstable builds.
916   enable_win32_debug_console=gimp_unstable
917fi
918
919if test "x$enable_win32_debug_console" = "xyes"; then
920  AC_DEFINE(ENABLE_WIN32_DEBUG_CONSOLE, 1,
921            [Define to 1 if GIMP should open a debug console at start])
922fi
923AC_MSG_RESULT([$enable_win32_debug_console])
924
925######################################
926# Check for 32-bit DLLs (Win32 64-bit)
927######################################
928
929AC_ARG_WITH(win32-32bit-dll-folder,
930            [  --with-win32-32bit-dll-folder[=DIR]
931                          alternative folder with 32-bit versions of DLL libraries on Windows (default: 32/bin/)],,
932            with_win32_32bit_dll_folder="32/bin")
933
934AC_MSG_CHECKING([the alternative folder containing 32-bit DLLs on Windows])
935if test "x$platform_win32" = "xyes"; then
936  case "$host_cpu" in
937    x86_64)
938    ;;
939    *)
940    with_win32_32bit_dll_folder="no"
941    ;;
942  esac
943else
944    with_win32_32bit_dll_folder="no"
945fi
946
947if test "x$with_win32_32bit_dll_folder" != "xno"; then
948  AC_DEFINE_UNQUOTED(WIN32_32BIT_DLL_FOLDER, "$with_win32_32bit_dll_folder",
949                     [Define if 32-bit versions of libraries are packaged in an alternative folder])
950fi
951AC_MSG_RESULT([$with_win32_32bit_dll_folder])
952
953#####################
954# Check for Dr. Mingw
955#####################
956
957enable_drmingw="no"
958if test "x$platform_win32" = "xyes"; then
959   # Check for Dr. Mingw
960   AC_CHECK_LIB(exchndl, ExcHndlSetLogFileNameA,
961                [
962                 AC_DEFINE(HAVE_EXCHNDL, 1, [Define to 1 when Dr. MingW is available])
963                 LIBS="-lexchndl $LIBS"
964                 enable_drmingw="yes"
965                ],
966                [enable_drmingw="no (ExcHndl library missing)"]
967               )
968fi
969AM_CONDITIONAL(HAVE_EXCHNDL, test "x$ac_cv_lib_exchndl_ExcHndlSetLogFileNameA" = "xyes")
970
971###########################
972# Check for backtrace() API
973###########################
974
975AC_CHECK_HEADERS([execinfo.h])
976
977#########################
978# Check for Matting Levin
979#########################
980
981AC_MSG_CHECKING([for matting engine Levin])
982if $GEGL --exists "gegl:matting-levin"; then
983  have_matting_levin=yes
984else
985  have_matting_levin='no (missing GEGL operation "gegl:matting-levin")'
986fi
987AC_MSG_RESULT($have_matting_levin)
988
989##########################################
990# Check for some special functions we need
991##########################################
992
993AC_CHECK_HEADERS(math.h ieeefp.h)
994
995# DU4 native cc currently needs -std1 for ANSI mode (instead of K&R)
996AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
997gimp_save_LIBS=$LIBS
998LIBS="$LIBS -lm"
999AC_RUN_IFELSE(
1000  [AC_LANG_SOURCE([[
1001    #include <math.h>
1002    int main (void) { return (log(1) != log(1.)); }]])],
1003  [AC_MSG_RESULT(none needed)],
1004  [gimp_save_CFLAGS=$CFLAGS
1005   CFLAGS="$CFLAGS -std1"
1006   AC_RUN_IFELSE(
1007     [AC_LANG_SOURCE([[
1008       #include <math.h>
1009       int main (void) { return (log(1) != log(1.)); }]])],
1010     [AC_MSG_RESULT(-std1)],
1011     [AC_MSG_RESULT()
1012      CFLAGS=$gimp_save_CFLAGS
1013      AC_MSG_WARN([No ANSI prototypes found in library. (-std1 didn't work.)])],
1014     [AC_MSG_RESULT])],
1015  [AC_MSG_RESULT()])
1016
1017# Check for finite
1018AC_CHECK_FUNCS(finite, , [
1019  AC_MSG_CHECKING(for finite in <math.h>)
1020  AC_LINK_IFELSE(
1021    [AC_LANG_PROGRAM(
1022      [[#include <math.h>]],
1023      [[double f = 0.0; finite (f)]])],
1024    [AC_DEFINE(HAVE_FINITE, 1)
1025     AC_MSG_RESULT(yes)],
1026    [AC_MSG_RESULT(no)])
1027  ]
1028)
1029
1030# Check for isfinite
1031AC_CHECK_FUNCS(isfinite, , [
1032  AC_MSG_CHECKING(for isfinite in <math.h>)
1033  AC_LINK_IFELSE(
1034    [AC_LANG_PROGRAM(
1035      [[#include <math.h>]],
1036      [[double f = 0.0; isfinite (f)]])],
1037    [AC_DEFINE(HAVE_ISFINITE, 1)
1038     AC_MSG_RESULT(yes)],
1039    [AC_MSG_RESULT(no)])
1040  ]
1041)
1042
1043AC_SUBST(HAVE_FINITE)
1044AC_SUBST(HAVE_ISFINITE)
1045
1046LIBS=$gimp_save_LIBS
1047
1048
1049# check for rint
1050AC_CHECK_FUNC(rint, AC_DEFINE(HAVE_RINT, 1,
1051                              [Define to 1 if you have the rint function.]), [
1052  AC_CHECK_LIB(m, rint, [
1053    AC_DEFINE(HAVE_RINT)])])
1054
1055
1056# check for vfork
1057AC_CHECK_FUNCS(vfork, ,)
1058AC_SUBST(HAVE_VFORK)
1059
1060
1061##############################
1062# Check for attributes we need
1063##############################
1064
1065AX_GCC_FUNC_ATTRIBUTE(destructor)
1066
1067#####################################################################
1068# Check for extra libs needed for getaddrinfo, getnameinfo and socket
1069#####################################################################
1070
1071gimp_save_LIBS=$LIBS
1072LIBS=""
1073
1074AC_CHECK_FUNCS(getaddrinfo, , AC_CHECK_LIB(nsl, getaddrinfo))
1075AC_CHECK_FUNCS(getnameinfo, , AC_CHECK_LIB(nsl, getnameinfo))
1076AC_CHECK_LIB(socket, socket)
1077
1078SOCKET_LIBS="$LIBS"
1079LIBS=$gimp_save_LIBS
1080
1081AC_SUBST(SOCKET_LIBS)
1082
1083###################################
1084# Check for Intel vector intrinsics
1085###################################
1086intrinsics_save_CFLAGS="$CFLAGS"
1087#FIXME: Check the CFLAGS separately
1088GIMP_DETECT_CFLAGS(SSE_MATH_CFLAG, '-mfpmath=sse')
1089GIMP_DETECT_CFLAGS(SSE2_CFLAG, '-msse2')
1090SSE2_EXTRA_CFLAGS="$SSE_MATH_CFLAG $SSE2_CFLAG"
1091CFLAGS="$SSE2_EXTRA_CFLAGS $intrinsics_save_CFLAGS"
1092
1093AC_MSG_CHECKING(whether we can compile SSE2 intrinsics)
1094AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <emmintrin.h>]],[[__m128i one = _mm_set1_epi32 (1);]])],
1095  AC_DEFINE(COMPILE_SSE2_INTRINISICS, 1, [Define to 1 if SSE2 intrinsics are available.])
1096  AC_SUBST(SSE2_EXTRA_CFLAGS)
1097  AC_MSG_RESULT(yes)
1098,
1099  AC_MSG_RESULT(no)
1100  AC_MSG_WARN([SSE2 intrinsics not available.])
1101)
1102
1103
1104GIMP_DETECT_CFLAGS(SSE4_1_CFLAG, '-msse4.1')
1105SSE4_1_EXTRA_CFLAGS="$SSE_MATH_CFLAG $SSE4_1_CFLAG"
1106CFLAGS="$SSE4_1_EXTRA_CFLAGS $intrinsics_save_CFLAGS"
1107
1108AC_MSG_CHECKING(whether we can compile SSE4.1 intrinsics)
1109AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <smmintrin.h>]],[[__v4sf a, b, c; c = _mm_blend_ps(a, b, 0x08);]])],
1110  AC_DEFINE(COMPILE_SSE4_1_INTRINISICS, 1, [Define to 1 if SSE4.1 intrinsics are available.])
1111  AC_SUBST(SSE4_1_EXTRA_CFLAGS)
1112  AC_MSG_RESULT(yes)
1113,
1114  AC_MSG_RESULT(no)
1115  AC_MSG_WARN([SSE4.1 intrinsics not available.])
1116)
1117CFLAGS="$intrinsics_save_CFLAGS"
1118
1119
1120########################
1121# Check for MMX assembly
1122########################
1123
1124AC_ARG_ENABLE(mmx,
1125  [  --enable-mmx            enable MMX support (default=auto)],,
1126  enable_mmx=$have_x86)
1127
1128AC_ARG_ENABLE(sse,
1129  [  --enable-sse            enable SSE support (default=auto)],,
1130  enable_sse=$enable_mmx)
1131
1132if test "x$enable_mmx" = xyes; then
1133  GIMP_DETECT_CFLAGS(MMX_EXTRA_CFLAGS, '-mmmx')
1134  SSE_EXTRA_CFLAGS=
1135
1136  AC_MSG_CHECKING(whether we can compile MMX code)
1137
1138  mmx_save_CFLAGS="$CFLAGS"
1139  CFLAGS="$mmx_save_CFLAGS $MMX_EXTRA_CFLAGS"
1140
1141  AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[asm ("movq 0, %mm0");]])],
1142
1143    AC_DEFINE(USE_MMX, 1, [Define to 1 if MMX assembly is available.])
1144    AC_MSG_RESULT(yes)
1145
1146    if test "x$enable_sse" = xyes; then
1147      GIMP_DETECT_CFLAGS(sse_flag, '-msse')
1148      SSE_EXTRA_CFLAGS="$MMX_EXTRA_CFLAGS $sse_flag"
1149
1150      AC_MSG_CHECKING(whether we can compile SSE code)
1151
1152      CFLAGS="$CFLAGS $sse_flag"
1153
1154      AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[asm ("movntps %xmm0, 0");]])],
1155        AC_DEFINE(USE_SSE, 1, [Define to 1 if SSE assembly is available.])
1156        AC_MSG_RESULT(yes)
1157      ,
1158        enable_sse=no
1159        AC_MSG_RESULT(no)
1160        AC_MSG_WARN([The assembler does not support the SSE command set.])
1161      )
1162
1163    fi
1164  ,
1165    enable_mmx=no
1166    AC_MSG_RESULT(no)
1167    AC_MSG_WARN([The assembler does not support the MMX command set.])
1168  )
1169
1170  CFLAGS="$mmx_save_CFLAGS"
1171
1172  AC_SUBST(MMX_EXTRA_CFLAGS)
1173  AC_SUBST(SSE_EXTRA_CFLAGS)
1174fi
1175
1176
1177############################
1178# Check for AltiVec assembly
1179############################
1180
1181AC_ARG_ENABLE(altivec,
1182  [  --enable-altivec        enable AltiVec support (default=auto)],,
1183  enable_altivec=$have_ppc)
1184
1185if test "x$enable_altivec" = xyes; then
1186
1187  GIMP_DETECT_CFLAGS(altivec_flag, '-faltivec' '-maltivec -mabi=altivec')
1188
1189  ALTIVEC_EXTRA_CFLAGS=
1190  case "$altivec_flag" in
1191    -maltivec*)
1192      altivec_save_CPPFLAGS="$CPPFLAGS"
1193      CPPFLAGS="$altivec_save_CPPFLAGS $altivec_flag"
1194      AC_CHECK_HEADERS(altivec.h, [ALTIVEC_EXTRA_CFLAGS="$altivec_flag"])
1195      CPPFLAGS="$altivec_save_CPPFLAGS"
1196      ;;
1197    *)
1198      ALTIVEC_EXTRA_CFLAGS="$altivec_flag"
1199      ;;
1200  esac
1201  AC_SUBST(ALTIVEC_EXTRA_CFLAGS)
1202
1203  AC_MSG_CHECKING(whether we can compile AltiVec code)
1204
1205  can_use_altivec=no
1206  if test -z "$ALTIVEC_EXTRA_CFLAGS"; then
1207    AC_MSG_RESULT(no)
1208    AC_MSG_WARN([The compiler does not support the AltiVec command set.])
1209  else
1210    case "$host_os" in
1211      darwin*)
1212        can_use_altivec=yes
1213        AC_DEFINE(HAVE_ALTIVEC_SYSCTL, 1,
1214         [Define to 1 if the altivec runtime test should use a sysctl.])
1215        ;;
1216      *)
1217        AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[asm ("vand %v0, %v0, %v0");]])],
1218          can_use_altivec=yes, can_use_altivec=no)
1219        ;;
1220    esac
1221    AC_MSG_RESULT($can_use_altivec)
1222
1223    if test "x$can_use_altivec" = "xyes"; then
1224      AC_DEFINE(USE_ALTIVEC, 1, [Define to 1 if AltiVec support is available.])
1225    else
1226      enable_altivec=no
1227      AC_MSG_WARN([The assembler does not support the AltiVec command set.])
1228    fi
1229  fi
1230
1231  enable_altivec="$can_use_altivec"
1232fi
1233
1234
1235###################################
1236# Checks for shared memory handling
1237###################################
1238
1239# MacOS X has broken SysV shm
1240case "$host_os" in
1241  darwin* | rhapsody* | machten*)
1242    shmdefault=posix
1243    ;;
1244  *)
1245    shmdefault=sysv
1246    ;;
1247esac
1248
1249shmtype=auto
1250AC_ARG_WITH(shm, [  --with-shm=none|sysv|posix|auto    shared memory transport type (default=auto)], shmtype=$with_shm)
1251
1252case $shmtype in
1253  none|sysv|posix) ;;
1254  auto) shmtype=$shmdefault ;;
1255  *) AC_MSG_ERROR([Invalid shared memory transport type: use none, sysv, posix, or auto.]);;
1256esac
1257
1258
1259if test "x$platform_win32" = "xyes"; then
1260  shmtype=win32
1261elif test "x$shmtype" = "xsysv"; then
1262  AC_CHECK_HEADER(sys/ipc.h,
1263    [AC_DEFINE(HAVE_IPC_H, 1,
1264               [Define to 1 if you have the <sys/ipc.h> header file.])],
1265    no_sys_ipc=yes)
1266  AC_CHECK_HEADER(sys/shm.h,
1267    [AC_DEFINE(HAVE_SHM_H, 1,
1268               [Define to 1 if you have the <sys/shm.h> header file.])],
1269    no_sys_shm=yes)
1270
1271  if test "$ac_cv_header_sys_shm_h" = "yes"; then
1272    AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
1273    AC_RUN_IFELSE(
1274      [AC_LANG_SOURCE([[
1275	#include <sys/types.h>
1276	#include <sys/ipc.h>
1277	#include <sys/shm.h>
1278	int main()
1279	{
1280	  int id;
1281	  char *shmaddr;
1282	id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0600);
1283	if (id == -1)
1284	  exit (2);
1285	  shmaddr = shmat (id, 0, 0);
1286	  shmctl (id, IPC_RMID, 0);
1287	  if ((char*) shmat (id, 0, 0) == (char*) -1)
1288	  {
1289	    shmdt (shmaddr);
1290	    exit (1);
1291	  }
1292	  shmdt (shmaddr);
1293	  shmdt (shmaddr);
1294	  exit (0);
1295	}
1296      ]])],
1297      [AC_DEFINE([IPC_RMID_DEFERRED_RELEASE],[1],
1298                 [Define to 1 if shared memory segments are released deferred.])
1299       AC_MSG_RESULT(yes)],
1300      [AC_MSG_RESULT(no)],
1301      [AC_MSG_RESULT(assuming no)])
1302
1303    AC_DEFINE(USE_SYSV_SHM, 1, [Define to 1 to use SYSV shared memory])
1304  else
1305    shmtype=none
1306  fi
1307elif test "x$shmtype" = "xposix"; then
1308  have_shm_open=no
1309
1310  AC_CHECK_FUNC(shm_open, have_shm_open=yes)
1311
1312  RT_LIBS=
1313  if test "$have_shm_open" != "yes"; then
1314    AC_CHECK_LIB(rt, shm_open, RT_LIBS="-lrt" have_shm_open=yes)
1315  fi
1316  AC_SUBST(RT_LIBS)
1317
1318  AC_CHECK_HEADER(sys/mman.h,
1319    [AC_DEFINE(HAVE_MMAN_H, 1,
1320               [Define to 1 if you have the <sys/mman.h> header file.])],
1321    no_sys_mman=yes)
1322
1323  if test "$ac_cv_func_mmap" = "yes" &&
1324     test "$ac_cv_header_sys_mman_h" = "yes" &&
1325     test "$have_shm_open" = "yes"; then
1326    AC_DEFINE(USE_POSIX_SHM, 1, [Define to 1 to use POSIX shared memory])
1327  else
1328    shmtype=none
1329  fi
1330fi
1331
1332AC_MSG_CHECKING(for shared memory transport type)
1333AC_MSG_RESULT($shmtype)
1334
1335
1336########################
1337# Define a symbol prefix
1338########################
1339
1340AC_MSG_CHECKING([whether symbols are prefixed])
1341
1342case "$host_os" in
1343  mingw*)
1344    case "$host_cpu" in
1345	  x86_64) SYMPREFIX='' ;;
1346	  *) SYMPREFIX='_' ;;
1347	esac
1348    ;;
1349  darwin* | rhapsody* | machten*)
1350    SYMPREFIX='_'
1351    ;;
1352  *)
1353    ;;
1354esac
1355
1356if test -n "$SYMPREFIX"; then
1357  AC_MSG_RESULT([yes, with a $SYMPREFIX])
1358else
1359  AC_MSG_RESULT(no)
1360fi
1361
1362AC_SUBST(SYMPREFIX)
1363
1364
1365############################
1366# Check for select and fdset
1367############################
1368
1369if test "x$os_win32" != xyes; then
1370  AC_MSG_CHECKING([fd_set and sys/select])
1371  AC_COMPILE_IFELSE(
1372    [AC_LANG_PROGRAM(
1373      [[#include <sys/types.h>]],
1374      [[fd_set readMask, writeMask;]])],
1375    [gimp_ok=yes],
1376    [gimp_ok=no])
1377  if test "x$gimp_ok" = xno; then
1378      AC_EGREP_HEADER(fd_mask, sys/select.h, gimp_ok=yes)
1379      if test "x$gimp_ok" = xyes; then
1380	  AC_DEFINE(HAVE_SYS_SELECT_H, 1,
1381		    [Define to 1 if you have the <sys/select.h> header.])
1382      fi
1383  fi
1384  AC_MSG_RESULT($gimp_ok)
1385  if test "x$gimp_ok" = xno; then
1386      AC_DEFINE(NO_FD_SET, 1,
1387		[Define to 1 if you don't have the fd_set typedef.])
1388  fi
1389fi
1390
1391
1392#############################
1393# Threads and multi processor
1394#############################
1395
1396AC_ARG_ENABLE(mp, [  --disable-mp            disable support for multiple processors])
1397
1398if test "x$enable_mp" != "xno"; then
1399  AC_DEFINE(ENABLE_MP, 1,
1400	    [Define to 1 to enable support for multiple processors.])
1401fi
1402
1403
1404################################
1405# Some plug-ins are X11 specific
1406################################
1407
1408# Check if building for GTK+-X11
1409gdk_target=`$PKG_CONFIG --variable=target gtk+-2.0`
1410
1411have_libxmu="no (building for $gdk_target)"
1412
1413if test "$gdk_target" = x11; then
1414
1415   # doc-shooter is X11 specific
1416   DOC_SHOOTER=doc-shooter
1417
1418   # screenshot plug-in needs to link to X11 explicitly
1419   SCREENSHOT_LIBS="$X_LIBS -lX11"
1420
1421   gimp_save_CFLAGS="$CFLAGS"
1422   gimp_save_LDFLAGS="$LDFLAGS"
1423   CFLAGS="$CFLAGS $GTK_CFLAGS"
1424   LDFLAGS="$LDFLAGS $X_LIBS"
1425
1426   # Test for Xmu
1427   if test -z "$XMU_LIBS"; then
1428      AC_CHECK_LIB(Xmu, XmuClientWindow,
1429        [AC_CHECK_HEADERS(X11/Xmu/WinUtil.h,
1430	  have_libxmu=yes
1431          XMU_LIBS="$X_LIBS $X_PRE_LIBS -lX11 -lXmu -lXt"
1432          SCREENSHOT_LIBS="$XMU_LIBS",
1433	  [have_libxmu="no (XMU header file not found)"],[#include <gdk/gdkx.h>])],
1434	[have_libxmu="no (XMU library not found)"], -lXt -lX11)
1435   fi
1436
1437   # Check for shaped window extension
1438   AC_CHECK_LIB(Xext, XShapeGetRectangles,
1439     [AC_CHECK_HEADERS(X11/extensions/shape.h,
1440        SCREENSHOT_LIBS="$SCREENSHOT_LIBS -lXext",,[#include <gdk/gdkx.h>])],,
1441     -lX11 -lXext)
1442
1443   CFLAGS="$gimp_save_CFLAGS"
1444   LDFLAGS="$gimp_save_LDFLAGS"
1445
1446   # check for the XFixes extension
1447   PKG_CHECK_MODULES(XFIXES, xfixes,
1448      AC_DEFINE(HAVE_XFIXES, 1,
1449                [Define to 1 to if the XFIXES X extension is available])
1450      SCREENSHOT_LIBS="$SCREENSHOT_LIBS $XFIXES_LIBS",
1451      true)
1452fi
1453
1454AC_SUBST(XMU_LIBS)
1455AC_SUBST(SCREENSHOT_LIBS)
1456
1457AC_SUBST(DOC_SHOOTER)
1458
1459
1460GIMP_COMMAND='gimp-gimp_app_version'
1461
1462AC_SUBST(GIMP_COMMAND)
1463
1464
1465############
1466# MIME types
1467############
1468
1469# The list of MIME types that are supported by plug-ins that are compiled
1470# unconditionally:
1471MIME_TYPES="image/bmp;image/g3fax;image/gif;image/x-fits;image/x-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;image/x-gimp-gbr;image/x-gimp-pat;image/x-gimp-gih;image/x-sun-raster"
1472
1473#################
1474# Bundle packages
1475#################
1476
1477AC_MSG_CHECKING([whether we build a relocatable package])
1478AC_ARG_ENABLE(relocatable-bundle,
1479              [  --enable-relocatable-bundle
1480                          build with resources considered bundled under the same prefix
1481                          (default=auto)],,
1482              enable_relocatable_bundle=auto)
1483
1484if test "x$enable_relocatable_bundle" != xno &&
1485   test "x$enable_relocatable_bundle" != xyes; then
1486  # By default, assume building for Windows or macOS everything to be on
1487  # the same prefix and can be relocated.
1488  # On other platforms, build-time paths are meaningful.
1489  if test "x$platform_osx" = "xyes" ||
1490     test "x$platform_win32" = "xyes"; then
1491     enable_relocatable_bundle=yes
1492  else
1493     enable_relocatable_bundle=no
1494  fi
1495fi
1496if test "x$enable_relocatable_bundle" = xyes; then
1497  AC_DEFINE(ENABLE_RELOCATABLE_RESOURCES, 1,
1498            [Define to 1 if resources are considered bundled under the same prefix])
1499fi
1500AM_CONDITIONAL(ENABLE_RELOCATABLE_RESOURCES, test x$enable_relocatable_bundle = xyes)
1501
1502AC_MSG_RESULT([$enable_relocatable_bundle])
1503
1504###################
1505# Check for libtiff
1506###################
1507
1508libtiff_error=
1509if test -z "$TIFF_LIBS"; then
1510  AC_CHECK_LIB(tiff, TIFFReadScanline,
1511    [AC_CHECK_HEADER(tiffio.h,
1512      FILE_TIFF_LOAD='file-tiff-load$(EXEEXT)'; FILE_TIFF_SAVE='file-tiff-save$(EXEEXT)'; TIFF_LIBS='-ltiff',
1513      [libtiff_error="TIFF header files not found"])],
1514    [AC_CHECK_LIB(tiff, TIFFWriteScanline,
1515      [AC_CHECK_HEADER(tiffio.h,
1516        FILE_TIFF_LOAD='file-tiff-load$(EXEEXT)'; FILE_TIFF_SAVE='file-tiff-save$(EXEEXT)'; TIFF_LIBS='-ltiff -ljpeg -lz',
1517	[libtiff_error="TIFF header files not found"])],
1518      [AC_CHECK_LIB(tiff34, TIFFFlushData,
1519	[AC_CHECK_HEADER(tiffio.h,
1520          FILE_TIFF_LOAD='file-tiff-load$(EXEEXT)'; FILE_TIFF_SAVE='file-tiff-save$(EXEEXT)'; TIFF_LIBS='-ltiff34 -ljpeg -lz',
1521	  [libtiff_error="TIFF header files not found"])],
1522      [libtiff_error="TIFF library not found"], -ljpeg -lz -lm)], -ljpeg -lz -lm)], -lm)
1523fi
1524
1525if test -z "$TIFF_LIBS"; then
1526  add_deps_error([libtiff], [Checks for TIFF library failed: $libtiff_error])
1527fi
1528
1529MIME_TYPES="$MIME_TYPES;image/tiff"
1530
1531AC_SUBST(TIFF_LIBS)
1532
1533
1534###################
1535# Check for libjpeg
1536###################
1537
1538if test -z "$JPEG_LIBS"; then
1539  AC_CHECK_LIB(jpeg, jpeg_destroy_decompress, ,
1540    add_deps_error([libjpeg], [JPEG library not found]))
1541  AC_MSG_CHECKING([for jpeglib.h])
1542  AC_PREPROC_IFELSE(
1543    [AC_LANG_SOURCE([[
1544#include <stdio.h>
1545#undef HAVE_STDDEF_H
1546#undef HAVE_STDLIB_H
1547#undef PACKAGE
1548#undef VERSION
1549#include <jpeglib.h>]])],
1550    AC_MSG_RESULT([yes]),
1551    add_deps_error([libjpeg], [JPEG header file not found]))
1552  AC_CHECK_LIB(jpeg, jpeg_save_markers,
1553    JPEG_LIBS='-ljpeg',
1554    add_deps_error([libjpeg], [JPEG library is too old]))
1555fi
1556
1557MIME_TYPES="$MIME_TYPES;image/jpeg"
1558
1559AC_SUBST(JPEG_LIBS)
1560
1561
1562################
1563# Check for libz
1564################
1565
1566if test -z "$Z_LIBS"; then
1567  AC_CHECK_LIB(z, gzsetparams,
1568    [AC_CHECK_HEADER(zlib.h,
1569      Z_LIBS='-lz',
1570      add_deps_error([zlib], [ZLIB header files not found]))],
1571    add_deps_error([zlib], [ZLIB library not found]))
1572fi
1573
1574MIME_TYPES="$MIME_TYPES;image/x-psp"
1575
1576AC_SUBST(Z_LIBS)
1577
1578
1579####################
1580# Check for libbzip2
1581####################
1582
1583gimp_save_LIBS=$LIBS
1584LIBS="$LIBS -lbz2"
1585
1586if test -z "$BZIP2_LIBS"; then
1587  # We used to use AC_CHECK_LIB, but bz2 uses the WINAPI calling convention on
1588  # windows, so the test needs to #include <bzlib.h> to be able to link properly
1589  AC_CHECK_HEADER(bzlib.h,
1590    [AC_MSG_CHECKING([for BZ2_bzCompress in -lbz2]);
1591    AC_LINK_IFELSE(
1592      [AC_LANG_PROGRAM(
1593        [[#include <bzlib.h>]],
1594        [[BZ2_bzCompress (NULL, 0);]])],
1595      [AC_MSG_RESULT([yes]); BZIP2_LIBS='-lbz2'],
1596      add_deps_error([libbzip2], [libbzip2 library not found]))],
1597    add_deps_error([libbzip2], [libbzip2 header files not found]))
1598fi
1599
1600LIBS=$gimp_save_LIBS
1601
1602AC_SUBST(BZIP2_LIBS)
1603
1604
1605###################
1606# Check for liblzma
1607###################
1608
1609PKG_CHECK_MODULES(LZMA, liblzma >= liblzma_required_version,,
1610                 [add_deps_error([liblzma >= liblzma_required_version])])
1611
1612
1613###############################
1614# Check for Ghostscript library
1615###############################
1616
1617AC_ARG_WITH(gs,  [  --without-gs            build without Ghostscript support])
1618
1619have_gs=no
1620if test "x$with_gs" != xno; then
1621  have_gs=yes
1622  AC_CHECK_LIB(gs, gsapi_new_instance,
1623    [AC_CHECK_HEADER(ghostscript/iapi.h,
1624      FILE_PS='file-ps$(EXEEXT)'; GS_LIBS='-lgs',
1625      [have_gs="no (Ghostscript header files not found)"])],
1626    [have_gs="no (Ghostscript library not found)"])
1627  if test "x$have_gs" != xyes -a "x$with_gs" = xyes; then
1628    AC_MSG_ERROR([
1629*** Checks for Ghostscript library failed. You can build without it by passing
1630*** --without-gs to configure but you won't be able to use PostScript files then.])
1631  fi
1632fi
1633
1634if test "x$have_gs" = xyes; then
1635  MIME_TYPES="$MIME_TYPES;application/postscript"
1636fi
1637
1638AC_SUBST(FILE_PS)
1639AM_CONDITIONAL(HAVE_GS, test "x$have_gs" = xyes)
1640AC_SUBST(GS_LIBS)
1641
1642
1643##################
1644# Check for libpng
1645##################
1646
1647PKG_CHECK_MODULES(PNG, libpng >= libpng_required_version,,
1648                  [add_deps_error([libpng >= libpng_required_version])])
1649
1650MIME_TYPES="$MIME_TYPES;image/png;image/x-icon"
1651PNG_CFLAGS="$PNG_CFLAGS -DPNG_PEDANTIC_WARNINGS"
1652
1653
1654##################
1655# Check for libmng
1656##################
1657
1658AC_ARG_WITH(libmng,  [  --without-libmng        build without MNG support])
1659
1660have_libmng=no
1661if test "x$with_libmng" != xno && test -z "$MNG_LIBS" &&
1662   test -n "$PNG_LIBS" && test -n "$JPEG_LIBS" && test -n "$Z_LIBS"; then
1663  AC_CHECK_LIB(mng, mng_create,
1664    [AC_CHECK_HEADER(libmng.h, mng_ok=yes)],
1665    [have_libmng="no (MNG library not found)"], -lz -lm)
1666  if test "$mng_ok" = yes; then
1667    have_libmng=yes
1668    FILE_MNG='file-mng$(EXEEXT)'; MNG_LIBS="-lmng $JPEG_LIBS $PNG_LIBS"; MNG_CFLAGS="$PNG_CFLAGS"
1669    if test "x$platform_win32" = "xyes"; then
1670      MNG_CFLAGS="$MNG_CFLAGS -DMNG_USE_DLL"
1671    fi
1672  else
1673    have_libmng="no (MNG header file not found)"
1674  fi
1675fi
1676
1677AC_SUBST(FILE_MNG)
1678AC_SUBST(MNG_LIBS)
1679AC_SUBST(MNG_CFLAGS)
1680
1681
1682#################
1683# Check for libaa
1684#################
1685
1686AC_ARG_WITH(aa,  [  --without-aa            do not build the AA plug-in])
1687
1688have_libaa=no
1689if test "x$with_aa" != xno && test -z "$AA_LIBS"; then
1690  have_libaa=yes
1691  AC_CHECK_LIB(aa, aa_printf,
1692    [AC_CHECK_HEADER(aalib.h,
1693      FILE_AA='file-aa$(EXEEXT)'; AA_LIBS='-laa',
1694      [have_libaa="no (AA header file not found)"])],
1695    [have_libaa="no (AA library not found)"])
1696fi
1697
1698AC_SUBST(FILE_AA)
1699AC_SUBST(AA_LIBS)
1700
1701
1702##################
1703# Check for libxpm
1704##################
1705
1706AC_ARG_WITH(libxpm,  [  --without-libxpm        build without XPM support])
1707
1708gimp_save_CFLAGS="$CFLAGS"
1709CFLAGS="$CFLAGS $X_CFLAGS"
1710gimp_save_LDFLAGS="$LDFLAGS"
1711LDFLAGS="$LDFLAGS $X_LIBS"
1712if test "$gdk_target" = x11; then
1713  lib_X11=-lX11
1714fi
1715have_libxpm=no
1716if test "x$with_libxpm" != xno && test -z "$XPM_LIBS"; then
1717  have_libxpm=yes
1718  AC_CHECK_LIB(Xpm, XpmReadFileToXpmImage,
1719    [AC_CHECK_HEADER(X11/xpm.h,
1720      FILE_XPM='file-xpm$(EXEEXT)'; XPM_LIBS="$X_LIBS $X_PRE_LIBS $lib_X11 -lXpm",
1721      [have_libxpm="no (XPM header file not found)"])],
1722    [have_libxpm="no (XPM library not found)"], $X_PRE_LIBS $lib_X11)
1723fi
1724CFLAGS="$gimp_save_CFLAGS"
1725LDFLAGS="$gimp_save_LDFLAGS"
1726
1727if test "x$have_libxpm" = xyes; then
1728  MIME_TYPES="$MIME_TYPES;image/x-xpixmap"
1729fi
1730
1731AC_SUBST(FILE_XPM)
1732AC_SUBST(XPM_LIBS)
1733
1734
1735###################
1736# Check for OpenEXR
1737###################
1738
1739AC_ARG_WITH(openexr, [  --without-openexr       build without OpenEXR support])
1740
1741have_openexr=no
1742if test "x$with_openexr" != xno; then
1743  have_openexr=yes
1744  PKG_CHECK_MODULES(OPENEXR, OpenEXR >= openexr_required_version,
1745    FILE_EXR='file-exr$(EXEEXT)',
1746    [have_openexr="no (OpenEXR not found)"])
1747fi
1748
1749if test "x$have_openexr" = xyes; then
1750  MIME_TYPES="$MIME_TYPES;image/x-exr"
1751fi
1752
1753AC_SUBST(OPENEXR_CFLAGS)
1754AC_SUBST(OPENEXR_LIBS)
1755AC_SUBST(FILE_EXR)
1756
1757AM_CONDITIONAL(HAVE_OPENEXR, test "x$have_openexr" = xyes)
1758
1759
1760################
1761# Check for WebP
1762################
1763
1764AC_ARG_WITH(webp, [  --without-webp       build without WebP support])
1765
1766have_webp=no
1767if test "x$with_webp" != xno; then
1768  have_webp=yes
1769  PKG_CHECK_MODULES(WEBP, libwebp >= webp_required_version,
1770    [
1771      PKG_CHECK_MODULES(WEBPMUX, libwebpmux >= webp_required_version,
1772        [
1773          PKG_CHECK_MODULES(WEBPDEMUX, libwebpdemux >= webp_required_version,,
1774            [have_webp="no (WebP not built with libwebpdemux)"])
1775        ],
1776        [have_webp="no (WebP not built with libwebpmux)"])
1777    ],
1778    [have_webp="no (WebP not found)"])
1779fi
1780
1781if test "x$have_webp" = xyes; then
1782  MIME_TYPES="$MIME_TYPES;image/webp;image/x-webp"
1783fi
1784
1785AM_CONDITIONAL(HAVE_WEBP, test "x$have_webp" = xyes)
1786
1787
1788###################
1789# Check for libheif
1790###################
1791
1792AC_ARG_WITH(libheif, [  --without-libheif       build without libheif support])
1793
1794# Overcomplex tests, but basically:
1795# - Profiles supported only for libheif >= 1.4.0.
1796# - libheif 1.5.0 and 1.5.1 are very broken and easily crash.
1797# As a consequence we prioritize any libheif other than these 2 versions
1798# (even when under 1.4.0 thus we lose profile support), and only use
1799# these as last resort, outputting a warning.
1800have_libheif=no
1801have_libheif_1_4_0=no
1802if test "x$with_libheif" != xno; then
1803  have_libheif_1_4_0=yes
1804  have_libheif=yes
1805  PKG_CHECK_MODULES(LIBHEIF, libheif > 1.5.1,,
1806    [
1807      PKG_CHECK_MODULES(LIBHEIF, libheif = 1.4.0,,
1808        [
1809          have_libheif_1_4_0="no (libheif >= 1.4.0 not found)"
1810          PKG_CHECK_MODULES(LIBHEIF, libheif = libheif_required_version,,
1811                            [
1812                              PKG_CHECK_MODULES(LIBHEIF, libheif >= 1.5.0,
1813                                                [
1814                                                  have_libheif_1_4_0=yes
1815                                                  warning_libheif="
1816WARNING: libheif version 1.5.0 and 1.5.1 are known to crash when
1817         exporting (bug #4185). Please update."
1818                                                ],
1819                                                [ have_libheif="no (libheif not found)" ])
1820                            ])
1821        ])
1822    ])
1823fi
1824
1825can_import_heic=no
1826can_export_heic=no
1827can_import_avif=no
1828can_export_avif=no
1829if test "x$have_libheif" = xyes; then
1830  can_import_heic=`$PKG_CONFIG --variable=builtin_h265_decoder libheif`
1831  can_export_heic=`$PKG_CONFIG --variable=builtin_h265_encoder libheif`
1832  if test "x$can_import_heic" = xyes; then
1833    MIME_TYPES="$MIME_TYPES;image/heif;image/heic"
1834  fi
1835  can_import_avif=`$PKG_CONFIG --variable=builtin_avif_decoder libheif`
1836  can_export_avif=`$PKG_CONFIG --variable=builtin_avif_encoder libheif`
1837  if test "x$can_import_avif" = xyes; then
1838    MIME_TYPES="$MIME_TYPES;image/avif"
1839  fi
1840
1841  if test "x$can_import_heic" != xyes && test "x$can_import_avif" != xyes; then
1842    have_libheif=no
1843    have_libheif_1_4_0=no
1844    warning_libheif=""
1845  else
1846    FILE_HEIF='file-heif$(EXEEXT)'
1847  fi
1848fi
1849
1850AC_SUBST(FILE_HEIF)
1851AM_CONDITIONAL(HAVE_LIBHEIF, test "x$have_libheif" = xyes)
1852
1853have_heif_profile_support=no
1854if test "x$have_libheif_1_4_0" = xyes; then
1855  AC_DEFINE(HAVE_LIBHEIF_1_4_0, 1,
1856            [Define to 1 if libheif >= 1.4.0 is available])
1857
1858  if test "x$can_import_heic" = xyes || test "x$can_export_heic" = xyes; then
1859    if test "x$warning_libheif" != "x"; then
1860      have_heif_profile_support="yes (see warning below)"
1861    else
1862      have_heif_profile_support=yes
1863    fi
1864  fi
1865fi
1866
1867
1868########################
1869# Check for libbacktrace
1870########################
1871
1872AC_ARG_WITH(libbacktrace, [  --without-libbacktrace       build without libbacktrace support])
1873
1874have_libbacktrace=no
1875if test "x$with_libbacktrace" != xno; then
1876  have_libbacktrace=yes
1877
1878  gimp_save_LIBS=$LIBS
1879  LIBS="$LIBS -lbacktrace"
1880
1881  AC_MSG_CHECKING([for LIBBACKTRACE])
1882  AC_LINK_IFELSE(
1883    [AC_LANG_PROGRAM(
1884      [[#include <stddef.h>
1885        #include <backtrace.h>
1886        #include <backtrace-supported.h>
1887
1888        #if ! BACKTRACE_SUPPORTED
1889        #error ! BACKTRACE_SUPPORTED
1890        #endif
1891      ]],
1892      [[(void) backtrace_create_state (NULL, 0, NULL, NULL);]])],
1893    [AC_MSG_RESULT([yes]); LIBBACKTRACE_LIBS='-lbacktrace'],
1894    [AC_MSG_RESULT([no]); have_libbacktrace='no (libbacktrace is not found or not supported)'])
1895
1896  LIBS=$gimp_save_LIBS
1897
1898  AC_SUBST(LIBBACKTRACE_LIBS)
1899fi
1900
1901if test "x$have_libbacktrace" = xyes; then
1902  AC_DEFINE(HAVE_LIBBACKTRACE, 1,
1903            [Define to 1 if libbacktrace is available])
1904fi
1905
1906
1907#####################
1908# Check for libunwind
1909#####################
1910
1911AC_ARG_WITH(libunwind, [  --without-libunwind       build without libunwind support])
1912
1913have_libunwind=no
1914if test "x$with_libunwind" != xno; then
1915  have_libunwind=yes
1916  PKG_CHECK_MODULES(LIBUNWIND, libunwind >= libunwind_required_version,
1917    [],
1918    [have_libunwind="no (libunwind not found)"])
1919fi
1920
1921if test "x$have_libunwind" = xyes; then
1922  AC_DEFINE(HAVE_LIBUNWIND, 1,
1923            [Define to 1 if libunwind is available])
1924fi
1925
1926
1927#######################################
1928# Check for detailed backtraces support
1929#######################################
1930
1931detailed_backtraces=no
1932if test "x$platform_linux" = xyes; then
1933  if test "x$have_libbacktrace" = xyes -o "x$have_libunwind" = xyes; then
1934    detailed_backtraces=yes
1935  else
1936    detailed_backtraces='no (libbacktrace and libunwind are not found or not supported)'
1937  fi
1938elif test "x$platform_win32" = xyes; then
1939  detailed_backtraces=$enable_drmingw
1940fi
1941
1942
1943######################
1944# Check for libmypaint
1945######################
1946
1947PKG_CHECK_MODULES(LIBMYPAINT, libmypaint >= 1.4.0,,
1948  [
1949    PKG_CHECK_MODULES(LIBMYPAINT, libmypaint >= libmypaint_required_version,,
1950                      [add_deps_error([libmypaint >= libmypaint_required_version])])
1951    warning_libmypaint="
1952WARNING: libmypaint lower than version 1.4.0 is known to crash when
1953         parsing MyPaint 2 brushes. Please update."
1954  ])
1955
1956PKG_CHECK_MODULES(MYPAINT_BRUSHES, mypaint-brushes-1.0,,
1957                  [add_deps_error([mypaint-brushes-1.0])])
1958
1959if test "x$enable_relocatable_bundle" != xno; then
1960  mypaint_brushes_dir='${gimp_installation_dir}/share/mypaint-data/1.0/brushes'
1961else
1962  mypaint_brushes_dir=`$PKG_CONFIG --variable=brushesdir mypaint-brushes-1.0`
1963fi
1964AC_SUBST(mypaint_brushes_dir)
1965
1966
1967##################
1968# Check for webkit
1969##################
1970
1971AC_ARG_WITH(webkit, [  --without-webkit        don't build the help-browser and web-page plug-ins])
1972
1973have_webkit=no
1974if test "x$with_webkit" != xno; then
1975  PKG_CHECK_MODULES(WEBKIT, webkit-1.0 >= webkit_required_version,
1976    WEB_PAGE='web-page$(EXEEXT)'
1977    have_webkit=yes,
1978    have_webkit="no (WebKit not found)")
1979else
1980  have_webkit="no (WebKit support disabled)"
1981fi
1982
1983AC_SUBST(WEB_PAGE)
1984if test "x$have_webkit" = "xyes"; then
1985  AC_DEFINE(HAVE_WEBKIT, 1, [Define to 1 if webkit is available])
1986fi
1987AM_CONDITIONAL(HAVE_WEBKIT, test "x$have_webkit" = xyes)
1988
1989
1990###################
1991# Check for librsvg
1992###################
1993
1994PKG_CHECK_MODULES(SVG, librsvg-2.0 >= rsvg_required_version,,
1995                  [add_deps_error([rsvg >= rsvg_required_version])])
1996
1997MIME_TYPES="$MIME_TYPES;image/svg+xml"
1998
1999
2000####################################
2001# Allow to disable the print plug-in
2002####################################
2003
2004AC_ARG_WITH(print,[  --without-print         build without print support])
2005
2006enable_print="no (disabled)"
2007if test "x$with_print" != xno; then
2008  enable_print="yes"
2009fi
2010
2011AM_CONDITIONAL(BUILD_PRINT, test "x$enable_print" = xyes)
2012
2013
2014######################
2015# Check for libpoppler
2016######################
2017
2018# PDF import support is a granted feature.
2019PKG_CHECK_MODULES(POPPLER, [poppler-glib >= poppler_required_version],,
2020                  [add_deps_error([poppler-glib >= poppler_required_version])])
2021# All modern distributions have at least this version and CJK/Cyrillic
2022# support should not be considered as "second-zone citizen".
2023PKG_CHECK_MODULES(POPPLER_DATA, [poppler-data >= poppler_data_required_version],,
2024                  [add_deps_error([poppler-data >= poppler_data_required_version])])
2025
2026# MIME_TYPES is for the formats we can open as used for instance in the
2027# desktop file. Even if cairo-pdf (used for PDF export) is not
2028# installed, the mime-type list should contain application/pdf.
2029MIME_TYPES="$MIME_TYPES;application/pdf"
2030
2031#####################
2032# Check for cairo-pdf
2033#####################
2034
2035AC_ARG_WITH(cairo_pdf,[  --without-cairo-pdf     build without cairo-pdf support])
2036have_cairo_pdf=no
2037if test "x$with_cairo_pdf" != xno; then
2038  have_cairo_pdf=yes
2039  PKG_CHECK_MODULES(CAIRO_PDF, cairo-pdf >= cairo_pdf_required_version,
2040    FILE_PDF_SAVE='file-pdf-save$(EXEEXT)',
2041    have_cairo_pdf="no (cairo-pdf not found)")
2042else
2043   have_cairo_pdf="no (cairo-pdf support disabled)"
2044fi
2045
2046AC_SUBST(FILE_PDF_SAVE)
2047
2048
2049###################
2050# Check for libwmf2
2051###################
2052
2053AC_ARG_WITH(wmf, [  --without-wmf           build without WMF support])
2054
2055have_libwmf=no
2056AS_IF([test "x$with_wmf" != xno], [
2057  PKG_CHECK_MODULES([WMF], libwmf >= wmf_required_version,
2058                    [have_libwmf=yes], [have_libwmf="no (libwmf not found)"])
2059
2060  AS_IF([test "x$have_libwmf" != xyes], [
2061    # No pkg-config; try falling back to the traditional -config script
2062    AC_PATH_PROG([WMF_CONFIG], [libwmf-config], [no])
2063    AS_IF([test "x$WMF_CONFIG" != xno], [
2064      AC_MSG_CHECKING(for libwmf >= wmf_required_version using $WMF_CONFIG)
2065      wmf_version=`$WMF_CONFIG --version`
2066      AS_IF(expr $wmf_version \>= wmf_required_version >/dev/null, [
2067        AC_MSG_RESULT([yes (version $wmf_version)])
2068        have_libwmf=yes
2069        WMF_LIBS=`$WMF_CONFIG --libs`
2070        WMF_CFLAGS=`$WMF_CONFIG --cflags`
2071      ])
2072    ])
2073  ])
2074])
2075
2076if test "x$have_libwmf" = xyes; then
2077  FILE_WMF='file-wmf$(EXEEXT)'
2078  MIME_TYPES="$MIME_TYPES;image/x-wmf"
2079fi
2080
2081AC_SUBST(FILE_WMF)
2082AC_SUBST(WMF_LIBS)
2083AC_SUBST(WMF_CFLAGS)
2084
2085
2086####################
2087# Check for OpenJPEG
2088####################
2089
2090AC_ARG_WITH(jpeg2000, [  --without-jpeg2000      build without JPEG 2000 support])
2091
2092have_openjpeg=no
2093if test "x$with_jpeg2000" != xno; then
2094  have_openjpeg=yes
2095  PKG_CHECK_MODULES(OPENJPEG, libopenjp2 >= openjpeg_required_version,
2096    FILE_JP2_LOAD='file-jp2-load$(EXEEXT)'
2097    have_openjpeg=yes,
2098    have_openjpeg="no (OpenJPEG not found)")
2099fi
2100
2101if test "x$have_openjpeg" = xyes; then
2102  MIME_TYPES="$MIME_TYPES;image/jp2"
2103fi
2104
2105AM_CONDITIONAL(HAVE_OPENJPEG, test "x$have_openjpeg" = xyes)
2106AC_SUBST(FILE_JP2_LOAD)
2107
2108
2109################
2110# Check for lcms
2111################
2112
2113PKG_CHECK_MODULES(LCMS, lcms2 >= lcms_required_version,,
2114                  [add_deps_error([lcms2 >= lcms_required_version])])
2115
2116
2117######################
2118# Check for libXcursor
2119######################
2120
2121AC_ARG_WITH(xmc,[  --without-xmc           build without Xcursor support])
2122
2123have_xmc=no
2124if test "x$with_xmc" != xno; then
2125  have_xmc=yes
2126  PKG_CHECK_MODULES(XMC, xcursor,
2127    FILE_XMC='file-xmc$(EXEEXT)',
2128    have_xmc="no (libXcursor not found)")
2129else
2130   have_xmc="no (libXcursor support disabled)"
2131fi
2132
2133if test "x$have_xmc" = xyes; then
2134  MIME_TYPES="$MIME_TYPES;image/x-xcursor"
2135fi
2136
2137AC_SUBST(FILE_XMC)
2138
2139
2140################
2141# Check for alsa
2142################
2143
2144AC_ARG_WITH(alsa, [  --without-alsa          disable alsa support in midi input controller])
2145
2146have_alsa="no (alsa support disabled)"
2147if test "x$with_alsa" != xno; then
2148  have_alsa=yes
2149  AM_PATH_ALSA(alsa_required_version,
2150               AC_DEFINE(HAVE_ALSA, 1, [Define to 1 if alsa is available]),
2151               have_alsa="no (libasound not found or unusable)")
2152fi
2153
2154
2155#######################
2156# Check for Linux Input
2157#######################
2158
2159AC_ARG_WITH(linux-input, [  --without-linux-input   don't build linux input event controller module])
2160
2161have_linux_input="no (linux input support disabled)"
2162AS_IF([test "x$with_linux_input" != "xno"],
2163  [AC_CHECK_HEADER([linux/input.h],
2164    [AC_CHECK_DECL([KEY_OK],
2165                   [have_linux_input=yes],
2166                   [have_linux_input="no (needs Linux 2.6)"],
2167                   [#include <linux/input.h>])])])
2168
2169AM_CONDITIONAL([HAVE_LINUX_INPUT], [test "x$have_linux_input" = xyes])
2170
2171
2172###############################
2173# Check for DirectX DirectInput
2174###############################
2175
2176AC_ARG_WITH(directx-sdk, [  --with-directx-sdk=PFX  prefix where the DirectX SDK is installed(optional)])
2177
2178have_dx_dinput=no
2179if test "x$os_win32" = xyes; then
2180  case "$with_directx_sdk" in
2181    *" "*) AC_MSG_WARN([The DirectX SDK should be accessible through a path without spaces. Use MSYS mounts. Ignoring your --with-directx-sdk switch.])
2182           with_directx_sdk=;;
2183    *\\*) AC_MSG_WARN([Use plain (forward) slashes only in your --with-directx-sdk switch. Ignoring your --with-directx-sdk switch.])
2184           with_directx_sdk=;;
2185  esac
2186
2187  dinput_save_CPPFLAGS="$CPPFLAGS"
2188  dinput_save_LDFLAGS="$LDFLAGS"
2189  if test "x$with_directx_sdk" != x; then
2190    CPPFLAGS="-I $with_directx_sdk/Include $CPPFLAGS"
2191    LDFLAGS="-L$with_directx_sdk/Lib/x86 $LDFLAGS"
2192    AC_CHECK_HEADER(dinput.h,
2193                    [AC_CHECK_LIB(dxguid, GUID_XAxis, have_dx_dinput=yes)])
2194  fi
2195
2196  if test "x$have_dx_dinput" = xyes; then
2197    AC_DEFINE(HAVE_DX_DINPUT, 1, [Define to 1 if you have DirectX DirectInput headers and libraries])
2198  else
2199    CPPFLAGS="$dinput_save_CPPFLAGS"
2200    LDFLAGS="$dinput_save_LDFLAGS"
2201  fi
2202fi
2203
2204AM_CONDITIONAL(HAVE_DX_DINPUT, test "x$have_dx_dinput" = xyes)
2205
2206
2207####################
2208# Check for libgudev
2209####################
2210
2211AC_ARG_WITH(gudev, [  --without-gudev         build without GUdev support])
2212
2213have_libgudev=no
2214
2215if test "x$with_gudev" = xno; then
2216  have_libgudev="no (disabled)"
2217fi
2218
2219if test "x$have_linux_input" = xyes && test "x$with_gudev" != xno; then
2220  PKG_CHECK_MODULES(GUDEV, gudev-1.0 >= libgudev_required_version,
2221    have_libgudev=yes,
2222    have_libgudev="no (libgudev not found)")
2223fi
2224
2225if test "x$have_libgudev" = xyes; then
2226  AC_DEFINE(HAVE_LIBGUDEV, 1, [Define to 1 if libgudev is available])
2227fi
2228
2229
2230##########################
2231# Check for Email Settings
2232##########################
2233
2234# The default behavior is that xdg-email is searched in the user PATH,
2235# and email plugin is enabled if found.
2236# Sendmail can be used instead of xdg-email, but must be explicitly
2237# enabled with --with-sendmail.
2238
2239have_email="no (xdg-email not found)"
2240
2241AC_ARG_WITH(sendmail,[  --with-sendmail[=DIR]     use sendmail instead of xdg-email])
2242
2243have_sendmail=no
2244# Sendmail must be explicitly enabled to replace xdg-email implementation.
2245if test "x$with_sendmail" != "x" && test "x$with_sendmail" != "xno"; then
2246  if test "x$with_sendmail" = "xyes"; then
2247      sendmail_path=$PATH:/usr/sbin:/usr/lib
2248      AC_DEFINE_UNQUOTED(SENDMAIL, "",
2249                         [The MTA used by the mail plug-in.])
2250  else
2251      sendmail_path=$with_sendmail
2252      AC_DEFINE_UNQUOTED(SENDMAIL, "$with_sendmail",
2253                         [The MTA used by the mail plug-in.])
2254  fi
2255
2256  AC_PATH_PROG(SENDMAIL, sendmail, , $sendmail_path)
2257  if test "x$SENDMAIL" != "x"; then
2258    have_email="yes (sendmail)"
2259  else
2260    # Not having sendmail at runtime is not a blocker.
2261    have_email="needs runtime dependency: sendmail"
2262  fi
2263  have_sendmail=yes
2264fi
2265
2266if test "x$have_sendmail" = xno; then
2267  AC_PATH_PROG(XDG_EMAIL, xdg-email)
2268  if test "x$XDG_EMAIL" != "x"; then
2269    have_email="yes (xdg-email)"
2270  else
2271    # Not having xdg-email at runtime is not a blocker.
2272    # But let's inform the builder that for the feature to be available,
2273    # xdg-email is a runtime dependency.
2274    have_email="needs runtime dependency: xdg-email"
2275  fi
2276fi
2277
2278################
2279# Check for perl
2280################
2281
2282AC_PATH_PROGS(PERL,perl5 perl,perl)
2283AX_PROG_PERL_VERSION([perl_required_version],,
2284                     [add_deps_error([perl >= perl_required_version])])
2285
2286
2287AC_ARG_WITH(pdbgen,
2288            [  --with-pdbgen           use 'pdbgen' code generation tool],,
2289  with_pdbgen=$USE_MAINTAINER_MODE)
2290
2291AM_CONDITIONAL(WITH_PDBGEN, test "x$with_pdbgen" = xyes)
2292
2293
2294#####################
2295# Check for json-glib
2296#####################
2297
2298PKG_CHECK_MODULES(JSON_GLIB, json-glib-1.0 >= json_glib_required_version,,
2299                  [add_deps_error([json-glib-1.0 >= json_glib_required_version])])
2300
2301##################
2302# Check for python
2303##################
2304
2305# Pygimp configure stuff ...
2306AC_ARG_ENABLE(python,
2307  AS_HELP_STRING([--disable-python],
2308                 [do not build the python extension]))
2309
2310m4_define([pycheck_error], [
2311  required_deps="$required_deps
2312  - $1
2313      *** Please install $2, or skip building the python scripting extension by
2314      *** passing --disable-python to configure (but then you will not be able
2315      *** to use scripts for GIMP that are written in Python)."])
2316
2317# pygtk-codegen-2.0 and the defsdir are used for the `dist` target,
2318# regardless of whether Python is enabled or not. Their absence don't
2319# break simple builds but we still check them.
2320AC_PATH_PROG(PYGTK_CODEGEN, pygtk-codegen-2.0, no)
2321
2322AC_MSG_CHECKING(for pygtk defs)
2323PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
2324AC_SUBST(PYGTK_DEFSDIR)
2325AC_MSG_RESULT($PYGTK_DEFSDIR)
2326
2327if test "x$enable_python" != xno; then
2328  enable_python="yes"
2329  # check for Python
2330  AM_PATH_PYTHON2(python2_required_version,,
2331                  [pycheck_error([Python 2 (python2_required_version or newer)], [it])])
2332  AM_CHECK_PYTHON_HEADERS(, [pycheck_error([Python 2 headers], [them])])
2333
2334  # Win32 needs all symbols resolved for linking, even for DLLs
2335  # Assume the link library is in $exec_prefix/libs
2336  # This might be able to be figured out from distutils, but it's
2337  # not documented so we won't rely on internal implementation
2338  PYLINK_LIBS=
2339  if test "x$platform_win32" = "xyes"; then
2340    PYBIN_PATH="$py_exec_prefix\pythonw.exe"
2341    PYTHON_INCLUDES=`echo "$PYTHON_INCLUDES" | sed -e 's/\\\\/\\//g'`
2342    py_exec_prefix=`echo "$py_exec_prefix" | sed -e 's/\\\\/\\//g'`
2343    pylibversion=`echo $PYTHON_VERSION | sed -e 's/\\.//'`
2344    PYLINK_LIBS="-L${py_exec_prefix}/libs -lpython${pylibversion}"
2345  else
2346    PYBIN_PATH="$PYTHON"
2347  fi
2348  AC_SUBST(PYLINK_LIBS)
2349  AC_SUBST(PYBIN_PATH)
2350
2351  # check for PyGTK
2352  PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= pygtk_required_version,,
2353                    [pycheck_error([PyGTK pygtk_required_version or newer], [it])])
2354
2355  if test "x$PYGTK_CODEGEN" = xno; then
2356     pycheck_error([pygtk-codegen-2.0 script], [it])
2357  fi
2358
2359  PKG_CHECK_MODULES(PYCAIRO, pycairo >= pycairo_required_version,,
2360                    [pycheck_error([PyCairo pycairo_required_version or newer], [it])])
2361
2362  GIMP_DETECT_CFLAGS(PYGIMP_EXTRA_CFLAGS, '-fno-strict-aliasing')
2363  AC_SUBST(PYGIMP_EXTRA_CFLAGS)
2364
2365  MIME_TYPES="$MIME_TYPES;image/openraster"
2366fi
2367AM_CONDITIONAL(BUILD_PYTHON, test "x$enable_python" != xno)
2368
2369
2370###########################################################
2371# Some plug-ins don't build on Win32, others are Win32-only
2372###########################################################
2373
2374if test "x$os_win32" = xno; then
2375  MAIL='mail$(EXEEXT)'
2376fi
2377
2378AC_SUBST(MAIL)
2379
2380
2381###############################
2382# Check for GTK Mac Integration
2383###############################
2384
2385gtk_mac_integration_ok=no
2386if test "x$platform_osx" != xno &&
2387   test "x`$PKG_CONFIG --variable=target gtk+-2.0`" == "xquartz"; then
2388
2389  PKG_CHECK_MODULES(GTK_MAC_INTEGRATION, gtk-mac-integration-gtk2 >= gtk_mac_integration_required_version,
2390    gtk_mac_integration_ok=yes,
2391    gtk_mac_integration_ok=no)
2392
2393  if test "x$gtk_mac_integration_ok" != "xyes"; then
2394    PKG_CHECK_MODULES(GTK_MAC_INTEGRATION, gtk-mac-integration >= gtk_mac_integration_required_version,
2395      gtk_mac_integration_ok=yes,
2396      gtk_mac_integration_ok=no)
2397  fi
2398fi
2399
2400AM_CONDITIONAL(PLATFORM_OSX_QUARTZ, test "x$gtk_mac_integration_ok" = xyes)
2401
2402
2403##########################################################
2404# Determine where to install the desktop & mime info files
2405##########################################################
2406
2407AC_ARG_WITH(desktop-dir, [  --with-desktop-dir=PATH where to install desktop files (default=PREFIX/share)])
2408
2409if test "x$with_desktop_dir" != x; then
2410  DESKTOP_DATADIR=$with_desktop_dir
2411else
2412  DESKTOP_DATADIR="$datadir"
2413fi
2414
2415AM_CONDITIONAL(DESKTOP_DATADIR, test "x$with_desktop_dir" != xno)
2416AC_SUBST(DESKTOP_DATADIR)
2417
2418
2419#####################
2420# Check for XML tools
2421#####################
2422
2423AC_PATH_PROG(XMLLINT, xmllint, no)
2424AM_CONDITIONAL(HAVE_XMLLINT, test "x$XMLLINT" != "xno")
2425
2426AC_PATH_PROG(XSLTPROC, xsltproc, no)
2427AM_CONDITIONAL(HAVE_XSLTPROC, test "x$XSLTPROC" != "xno")
2428
2429
2430########################
2431# Check for vector icons
2432########################
2433
2434# If not cross-compiling, default build's link and compile flags to the
2435# target's flags.
2436if test "$cross_compiling" != "yes"; then
2437  if test "x$LDFLAGS_FOR_BUILD" = "x"; then
2438    LDFLAGS_FOR_BUILD="$LDFLAGS"
2439  fi
2440  if test "x$CFLAGS_FOR_BUILD" = "x"; then
2441    CFLAGS_FOR_BUILD="$CFLAGS"
2442  fi
2443  if test "x$CPPFLAGS_FOR_BUILD" = "x"; then
2444    CPPFLAGS_FOR_BUILD="$CPPFLAGS"
2445  fi
2446fi
2447
2448AC_ARG_ENABLE(vector-icons, [  --disable-vector-icons  use raster icons rather than vector ones (default=auto)], ,
2449              enable_vector_icons=auto)
2450
2451if test "x$enable_vector_icons" != "xno"; then
2452  have_shared_mime_info=""
2453  # shared-mime-info is needed to correctly detect SVG files (except on
2454  # Windows, apparently).
2455  PKG_CHECK_MODULES(MIME_INFO, [shared-mime-info],
2456                    have_shared_mime_info="yes", have_shared_mime_info="no")
2457  if test "x$have_shared_mime_info" = "xyes" ||
2458     test "x$platform_win32" = "xyes"; then
2459    # Check if librsvg was built with --disable-pixbuf-loader.
2460    gdk_pixbuf_moduledir=`$PKG_CONFIG --variable=gdk_pixbuf_moduledir gdk-pixbuf-2.0`
2461    # AC_CHECK_FILE macro does not work when cross-compiling and exits with:
2462    # error: cannot check for file existence when cross compiling
2463    # So let's test files the shell way.
2464    if (test "x$platform_win32" = "xyes" &&
2465        test -f "$gdk_pixbuf_moduledir/libpixbufloader-svg.dll") ||
2466       test -f "$gdk_pixbuf_moduledir/libpixbufloader-svg.so"; then
2467      # We must not use $PKG_CONFIG nor PKG_CHECK_* macros because we need
2468      # to make sure we use the native pkg-config (in case we cross-compile).
2469      if pkg-config --atleast-version=glib_required_version glib-2.0 &&
2470         pkg-config gio-2.0; then
2471        NATIVE_GLIB_LIBS=`pkg-config --libs gio-2.0 glib-2.0`
2472        NATIVE_GLIB_CFLAGS=`pkg-config --cflags gio-2.0 glib-2.0`
2473        enable_vector_icons="yes"
2474
2475        if test "x$platform_win32" = "xyes"; then
2476          warning_vector_icons_windows="
2477WARNING: You enabled vector icons on Win32. Make sure to run:
2478           $ gdk-pixbuf-query-loaders.exe --update-cache
2479         on the target machine (this command generates loaders.cache)
2480         so that GdkPixbuf knows where to find the SVG loader."
2481        fi
2482      else
2483        enable_vector_icons="no (missing native glib-2.0 > glib_required_version or gio-2.0)"
2484      fi
2485    else
2486      enable_vector_icons="no (librsvg GdkPixbuf loader missing)"
2487    fi
2488  else
2489    enable_vector_icons="no (missing shared-mime-info)"
2490  fi
2491fi
2492
2493AC_SUBST(NATIVE_GLIB_LIBS)
2494AC_SUBST(NATIVE_GLIB_CFLAGS)
2495AM_CONDITIONAL(ENABLE_VECTOR_ICONS, test "x$enable_vector_icons" = "xyes")
2496
2497####################
2498# Check for xvfb-run
2499####################
2500
2501AC_ARG_WITH(xvfb-run,  [  --without-xvfb-run      do not use xvfb-run for UI-dependent automatic tests])
2502
2503have_xvfb_run="no (disabled)"
2504if test "x$with_xvfb_run" != "xno"; then
2505  AC_PATH_PROG(XVFB_RUN, xvfb-run, no)
2506  if test "x$XVFB_RUN" != "xno"; then
2507    have_xvfb_run="yes"
2508    AC_DEFINE(HAVE_XVFB_RUN, 1, [Define to 1 if xvfb-run is available])
2509  else
2510    have_xvfb_run="no (not found)"
2511  fi
2512fi
2513AM_CONDITIONAL(HAVE_XVFB_RUN, test "x$have_xvfb_run" = "xyes")
2514
2515##########################
2516# Check for appstream-util
2517##########################
2518
2519AC_ARG_WITH(appdata-test,  [  --without-appdata-test  do not validate the appdata file])
2520
2521have_appstream_util="no (disabled)"
2522if test "x$with_appdata_test" != "xno"; then
2523  AC_PATH_PROG(APPSTREAM_UTIL, appstream-util, no)
2524  if test "x$APPSTREAM_UTIL" != "xno"; then
2525    have_appstream_util="yes"
2526  else
2527    have_appstream_util="no (appstream-util not found)"
2528  fi
2529fi
2530AM_CONDITIONAL(HAVE_APPSTREAM_UTIL, test "x$have_appstream_util" = "xyes")
2531if test "x$have_appstream_util" = "xyes"; then
2532  have_appstream_util="yes (this test requires network access; --without-appdata-test to disable)"
2533fi
2534
2535
2536#################################
2537# Check for desktop-file-validate
2538#################################
2539
2540AC_PATH_PROG(DESKTOP_FILE_VALIDATE, desktop-file-validate, no)
2541if test "x$DESKTOP_FILE_VALIDATE" != "xno"; then
2542  have_desktop_file_validate="yes"
2543else
2544  have_desktop_file_validate="no (desktop-file-validate not found)"
2545fi
2546AM_CONDITIONAL(HAVE_DESKTOP_FILE_VALIDATE, test "x$DESKTOP_FILE_VALIDATE" != "xno")
2547
2548####################
2549# Set bug report URL
2550####################
2551
2552# Allowing third-party packagers to set their own bugtracker URL, in
2553# order to filter first packaging bugs from core bugs.
2554
2555AC_ARG_WITH(bug-report-url,
2556            [  --with-bug-report-url   URL used by the debug dialog to report bugs],,
2557            [with_bug_report_url="$PACKAGE_BUGREPORT"])
2558
2559if test "x$with_bug_report_url" = "x"; then
2560  with_bug_report_url="$PACKAGE_BUGREPORT"
2561fi
2562
2563BUG_REPORT_URL="$with_bug_report_url"
2564AC_DEFINE_UNQUOTED(BUG_REPORT_URL, "$with_bug_report_url",
2565                   [The URL to open in order to report bugs])
2566AC_SUBST(BUG_REPORT_URL)
2567
2568override_bug_report_url=
2569if test "x$with_bug_report_url" = "x$PACKAGE_BUGREPORT"; then
2570override_bug_report_url="
2571NOTE: if you plan on packaging GIMP for distribution, it is recommended
2572      to override the bug report URL with option:
2573        --with-bug-report-url=https://example.com/
2574      so that you can filter packaging bugs from core bugs before
2575      reporting upstream.
2576"
2577fi
2578
2579#####################
2580# Build identifiers #
2581#####################
2582
2583AC_ARG_WITH(build-id,
2584            [  --with-build-id   A unique string used to define your build],,
2585            [with_build_id="unknown"])
2586AC_DEFINE_UNQUOTED(GIMP_BUILD_ID, "$with_build_id",
2587                   [The string defining the build])
2588
2589AC_ARG_WITH(revision,
2590            [  --with-revision   Revision increment for a package],,
2591            [with_revision="0"])
2592GIMP_PACKAGE_REVISION=$with_revision
2593AC_SUBST(GIMP_PACKAGE_REVISION)
2594
2595AC_ARG_ENABLE(check-update,
2596              [  --enable-check-update
2597                          GIMP will not look up new version availability on startup (default=auto)],,
2598              enable_check_update=auto)
2599if test "x$enable_check_update" != xno &&
2600   test "x$enable_check_update" != xyes; then
2601  if test "x$platform_osx" = "xyes" ||
2602     test "x$platform_win32" = "xyes"; then
2603     enable_check_update=yes
2604  else
2605     enable_check_update=no
2606  fi
2607fi
2608if test "x$enable_check_update" = xyes; then
2609  AC_DEFINE(CHECK_UPDATE, 1,
2610              [Define to 1 if automatic update check is enabled])
2611fi
2612
2613AC_DEFINE_UNQUOTED(GIMP_BUILD_PLATFORM, "$host_os",
2614                   [The OS this was built for])
2615if test "x$platform_linux" = xyes; then
2616  platform_family="linux"
2617elif test "x$platform_win32" = xyes; then
2618  platform_family="windows"
2619elif test "x$platform_osx" = xyes; then
2620  platform_family="macos"
2621else
2622  platform_family="other"
2623fi
2624AC_DEFINE_UNQUOTED(GIMP_BUILD_PLATFORM_FAMILY, "$platform_family",
2625                   [The OS family this was built for])
2626
2627#########################
2628# Default ICC directory #
2629#########################
2630
2631# This is necessary because some Unix systems may have a different
2632# standard path for color profiles. And in particular, sandbox builds
2633# might mount the host system at a different root. This is for
2634# instance the case of flatpak which mount the host root at /run/host/.
2635if test "x$platform_osx" = "xno" &&
2636   test "x$platform_win32" = "xno"; then
2637  AC_MSG_CHECKING([default directory for color profiles])
2638  AC_ARG_WITH(icc-directory,
2639              [  --with-icc-directory    Path to default color profiles for this system],,
2640              [with_icc_directory="/usr/share/color/icc"])
2641
2642  if test "x$with_icc_directory" = "x"; then
2643    with_icc_directory="/usr/share/color/icc"
2644  fi
2645
2646  AC_DEFINE_UNQUOTED(COLOR_PROFILE_DIRECTORY,
2647                     "$with_icc_directory",
2648                     [The path to default color profiles for this system])
2649  AC_MSG_RESULT([$with_icc_directory])
2650fi
2651
2652######################################
2653# Checks for gtk-doc and docbook-tools
2654######################################
2655
2656# Check for GTK_DOC_CHECK availability. The GTK_DOC_CHECK invocation
2657# must be on its own line, gtkdocize relies on it
2658m4_ifdef([GTK_DOC_CHECK], [
2659GTK_DOC_CHECK([1.0])
2660])
2661
2662# NOTE: We need to use a separate automake conditional for this
2663#       to make this work with the tarballs.
2664AM_CONDITIONAL(ENABLE_GTK_DOC, test "x$enable_gtk_doc" = xyes)
2665
2666AC_ARG_ENABLE(gtk-doc-app, [  --enable-gtk-doc-app    build developer documentation for app (default=no)], , enable_gtk_doc_app=no)
2667AM_CONDITIONAL(ENABLE_GTK_DOC_APP, test "x$enable_gtk_doc_app" = xyes)
2668
2669
2670#############################
2671# Check for Windows installer
2672#############################
2673
2674AC_MSG_CHECKING([if building the Windows installer])
2675AC_ARG_ENABLE(windows-installer,
2676              [  --enable-windows-installer
2677                          generate files needed for the Windows installer
2678                          (default=no)],,
2679              enable_windows_installer=no)
2680
2681if test "x$enable_windows_installer" != xno; then
2682  if test ! -e "$srcdir/build/windows/installer/lang/setup.isl.in"; then
2683    AC_MSG_RESULT([no (not building from git)])
2684    AC_MSG_ERROR([Building the Windows installer is only supported when building from git.])
2685  fi
2686fi
2687
2688AC_MSG_RESULT([$enable_windows_installer])
2689AM_CONDITIONAL(BUILD_WINDOWS_INSTALLER, test "x$enable_windows_installer" != xno)
2690
2691
2692#########################################
2693# Allow to configure the GIMP environment
2694#########################################
2695
2696AC_ARG_ENABLE(default-binary, [  --enable-default-binary install this as the default gimp binary (default=gimp_stable)], , enable_default_binary=gimp_stable)
2697
2698AM_CONDITIONAL(DEFAULT_BINARY, test "x$enable_default_binary" = xyes)
2699
2700
2701AC_ARG_ENABLE(gimp-console, [  --enable-gimp-console   build a console-only binary which does not link GTK+], , enable_gimp_console=yes)
2702
2703AM_CONDITIONAL(ENABLE_GIMP_CONSOLE, test "x$enable_gimp_console" != xno)
2704
2705
2706# Possibly change default gimpdir from $XDG_CONFIG_HOME/GIMP/gimp_user_version
2707gimpdir=GIMP
2708AC_ARG_WITH(gimpdir, [  --with-gimpdir=DIR      change default gimpdir from $XDG_CONFIG_HOME/GIMP/gimp_user_version to $XDG_CONFIG_HOME/DIR/gimp_user_version, or to DIR if DIR is an absolute path],
2709if eval "test x$with_gimpdir != x"; then
2710  if eval "test x$with_gimpdir != xyes"; then
2711    gimpdir=$with_gimpdir
2712  fi
2713fi)
2714
2715# Build the gimpdir to be used in manpages here, because the manpage
2716# source is unreadable enough already
2717case "$gimpdir" in
2718  /*)
2719    manpage_gimpdir="$gimpdir"
2720    ;;
2721  *)
2722    manpage_gimpdir="\\fB\$XDG_CONFIG_HOME\\fP/$gimpdir/gimp_user_version"
2723    ;;
2724esac
2725
2726gimpdatadir="$datadir/$PACKAGE/gimp_data_version"
2727gimpplugindir="$libdir/$PACKAGE/gimp_plugin_version"
2728gimpsysconfdir="$sysconfdir/$PACKAGE/gimp_sysconf_version"
2729
2730AC_SUBST(gimpdir)
2731AC_SUBST(manpage_gimpdir)
2732AC_SUBST(gimpdatadir)
2733AC_SUBST(gimpplugindir)
2734AC_SUBST(gimpsysconfdir)
2735
2736
2737# GNU format message catalogs go into $datadir/locale,
2738# standard location is $libdir/locale. DATADIRNAME set accordingly.
2739
2740gimplocaledir="$datadir/locale"
2741if test "$DATADIRNAME" = "lib"; then
2742   gimplocaledir="$libdir/locale"
2743fi
2744
2745AC_SUBST(gimplocaledir)
2746
2747
2748############################
2749# Some defines for the build
2750############################
2751
2752AM_CONDITIONAL(STATICLIBS, test "x$enable_static" = xyes)
2753
2754# a tuned version of glib-mkenums
2755GIMP_MKENUMS="\$(PERL) \$(top_srcdir)/tools/gimp-mkenums"
2756AC_SUBST(GIMP_MKENUMS)
2757
2758#Add required trailing ; to list
2759MIME_TYPES="$MIME_TYPES;"
2760
2761AC_SUBST(MIME_TYPES)
2762
2763
2764#########################
2765# Disable deprecated APIs
2766#########################
2767
2768CPPFLAGS="${CPPFLAGS} -DGIMP_DISABLE_DEPRECATED -DBABL_DISABLE_DEPRECATED -DGSEAL_ENABLE"
2769
2770# Make sure not to disable deprecated APIs for unreleased versions.
2771# We must build without problems with future releases of libraries
2772# and disabling deprecated API risks breaking the build
2773
2774if test "x$have_glib_2_57" != "xyes"; then
2775  CPPFLAGS="${CPPFLAGS} -DG_DISABLE_DEPRECATED"
2776fi
2777
2778if test "x$have_gtk_2_26" != "xyes"; then
2779  CPPFLAGS="${CPPFLAGS} -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
2780fi
2781
2782if test "x$have_pango_1_32" != "xyes"; then
2783  CPPFLAGS="${CPPFLAGS} -DPANGO_DISABLE_DEPRECATED"
2784fi
2785
2786
2787############################
2788# Require multihead safe API
2789############################
2790
2791CPPFLAGS="${CPPFLAGS} -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE"
2792
2793
2794##################
2795# configure output
2796##################
2797
2798# easy way to skip the plug-in build
2799GIMP_PLUGINS=plug-ins
2800GIMP_MODULES=modules
2801AC_SUBST(GIMP_PLUGINS)
2802AC_SUBST(GIMP_MODULES)
2803
2804AC_CONFIG_COMMANDS([libgimpbase/gimpversion.h], [
2805  outfile=gimpversion.h-tmp
2806  cat > $outfile <<\_______EOF
2807/* gimpversion.h
2808 *
2809 * This is a generated file.  Please modify 'configure.ac'
2810 */
2811
2812#if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
2813#error "Only <libgimpbase/gimpbase.h> can be included directly."
2814#endif
2815
2816#ifndef __GIMP_VERSION_H__
2817#define __GIMP_VERSION_H__
2818
2819G_BEGIN_DECLS
2820
2821
2822/**
2823 * SECTION: gimpversion
2824 * @title: gimpversion
2825 * @short_description: Macros and constants useful for determining
2826 *                     GIMP's version number and capabilities.
2827 *
2828 * Macros and constants useful for determining GIMP's version number and
2829 * capabilities.
2830 **/
2831
2832_______EOF
2833
2834  cat >>$outfile <<_______EOF
2835/**
2836 * GIMP_MAJOR_VERSION:
2837 *
2838 * The major GIMP version number.
2839 **/
2840#define GIMP_MAJOR_VERSION                              ($gimp_major_ver)
2841
2842/**
2843 * GIMP_MINOR_VERSION:
2844 *
2845 * The minor GIMP version number.
2846 **/
2847#define GIMP_MINOR_VERSION                              ($gimp_minor_ver)
2848
2849/**
2850 * GIMP_MICRO_VERSION:
2851 *
2852 * The micro GIMP version number.
2853 **/
2854#define GIMP_MICRO_VERSION                              ($gimp_micro_ver)
2855
2856/**
2857 * GIMP_VERSION:
2858 *
2859 * The GIMP version as a string.
2860 **/
2861#define GIMP_VERSION                                    "$gimp_ver"
2862
2863/**
2864 * GIMP_API_VERSION:
2865 *
2866 * Since: 2.2
2867 **/
2868#define GIMP_API_VERSION                                "$gimp_api_ver"
2869
2870_______EOF
2871
2872  cat >>$outfile <<\_______EOF
2873#define GIMP_CHECK_VERSION(major, minor, micro) \
2874    (GIMP_MAJOR_VERSION > (major) || \
2875     (GIMP_MAJOR_VERSION == (major) && GIMP_MINOR_VERSION > (minor)) || \
2876     (GIMP_MAJOR_VERSION == (major) && GIMP_MINOR_VERSION == (minor) && \
2877      GIMP_MICRO_VERSION >= (micro)))
2878
2879
2880G_END_DECLS
2881
2882#endif /* __GIMP_VERSION_H__ */
2883_______EOF
2884
2885  if cmp -s $outfile libgimpbase/gimpversion.h; then
2886    AC_MSG_NOTICE([libgimpbase/gimpversion.h is unchanged])
2887    rm -f $outfile
2888  else
2889    mv $outfile libgimpbase/gimpversion.h
2890  fi
2891],[
2892  gimp_major_ver=gimp_major_version
2893  gimp_minor_ver=gimp_minor_version
2894  gimp_micro_ver=gimp_micro_version
2895  gimp_ver=gimp_version
2896  gimp_api_ver=gimp_api_version
2897])
2898
2899AC_CONFIG_FILES([
2900INSTALL
2901tools/Makefile
2902pdb/Makefile
2903libgimp/Makefile
2904libgimpbase/Makefile
2905libgimpconfig/Makefile
2906libgimpcolor/Makefile
2907libgimpmath/Makefile
2908libgimpmodule/Makefile
2909libgimpthumb/Makefile
2910libgimpwidgets/Makefile
2911app/Makefile
2912app/actions/Makefile
2913app/config/Makefile
2914app/core/Makefile
2915app/operations/Makefile
2916app/operations/layer-modes/Makefile
2917app/operations/layer-modes-legacy/Makefile
2918app/operations/tests/Makefile
2919app/gegl/Makefile
2920app/dialogs/Makefile
2921app/display/Makefile
2922app/file/Makefile
2923app/file-data/Makefile
2924app/gui/Makefile
2925app/menus/Makefile
2926app/paint/Makefile
2927app/pdb/Makefile
2928app/plug-in/Makefile
2929app/propgui/Makefile
2930app/text/Makefile
2931app/tools/Makefile
2932app/vectors/Makefile
2933app/widgets/Makefile
2934app/xcf/Makefile
2935app/tests/Makefile
2936app/tests/files/Makefile
2937app/tests/gimpdir-empty/Makefile
2938app/tests/gimpdir-empty/brushes/Makefile
2939app/tests/gimpdir-empty/gradients/Makefile
2940app/tests/gimpdir-empty/patterns/Makefile
2941app/tests/gimpdir/Makefile
2942app/tests/gimpdir/brushes/Makefile
2943app/tests/gimpdir/gradients/Makefile
2944app/tests/gimpdir/patterns/Makefile
2945app-tools/Makefile
2946build/Makefile
2947build/windows/Makefile
2948build/windows/gimp.rc
2949build/windows/gimp-plug-ins.rc
2950build/windows/installer/Makefile
2951build/windows/installer/lang/Makefile
2952plug-ins/Makefile
2953plug-ins/file-bmp/Makefile
2954plug-ins/file-dds/Makefile
2955plug-ins/file-exr/Makefile
2956plug-ins/file-faxg3/Makefile
2957plug-ins/file-fits/Makefile
2958plug-ins/file-fli/Makefile
2959plug-ins/file-ico/Makefile
2960plug-ins/file-jpeg/Makefile
2961plug-ins/file-psd/Makefile
2962plug-ins/file-raw/Makefile
2963plug-ins/file-sgi/Makefile
2964plug-ins/file-tiff/Makefile
2965plug-ins/file-webp/Makefile
2966plug-ins/flame/Makefile
2967plug-ins/fractal-explorer/Makefile
2968plug-ins/fractal-explorer/examples/Makefile
2969plug-ins/gfig/Makefile
2970plug-ins/gfig/gfig-examples/Makefile
2971plug-ins/gfig/images/Makefile
2972plug-ins/ui/Makefile
2973plug-ins/gimpressionist/Brushes/Makefile
2974plug-ins/gimpressionist/Makefile
2975plug-ins/gimpressionist/Paper/Makefile
2976plug-ins/gimpressionist/Presets/Makefile
2977plug-ins/gradient-flare/Makefile
2978plug-ins/gradient-flare/flares/Makefile
2979plug-ins/help-browser/Makefile
2980plug-ins/help/Makefile
2981plug-ins/ifs-compose/Makefile
2982plug-ins/imagemap/Makefile
2983plug-ins/imagemap/images/Makefile
2984plug-ins/lighting/Makefile
2985plug-ins/lighting/images/Makefile
2986plug-ins/map-object/Makefile
2987plug-ins/metadata/Makefile
2988plug-ins/pagecurl/Makefile
2989plug-ins/print/Makefile
2990plug-ins/pygimp/Makefile
2991plug-ins/pygimp/plug-ins/Makefile
2992plug-ins/screenshot/Makefile
2993plug-ins/script-fu/Makefile
2994plug-ins/script-fu/ftx/Makefile
2995plug-ins/script-fu/scripts/Makefile
2996plug-ins/script-fu/scripts/images/Makefile
2997plug-ins/script-fu/tinyscheme/Makefile
2998plug-ins/selection-to-path/Makefile
2999plug-ins/twain/Makefile
3000plug-ins/common/Makefile
3001modules/Makefile
3002devel-docs/Makefile
3003devel-docs/app/Makefile
3004devel-docs/app/version
3005devel-docs/libgimp/Makefile
3006devel-docs/libgimp/version
3007devel-docs/libgimpbase/Makefile
3008devel-docs/libgimpbase/version
3009devel-docs/libgimpconfig/Makefile
3010devel-docs/libgimpconfig/version
3011devel-docs/libgimpcolor/Makefile
3012devel-docs/libgimpcolor/version
3013devel-docs/libgimpmath/Makefile
3014devel-docs/libgimpmath/version
3015devel-docs/libgimpmodule/Makefile
3016devel-docs/libgimpmodule/version
3017devel-docs/libgimpthumb/Makefile
3018devel-docs/libgimpthumb/version
3019devel-docs/libgimpwidgets/Makefile
3020devel-docs/libgimpwidgets/version
3021devel-docs/performance-logs/Makefile
3022devel-docs/tools/Makefile
3023docs/Makefile
3024menus/Makefile
3025cursors/Makefile
3026icons/Makefile
3027icons/hicolor/Makefile
3028icons/Color/Makefile
3029icons/Legacy/Makefile
3030icons/Symbolic/Makefile
3031icons/Symbolic-High-Contrast/Makefile
3032icons/Symbolic-Inverted/Makefile
3033icons/Symbolic-Inverted-High-Contrast/Makefile
3034themes/Makefile
3035themes/System/Makefile
3036themes/Dark/Makefile
3037themes/Gray/Makefile
3038themes/Light/Makefile
3039data/Makefile
3040data/brushes/Makefile
3041data/brushes/Basic/Makefile
3042data/brushes/Fun/Makefile
3043data/brushes/gimp-obsolete-files/Makefile
3044data/brushes/Media/Makefile
3045data/brushes/Legacy/Makefile
3046data/brushes/Sketch/Makefile
3047data/brushes/Splatters/Makefile
3048data/brushes/Texture/Makefile
3049data/dynamics/Makefile
3050data/dynamics/Basic/Makefile
3051data/dynamics/FX/Makefile
3052data/environ/Makefile
3053data/gradients/Makefile
3054data/images/Makefile
3055data/interpreters/Makefile
3056data/palettes/Makefile
3057data/patterns/Makefile
3058data/patterns/Animal/Makefile
3059data/patterns/Fabric/Makefile
3060data/patterns/Food/Makefile
3061data/patterns/Legacy/Makefile
3062data/patterns/Paper/Makefile
3063data/patterns/Plant/Makefile
3064data/patterns/Sky/Makefile
3065data/patterns/Stone/Makefile
3066data/patterns/Water/Makefile
3067data/patterns/Wood/Makefile
3068data/tags/Makefile
3069data/tips/Makefile
3070data/tool-presets/Makefile
3071data/tool-presets/Crop/Makefile
3072data/tool-presets/FX/Makefile
3073data/tool-presets/Paint/Makefile
3074data/tool-presets/Selection/Makefile
3075data/tool-presets/Sketch/Makefile
3076desktop/Makefile
3077desktop/gimp-data-extras.metainfo.xml.in
3078desktop/gimp.desktop.in
3079desktop/org.gimp.GIMP.appdata.xml.in
3080desktop/test-appdata.sh
3081etc/Makefile
3082etc/gimprc
3083m4macros/Makefile
3084po/Makefile.in
3085po-libgimp/Makefile.in
3086po-plug-ins/Makefile.in
3087po-python/Makefile.in
3088po-script-fu/Makefile.in
3089po-tips/Makefile.in
3090po-windows-installer/Makefile.in
3091gimp-zip
3092Makefile
3093])
3094
3095# Files with versions in their names
3096AC_CONFIG_FILES(
3097docs/gimp-gimp_app_version.1:docs/gimp.1.in
3098docs/gimprc-gimp_app_version.5:docs/gimprc.5.in
3099docs/gimptool-gimp_tool_version.1:docs/gimptool.1.in
3100gimp-gimp_pkgconfig_version.pc:gimp.pc.in
3101gimpthumb-gimp_pkgconfig_version.pc:gimpthumb.pc.in
3102gimpui-gimp_pkgconfig_version.pc:gimpui.pc.in
3103)
3104
3105# By default, autoconf will create only po/Makefile.
3106# This code is used to create the POTFILES and Makefile for all
3107# additional gettext catalogs.
3108m4_define([generate_po_makefile], [
3109  AC_MSG_NOTICE([Generating POTFILES and Makefile for $1])
3110
3111  AC_CONFIG_COMMANDS([$1/stamp-it],
3112  [[
3113    if  ! grep "^# INTLTOOL_MAKEFILE$" "$1/Makefile.in" > /dev/null ; then
3114       as_fn_error $? "$1/Makefile.in.in was not created by intltoolize." "$LINENO" 5
3115    fi
3116    rm -f "$1/stamp-it" "$1/POTFILES"
3117    sed -e '/^#/d' -e 's/^[[].*] *//' \
3118        -e '/^[ 	]*$/d'        \
3119        -e "s|^|	$ac_top_srcdir/|" \
3120        "$srcdir/$1/POTFILES.in" | sed '$!s/$/ \\/' >"$1/POTFILES" && \
3121    sed -e "/^# This comment gets stripped out/ {"  \
3122        -e 'r $1/POTFILES'                          \
3123        -e "d" -e "}"                               \
3124        "$1/Makefile.in" >"$1/Makefile" && \
3125    touch "$1/stamp-it"
3126  ]])
3127])
3128
3129generate_po_makefile([po-libgimp])
3130generate_po_makefile([po-python])
3131generate_po_makefile([po-plug-ins])
3132generate_po_makefile([po-script-fu])
3133generate_po_makefile([po-tips])
3134generate_po_makefile([po-windows-installer])
3135
3136# Print a summary of features enabled/disabled:
3137optional_deps="
3138Extra Binaries:
3139  gimp-console:              $enable_gimp_console
3140
3141Optional Features:
3142  Check updates at startup:  $enable_check_update
3143  Levin matting engine:      $have_matting_levin
3144  Language selection:        $have_iso_codes
3145  Vector icons:              $enable_vector_icons
3146  Dr. Mingw (Win32):         $enable_drmingw
3147  Relocatable bundle:        $enable_relocatable_bundle
3148  Default ICC directory:     $with_icc_directory
3149  Debug console (Win32):     $enable_win32_debug_console
3150  32-bit DLL folder (Win32): $with_win32_32bit_dll_folder
3151  Detailed backtraces:       $detailed_backtraces
3152
3153Optional Plug-Ins:
3154  Ascii Art:                 $have_libaa
3155  Ghostscript:               $have_gs
3156  Help Browser:              $have_webkit
3157  JPEG 2000:                 $have_openjpeg
3158  MNG:                       $have_libmng
3159  OpenEXR:                   $have_openexr
3160  WebP:                      $have_webp
3161  HEIC:                      import: $can_import_heic - export: $can_export_heic [[profile support: $have_heif_profile_support]]
3162  AVIF:                      import: $can_import_avif - export: $can_export_avif
3163  PDF (export):              $have_cairo_pdf
3164  Print:                     $enable_print
3165  Python 2:                  $enable_python
3166  TWAIN (Win32):             $os_win32
3167  Webpage:                   $have_webkit
3168  WMF:                       $have_libwmf
3169  X11 Mouse Cursor:          $have_xmc
3170  XPM:                       $have_libxpm
3171  Email:                     $have_email
3172
3173Optional Modules:
3174  ALSA (MIDI Input):         $have_alsa
3175  Linux Input:               $have_linux_input (GUdev support: $have_libgudev)
3176  DirectInput (Win32):       $have_dx_dinput
3177
3178Tests:
3179  Use xvfb-run               $have_xvfb_run
3180  Test appdata               $have_appstream_util
3181  Test desktop file          $have_desktop_file_validate
3182
3183Bug report URL: $with_bug_report_url
3184$override_bug_report_url$warning_vector_icons_windows$warning_glib_networking$warning_gcc$warning_libheif$warning_libmypaint"
3185
3186if test "x$required_deps" = "x"; then
3187  AC_OUTPUT
3188  AC_MSG_RESULT([
3189Building GIMP with prefix=$prefix, datarootdir=$datarootdir
3190Desktop files install into $DESKTOP_DATADIR
3191$optional_deps]);
3192else
3193  AC_MSG_ERROR([
3194$optional_deps
3195
3196Error: GIMP configuration failed.
3197$required_deps
3198
3199See the file 'INSTALL' for more help.]);
3200fi
3201