Configure: Add an error message when using deprecated "--with-defsdatadir"
[wmaker-crm.git] / configure.ac
blob4b6a340922a857761ea9262b562a58b85b3ea7d2
1 dnl ============================================================================
2 dnl
3 dnl Window Maker autoconf input
4 dnl
5 AC_COPYRIGHT([Copyright (c) 2001-2015 The Window Maker Team])
6 dnl
7 dnl ============================================================================
8 dnl
9 dnl This program is free software; you can redistribute it and/or modify
10 dnl it under the terms of the GNU General Public License as published by
11 dnl the Free Software Foundation; either version 2 of the License, or
12 dnl (at your option) any later version.
13 dnl
14 dnl This program is distributed in the hope that it will be useful,
15 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
16 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 dnl GNU General Public License for more details.
18 dnl
19 dnl You should have received a copy of the GNU General Public License along
20 dnl with this program; see the file COPYING.
21 dnl
22 dnl ============================================================================
23 dnl
24 dnl Process with: ./autogen.sh
27 dnl Due to a bug in Autoconf 2.68 (apparently a regression), we need at least
28 dnl version 2.68b which includes this patch:
29 dnl   http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commit;h=2b0d95faef68d7ed7c08b0edb9ff1c38728376fa
30 dnl
31 dnl Because the 2.69 was released only a few month later, let's just ask for it
32 AC_PREREQ([2.69])
35 dnl Configuration for Autoconf and Automake
36 dnl =======================================
37 AC_INIT([WindowMaker],[0.95.9],[wmaker-dev@googlegroups.com],[WindowMaker],[http://www.windowmaker.org/])
38 AC_CONFIG_MACRO_DIR([m4])
39 AC_CONFIG_HEADERS([config.h])
41 dnl We need the EXTRA_xxx_DEPENDENCIES keyword in Makefiles which have been
42 dnl introduced in the version 1.11.3; because the 1.12 was realeased shortly
43 dnl after, we just ask for it
44 AM_INIT_AUTOMAKE([1.12 silent-rules -Wno-portability])
46 dnl Reference file used by 'configure' to make sure the path to sources is valid
47 AC_CONFIG_SRCDIR([src/WindowMaker.h])
49 dnl Include at the end of 'config.h', this file is generated by top-level Makefile
50 AH_BOTTOM([@%:@include "config-paths.h"])
53 dnl libtool library versioning
54 dnl ==========================
55 dnl
56 dnl current
57 dnl revision
58 dnl age
59 dnl
60 dnl 1. Start with version information of ‘0:0:0’ for each libtool library.
61 dnl 2. Update the version information only immediately before a public
62 dnl release of your software. More frequent updates are unnecessary, and
63 dnl only guarantee that the current interface number gets larger faster.
64 dnl 3. If the library source code has changed at all since the last
65 dnl update, then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
66 dnl 4. If any interfaces have been added, removed, or changed since the
67 dnl last update, increment current, and set revision to 0.
68 dnl 5. If any interfaces have been added since the last public release,
69 dnl then increment age.
70 dnl 6. If any interfaces have been removed or changed since the last
71 dnl public release, then set age to 0.
72 dnl
73 dnl libwraster
74 WRASTER_CURRENT=6
75 WRASTER_REVISION=0
76 WRASTER_AGE=0
77 WRASTER_VERSION=$WRASTER_CURRENT:$WRASTER_REVISION:$WRASTER_AGE
78 AC_SUBST(WRASTER_VERSION)
79 dnl
80 dnl libWINGs
81 WINGS_CURRENT=4
82 WINGS_REVISION=0
83 WINGS_AGE=1
84 WINGS_VERSION=$WINGS_CURRENT:$WINGS_REVISION:$WINGS_AGE
85 AC_SUBST(WINGS_VERSION)
86 dnl
87 dnl libWUtil
88 WUTIL_CURRENT=5
89 WUTIL_REVISION=0
90 WUTIL_AGE=0
91 WUTIL_VERSION=$WUTIL_CURRENT:$WUTIL_REVISION:$WUTIL_AGE
92 AC_SUBST(WUTIL_VERSION)
95 dnl Checks for programs
96 dnl ===================
97 AC_PROG_CC
98 WM_PROG_CC_C11
99 AC_PROG_LN_S
100 AC_PROG_GCC_TRADITIONAL
101 LT_INIT
104 dnl Debugging Options
105 dnl =================
106 AC_ARG_ENABLE([debug],
107     [AS_HELP_STRING([--enable-debug], [enable debugging options, @<:@default=no@:>@])],
108     [AS_CASE(["$enableval"],
109         [yes], [debug=yes],
110         [no],  [debug=no],
111         [AC_MSG_ERROR([bad value $enableval for --enable-debug])] )],
112     [debug=no])
113 AS_IF([test "x$debug" = "xyes"],
114     [dnl This flag should have already been detected and added, but if user
115      dnl provided an explicit CFLAGS it may not be the case
116      AS_IF([echo " $CFLAGS " | grep " -g " 2>&1 > /dev/null],
117            [@%:@ Debug symbol already activated],
118            [AX_CFLAGS_GCC_OPTION([-g])])
119      dnl
120      dnl This flag generally makes debugging nightmarish, remove it if present
121      CFLAGS="`echo "$CFLAGS" | sed -e 's/-fomit-frame-pointer *//' `"
122      dnl
123      dnl Enable internal debug code
124      CPPFLAGS="$CPPFLAGS -DDEBUG"
125 ],  [dnl
126      dnl When debug is not enabled, the user probably does not wants to keep
127      dnl assertions in the final program
128      CPPFLAGS="$CPPFLAGS -DNDEBUG"
132 AX_CFLAGS_GCC_OPTION([-Wall])
133 AX_CFLAGS_GCC_OPTION([-Wextra -Wno-sign-compare])
135 dnl The use of trampolines cause code that can crash on some secured OS, it is
136 dnl also known to be a source of crash if not used properly, in a more general
137 dnl way it tends to generate binary code that may not be optimal, and it is
138 dnl not compatible with the 'nested-func-to-macro' workaround
139 WM_CFLAGS_CHECK_FIRST([-Wtrampolines],
140          [-Werror=trampolines  dnl try to generate an error if possible
141           -Wtrampolines        dnl if not, try to fall back to a simple warning
142          ])
144 AS_IF([test "x$debug" = "xyes"],
145     [dnl When debug is enabled, we try to activate more checks from
146      dnl the compiler. They are on independant check because the
147      dnl macro checks all the options at once, but we may have cases
148      dnl where some options are not supported and we don't want to
149      dnl loose all of them.
150      dnl
151      dnl clang, suggest parenthesis on bit operations that could be
152      dnl misunderstood due to C operator precedence
153      AX_CFLAGS_GCC_OPTION([-Wbitwise-op-parentheses])
154      dnl
155      dnl Points at code that gcc thinks is so complicated that gcc
156      dnl gives up trying to optimize, which probably also means it is
157      dnl too complicated to maintain
158      AX_CFLAGS_GCC_OPTION([-Wdisabled-optimization])
159      dnl
160      dnl Because of C's type promotion, the compiler has to generate
161      dnl less optimal code when a double constant is used in a
162      dnl float expression
163      AX_CFLAGS_GCC_OPTION([-Wdouble-promotion])
164      dnl
165      dnl Floating-point comparison is not a good idea
166      AX_CFLAGS_GCC_OPTION([-Wfloat-equal])
167      dnl
168      dnl clang warns about constants that may have portability issues due
169      dnl to the endianness of the host
170      AX_CFLAGS_GCC_OPTION([-Wfour-char-constants])
171      dnl
172      dnl clang warns about constant that may be too big to be portable
173      AX_CFLAGS_GCC_OPTION([-Wliteral-range])
174      dnl
175      dnl Try to report misuses of '&' versus '&&' and similar
176      AX_CFLAGS_GCC_OPTION([-Wlogical-op])
177      dnl
178      dnl clang, reports cases where the code assumes everyone is an
179      dnl expert in C operator precedence... which is unlikely!
180      AX_CFLAGS_GCC_OPTION([-Wlogical-op-parentheses])
181      dnl
182      dnl Reports declaration of global things that are done inside
183      dnl a local environment, instead of using the appropriate
184      dnl header
185      AX_CFLAGS_GCC_OPTION([-Wnested-externs])
186      dnl
187      dnl Warn about constant strings that could pose portability issues
188      AX_CFLAGS_GCC_OPTION([-Woverlength-strings])
189      dnl
190      dnl Use of 'sizeof()' on inappropriate pointer types
191      AX_CFLAGS_GCC_OPTION([-Wpointer-arith])
192      dnl
193      dnl Having more than 1 prototype for a function makes code updates
194      dnl more difficult, so try to avoid it
195      AX_CFLAGS_GCC_OPTION([-Wredundant-decls])
196      dnl
197      dnl clang, detect some misuses of sizeof. We also count in our code
198      dnl on the use of the macro 'wlength' which contains a check if the
199      dnl compiler support C11's static_assert
200      AX_CFLAGS_GCC_OPTION([-Wsizeof-array-argument])
201      dnl
202      dnl Prototype of function must be explicit, no deprecated K&R syntax
203      dnl and no empty argument list which prevents compiler from doing
204      dnl type checking when using the function
205      WM_CFLAGS_GCC_OPTION_STRICTPROTO
206      dnl
207      dnl Proper attributes helps the compiler to produce better code
208      WM_CFLAGS_CHECK_FIRST([format attribute suggest],
209          [-Wsuggest-attribute=format  dnl new gcc syntax
210           -Wmissing-format-attribute  dnl old gcc syntax, clang
211          ])
212      WM_CFLAGS_CHECK_FIRST([no-return attribute suggest],
213          [-Wsuggest-attribute=noreturn  dnl gcc syntax
214           -Wmissing-noreturn            dnl clang syntax
215          ])
216      dnl
217      dnl GCC provides a couple of checks to detect incorrect macro uses
218      AX_CFLAGS_GCC_OPTION([-Wundef])
219      WM_CFLAGS_GCC_OPTION_UNUSEDMACROS
220      dnl
221      dnl clang reports stuff marked unused but which is actually used
222      AX_CFLAGS_GCC_OPTION([-Wused-but-marked-unused])
223 ], [dnl
224      dnl When debug not enabled, we try to avoid some non-necessary
225      dnl messages from the compiler
226      dnl
227      dnl To support legacy X servers, we have sometime to use
228      dnl functions marked as deprecated. We do not wish our users
229      dnl to be worried about it
230      AX_CFLAGS_GCC_OPTION([-Wno-deprecated])
231      AX_CFLAGS_GCC_OPTION([-Wno-deprecated-declarations])
235 dnl To upload documentation to the Website
236 dnl ======================================
237 AC_ARG_WITH([web-repo],
238     [AS_HELP_STRING([--with-web-repo=PATH], [path to your git repository for the Web home page (maintainer stuff)])],
239     [AS_CASE([$withval],
240         [yes], [AC_MSG_ERROR([bad value '$withval' for --with-web-repo, expected a path]) ],
241         [no],  [WEB_REPO_ROOT=""],
242         [WEB_REPO_ROOT=$withval])],
243     [WEB_REPO_ROOT=""])
244 WM_CHECK_WEBREPODIR
247 dnl Support for Nested Functions by the compiler
248 dnl ============================================
249 WM_PROG_CC_NESTEDFUNC
252 dnl Posix thread
253 dnl ============
254 dnl they are used by util/wmiv
255 AX_PTHREAD
258 dnl Tracking on what is detected for final status
259 dnl =============================================
260 unsupported=""
261 supported_core=""
262 supported_xext=""
263 supported_gfx=""
266 dnl Platform-specific Makefile setup
267 dnl ================================
268 AS_CASE(["$host"],
269     [*-*-linux*|*-*-cygwin*|*-gnu*], [WM_OSDEP="linux" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"],
270     [*-*-freebsd*|*-k*bsd-gnu*],     [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -DFREEBSD"],
271     [*-*-netbsd*],                   [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DNETBSD"],
272     [*-*-openbsd*],                  [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DOPENBSD"],
273     [*-*-dragonfly*],                [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DDRAGONFLYBSD"],
274     [*-apple-darwin*],               [WM_OSDEP="darwin"],
275     [*-*-solaris*],                  [WM_OSDEP="stub"],  dnl  solaris.c when done
276     [WM_OSDEP="stub"])
277 AM_CONDITIONAL([WM_OSDEP_LINUX],   [test "x$WM_OSDEP" = "xlinux"])
278 AM_CONDITIONAL([WM_OSDEP_BSD],     [test "x$WM_OSDEP" = "xbsd"])
279 AM_CONDITIONAL([WM_OSDEP_DARWIN],  [test "x$WM_OSDEP" = "xdarwin"])
280 AM_CONDITIONAL([WM_OSDEP_GENERIC], [test "x$WM_OSDEP" = "xstub"])
283 dnl the prefix
284 dnl ==========
286 dnl move this earlier in the script... anyone know why this is handled
287 dnl in such a bizarre way?
289 test "x$prefix" = xNONE && prefix=$ac_default_prefix
290 dnl Let make expand exec_prefix.
291 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
294 _bindir=`eval echo $bindir`
295 _bindir=`eval echo $_bindir`
296 _libdir=`eval echo $libdir`
297 _libdir=`eval echo $_libdir`
299 dnl ===============================================
300 dnl Specify paths to look for libraries and headers
301 dnl ===============================================
302 AC_ARG_WITH(libs-from, AS_HELP_STRING([--with-libs-from], [pass compiler flags to look for libraries]),
303         [lib_search_path="$withval"], [lib_search_path='-L${libdir}'])
305 AC_ARG_WITH(incs-from, AS_HELP_STRING([--with-incs-from], [pass compiler flags to look for header files]),
306         [inc_search_path="$withval"], [inc_search_path='-I${includedir}'])
309 dnl Features Configuration
310 dnl ======================
311 AC_ARG_ENABLE([animations],
312     [AS_HELP_STRING([--disable-animations], [disable permanently animations @<:@default=enabled@:>@])],
313     [AS_CASE(["$enableval"],
314         [yes|no], [],
315         [AC_MSG_ERROR([bad value $enableval for --enable-animations])])],
316     [enable_animations="yes"])
317 AS_IF([test "x$enable_animations" = "xno"],
318     [unsupported="$unsupported Animations"],
319     [AC_DEFINE([USE_ANIMATIONS], [1], [Defined when user did not request to disable animations])
320      supported_core="$supported_core Animations"])
323 AC_ARG_ENABLE([mwm-hints],
324     [AS_HELP_STRING([--disable-mwm-hints], [disable support for Motif WM hints @<:@default=enabled@:>@])],
325     [AS_CASE(["$enableval"],
326         [yes|no], [],
327         [AC_MSG_ERROR([bad value $enableval for --enable-mwm-hints])])],
328     [enable_mwm_hints="yes"])
329 AS_IF([test "x$enable_mwm_hints" = "xno"],
330     [unsupported="$unsupported MWMHints"],
331     [AC_DEFINE([USE_MWM_HINTS], [1], [Defined when used did not request to disable Motif WM hints])
332      supported_core="$supported_core MWMHints"])
333 AM_CONDITIONAL([USE_MWM_HINTS], [test "x$enable_mwm_hints" != "xno"])
336 dnl Boehm GC
337 dnl ========
338 AC_ARG_ENABLE([boehm-gc],
339     [AS_HELP_STRING([--enable-boehm-gc], [use Boehm GC instead of the default libc malloc() [default=no]])],
340     [AS_CASE(["$enableval"],
341         [yes], [with_boehm_gc=yes],
342         [no],  [with_boehm_gc=no],
343         [AC_MSG_ERROR([bad value $enableval for --enable-boehm-gc])] )],
344     [with_boehm_gc=no])
345 AS_IF([test "x$with_boehm_gc" = "xyes"],
346     AC_SEARCH_LIBS([GC_malloc], [gc],
347         [AC_DEFINE(USE_BOEHM_GC, 1, [Define if Boehm GC is to be used])],
348         [AC_MSG_FAILURE([--enable-boehm-gc specified but test for libgc failed])]))
351 dnl LCOV
352 dnl ====
353 AC_ARG_ENABLE([lcov],
354     [AS_HELP_STRING([--enable-lcov[=output-directory]], [enable coverage data generation using LCOV (GCC only) [default=no]])],
355     [],
356     [enable_lcov=no])
358 AS_IF([test "x$enable_lcov" != "xno"],
359     [AX_CFLAGS_GCC_OPTION(-fprofile-arcs -ftest-coverage)
360     AS_IF([test "x$enable_lcov" = "xyes"],
361         [lcov_output_directory="coverage-report"],
362         [lcov_output_directory="${enable_lcov}/coverage-report"])
363     AC_SUBST(lcov_output_directory)])
365 AM_CONDITIONAL([USE_LCOV], [test "x$enable_lcov" != "xno"])
368 dnl ============================
369 dnl Checks for library functions
370 dnl ============================
371 AC_FUNC_MEMCMP
372 AC_FUNC_VPRINTF
373 WM_FUNC_SECURE_GETENV
374 AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
375                setsid mallinfo mkstemp sysconf)
376 AC_SEARCH_LIBS([strerror], [cposix])
378 dnl nanosleep is generally available in standard libc, although not always the
379 dnl case. One known example is Solaris which needs -lrt
380 AC_SEARCH_LIBS([nanosleep], [rt], [],
381     [AC_MSG_ERROR([function 'nanosleep' not found, please report to wmaker-dev@googlegroups.com])])
383 dnl the flag 'O_NOFOLLOW' for 'open' is used in WINGs
384 WM_FUNC_OPEN_NOFOLLOW
387 dnl Check for strlcat/strlcpy
388 dnl =========================
389 AC_ARG_WITH([libbsd],
390   [AS_HELP_STRING([--without-libbsd], [do not use libbsd for strlcat and strlcpy [default=check]])],
391   [AS_IF([test "x$with_libbsd" != "xno"],
392     [with_libbsd=bsd]
393     [with_libbsd=]
394   )],
395   [with_libbsd=bsd])
397 tmp_libs=$LIBS
398 AC_SEARCH_LIBS([strlcat],[$with_libbsd],
399   [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available])],
400   [],
401   []
403 AC_SEARCH_LIBS([strlcpy],[$with_libbsd],
404   [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcpy is available])],
405   [],
406   []
408 LIBS=$tmp_libs
410 LIBBSD=
411 AS_IF([test "x$ac_cv_search_strlcat" = "x-lbsd" -o "x$ac_cv_search_strlcpy" = "x-lbsd"],
412   [LIBBSD=-lbsd
413    AC_CHECK_HEADERS([bsd/string.h])]
415 AC_SUBST(LIBBSD)
418 dnl Check for OpenBSD kernel memory interface - kvm(3)
419 dnl ==================================================
420 AS_IF([test "x$WM_OSDEP" = "xbsd"],
421   AC_SEARCH_LIBS([kvm_openfiles], [kvm]) )
424 dnl Check for inotify
425 dnl =================
426 dnl It is used by WindowMaker to reload automatically the configuration when the
427 dnl user changed it using WPref or wdwrite
428 AC_CHECK_HEADERS([sys/inotify.h],
429     [AC_DEFINE([HAVE_INOTIFY], [1], [Check for inotify])])
432 dnl Check for syslog
433 dnl ================
434 dnl It is used by WUtil to log the wwarning, werror and wfatal
435 AC_CHECK_HEADERS([syslog.h], [AC_DEFINE([HAVE_SYSLOG], [1], [Check for syslog])])
438 dnl Checks for header files
439 dnl =======================
440 AC_HEADER_SYS_WAIT
441 AC_HEADER_TIME
442 AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h libintl.h poll.h malloc.h ctype.h \
443                  string.h strings.h)
446 dnl Checks for typedefs, structures, and compiler characteristics
447 dnl =============================================================
448 AC_C_CONST
449 AC_C_INLINE
450 WM_C_NORETURN
451 AC_TYPE_SIZE_T
452 AC_TYPE_PID_T
453 WM_TYPE_SIGNAL
456 dnl pkg-config
457 dnl ==========
458 PKG_PROG_PKG_CONFIG
459 AS_IF([test -z "$PKG_CONFIG"],[AC_MSG_ERROR([pkg-config is required.])])
463 dnl Internationalization
464 dnl ====================
465 dnl Detect the language for translations to be installed and check
466 dnl that the gettext environment works
467 WM_I18N_LANGUAGES
468 WM_I18N_XGETTEXT
469 WM_I18N_MENUTEXTDOMAIN
470 WM_LIBRARY_CONSTRUCTORS
472 dnl ===========================================
473 dnl             Stuff that uses X
474 dnl ===========================================
476 AC_PATH_XTRA
478 AS_IF([test "x$no_x" = "xyes"],
479     [AC_MSG_ERROR([The path for the X11 files not found!
480 Make sure you have X and its headers and libraries (the -devel packages
481 in Linux) installed.])])
483 X_LIBRARY_PATH=$x_libraries
484 XCFLAGS="$X_CFLAGS"
485 XLFLAGS="$X_LIBS"
486 XLIBS="-lX11 $X_EXTRA_LIBS"
488 lib_search_path="$lib_search_path $XLFLAGS"
489 inc_search_path="$inc_search_path $XCFLAGS"
491 AC_SUBST(X_LIBRARY_PATH)
494 dnl Decide which locale function to use, setlocale() or _Xsetlocale()
495 dnl by MANOME Tomonori
496 dnl ===========================================
497 WM_I18N_XLOCALE
501 dnl Check whether XInternAtoms() exist
502 dnl ==================================
503 AC_CHECK_LIB([X11], [XInternAtoms],
504     [AC_DEFINE([HAVE_XINTERNATOMS], [1],
505         [define if your X server has XInternAtoms() (set by configure)])],
506     [], [$XLFLAGS $XLIBS])
509 dnl Check whether XConvertCase() exist
510 dnl ==================================
511 AC_CHECK_LIB([X11], [XConvertCase],
512     [AC_DEFINE([HAVE_XCONVERTCASE], [1],
513         [define if your X server has XConvertCase() (set by configure)])],
514     [], [$XLFLAGS $XLIBS])
517 dnl XKB keyboard language status
518 dnl ============================
519 AC_ARG_ENABLE([modelock],
520     [AS_HELP_STRING([--enable-modelock], [XKB keyboard language status support])],
521     [AS_CASE([$enableval],
522         [yes|no], [],
523         [AC_MSG_ERROR([bad value '$enableval' for --enable-modelock])])],
524     [enable_modelock=no])
525 AS_IF([test "x$enable_modelock" = "xyes"],
526     [AC_DEFINE([XKB_MODELOCK], [1], [whether XKB language MODELOCK should be enabled]) ])
529 dnl XDND Drag-nd-Drop support
530 dnl =========================
531 AC_ARG_ENABLE([xdnd],
532     [AS_HELP_STRING([--disable-xdnd], [disable support for Drag-and-Drop on the dock @<:@default=enabled@:>@])],
533     [AS_CASE(["$enableval"],
534         [yes|no], [],
535         [AC_MSG_ERROR([bad value $enableval for --disable-xdnd]) ]) ],
536     [enable_xdnd=yes])
537 AS_IF([test "x$enable_xdnd" = "xyes"],
538     [supported_core="$supported_core XDnD"
539      AC_DEFINE([USE_DOCK_XDND], [1], [whether Drag-and-Drop on the dock should be enabled])],
540     [unsupported="$unsupported XDnd"])
541 AM_CONDITIONAL([USE_DOCK_XDND], [test "x$enable_xdnd" != "xno"])
544 dnl Support for ICCCM 2.0 Window Manager replacement
545 dnl ================================================
546 AC_ARG_ENABLE([wmreplace],
547     [AS_HELP_STRING([--enable-wmreplace], [support for ICCCM window manager replacement])],
548     [AS_CASE([$enableval],
549         [yes|no], [],
550         [AC_MSG_ERROR([bad value '$enableval' for --enable-wmreplace])])],
551     [enable_wmreplace=no])
552 AS_IF([test "x$enable_wmreplace" = "xyes"],
553     [AC_DEFINE([USE_ICCCM_WMREPLACE], [1],
554        [define to support ICCCM protocol for window manager replacement])
555      supported_xext="$supported_xext WMReplace"])
558 dnl XShape support
559 dnl ==============
560 AC_ARG_ENABLE([shape],
561     [AS_HELP_STRING([--disable-shape], [disable shaped window extension support])],
562     [AS_CASE(["$enableval"],
563         [yes|no], [],
564         [AC_MSG_ERROR([bad value $enableval for --enable-shape]) ]) ],
565     [enable_shape=auto])
566 WM_XEXT_CHECK_XSHAPE
569 dnl MIT-SHM support
570 dnl ===============
571 AC_ARG_ENABLE([shm],
572     [AS_HELP_STRING([--disable-shm], [disable usage of MIT-SHM extension])],
573     [AS_CASE(["$enableval"],
574         [yes|no], [],
575         [AC_MSG_ERROR([bad value $enableval for --enable-shm]) ]) ],
576     [enable_shm=auto])
577 WM_XEXT_CHECK_XSHM
580 dnl X Misceleanous Utility
581 dnl ======================
582 dnl the libXmu is used in WRaster
583 WM_EXT_CHECK_XMU
586 dnl XINERAMA support
587 dnl ================
588 AC_ARG_ENABLE([xinerama],
589     [AS_HELP_STRING([--enable-xinerama], [enable Xinerama extension support])],
590     [AS_CASE(["$enableval"],
591         [yes|no], [],
592         [AC_MSG_ERROR([bad value $enableval for --enable-xinerama]) ]) ],
593     [enable_xinerama=auto])
594 WM_XEXT_CHECK_XINERAMA
597 dnl RandR support
598 dnl =============
599 AC_ARG_ENABLE([randr],
600     [AS_HELP_STRING([--enable-randr], [enable RandR extension support (NOT recommended, buggy)])],
601     [AS_CASE(["$enableval"],
602         [yes|no], [],
603         [AC_MSG_ERROR([bad value $enableval for --enable-randr]) ]) ],
604     [enable_randr=no])
605 WM_XEXT_CHECK_XRANDR
608 dnl Math library
609 dnl ============
610 dnl libWINGS uses math functions, check whether usage requires linking
611 dnl against libm
612 WM_CHECK_LIBM
615 dnl FontConfig
616 dnl ==========
617 dnl libWINGS uses FcPatternDel from libfontconfig
618 AC_MSG_CHECKING([for fontconfig library])
619 FCLIBS=`$PKG_CONFIG fontconfig --libs`
620 if test "x$FCLIBS" = "x" ; then
621         AC_MSG_RESULT([not found])
622 else
623         AC_MSG_RESULT([found])
625 AC_SUBST(FCLIBS)
628 dnl Xft2 antialiased font support
629 dnl =============================
630 m4_define([XFT_MIN_VERSION], [2.1.0])
631 PKG_CHECK_MODULES([XFT], [xft >= ]XFT_MIN_VERSION,
632     [], dnl Module found, nothing to do
633     [XFT_CFLAGS=failed])
634 AS_IF([test "x$XFT_CFLAGS" = "xfailed"],
635     [dnl pkg-config did not find it, try the legacy method
636      AC_CHECK_PROG([XFTCONFIG], [xft-config], [xft-config])
637      AS_IF([test -z "$XFTCONFIG"],
638          [AC_MSG_ERROR([libXft2 is not installed, is too old or could not be found -- $XFT_PKG_ERRORS]) ])
639      XFT_LIBS=`$XFTCONFIG --libs`
640      XFT_CFLAGS=`$XFTCONFIG --cflags`
641      WM_CHECK_XFT_VERSION(XFT_MIN_VERSION,
642          [], dnl Version is ok, nothing to do
643          [AC_MSG_ERROR([Version of libXft is too old, consider upgrading to] XFT_MIN_VERSION [or newer]) ])
644     ])
645 AC_SUBST(XFT_CFLAGS)
646 AC_SUBST(XFT_LIBS)
649 dnl PANGO support
650 dnl =============
651 dnl The libray can be used by WINGs to get better support on UTF-8 for i18n
652 AC_ARG_ENABLE([pango],
653     [AS_HELP_STRING([--disable-pango], [disable Pango text layout support @<:@default=auto@:>@])],
654     [AS_CASE([$enableval],
655         [yes|no], [],
656         [AC_MSG_ERROR([bad value $enableval for --disable-pango])] )],
657     [enable_pango=auto])
658 WM_CHECK_LIBPANGO
661 dnl ==============================================
662 dnl         Graphic Format Libraries
663 dnl ==============================================
665 dnl XPM Support
666 dnl ===========
667 AC_ARG_ENABLE([xpm],
668     [AS_HELP_STRING([--disable-xpm], [disable use of XPM pixmaps through libXpm])],
669     [AS_CASE(["$enableval"],
670         [yes|no], [],
671         [AC_MSG_ERROR([bad value $enableval for --enable-xpm])] )],
672     [enable_xpm=auto])
673 WM_IMGFMT_CHECK_XPM
676 # for wmlib
677 AC_SUBST(XCFLAGS)
678 # for test
679 AC_SUBST(XLFLAGS)
680 AC_SUBST(XLIBS)
681 AC_SUBST(X_EXTRA_LIBS)
683 dnl ===============================================
684 dnl             End of stuff that uses X
685 dnl ===============================================
687 dnl EXIF Support
688 dnl ============
689 WM_CHECK_LIBEXIF
690 AS_IF([test "x$LIBEXIF" != "x"],
691         [AC_DEFINE(HAVE_EXIF, 1, [Define if EXIF can be used])])
694 dnl PNG Support
695 dnl ===========
696 AC_ARG_ENABLE([png],
697     [AS_HELP_STRING([--disable-png], [disable PNG support through libpng])],
698     [AS_CASE(["$enableval"],
699         [yes|no], [],
700         [AC_MSG_ERROR([bad value $enableval for --enable-png])] )],
701     [enable_png=auto])
702 WM_IMGFMT_CHECK_PNG
705 dnl JPEG Support
706 dnl ============
707 AC_ARG_ENABLE([jpeg],
708     [AS_HELP_STRING([--disable-jpeg], [disable JPEG support through libjpeg])],
709     [AS_CASE(["$enableval"],
710         [yes|no], [],
711         [AC_MSG_ERROR([bad value $enableval for --enable-jpeg])] )],
712     [enable_jpeg=auto])
713 WM_IMGFMT_CHECK_JPEG
716 dnl GIF Support
717 dnl ============
718 AC_ARG_ENABLE(gif,
719     [AS_HELP_STRING([--disable-gif], [disable GIF support through libgif or libungif])],
720     [AS_CASE(["$enableval"],
721         [yes|no], [],
722         [AC_MSG_ERROR([bad value $enableval for --enable-gif])] )],
723     [enable_gif=auto])
724 WM_IMGFMT_CHECK_GIF
727 dnl TIFF Support
728 dnl ============
729 AC_ARG_ENABLE([tiff],
730     [AS_HELP_STRING([--disable-tiff], [disable use of TIFF images through libtiff])],
731     [AS_CASE(["$enableval"],
732         [yes|no], [],
733         [AC_MSG_ERROR([bad value $enableval for --enable-tiff])] )],
734     [enable_tiff=auto])
735 WM_IMGFMT_CHECK_TIFF
738 dnl WEBP Support
739 dnl ============
740 AC_ARG_ENABLE([webp],
741     [AS_HELP_STRING([--disable-webp], [disable WEBP support through libwebp])],
742     [AS_CASE(["$enableval"],
743         [yes|no], [],
744         [AC_MSG_ERROR([bad value $enableval for --enable-webp])] )],
745     [enable_webp=auto])
746 WM_IMGFMT_CHECK_WEBP
749 dnl MagicK Support
750 dnl ==============
751 AC_ARG_ENABLE([magick],
752     [AS_HELP_STRING([--disable-magick], [disable MAGICK support through libMagickWand])],
753     [AS_CASE(["$enableval"],
754         [yes|no], [],
755         [AC_MSG_ERROR([bad value $enableval for --enable-magick])] )],
756     [enable_magick=auto])
757 WM_IMGFMT_CHECK_MAGICK
760 dnl PPM Support
761 dnl ===========
762 # The PPM format is always enabled because we have built-in support for the format
763 # We are not using any external library like libppm
764 supported_gfx="$supported_gfx builtin-PPM"
767 # Choice of the default format for icons
768 AS_IF([test "x$enable_tiff" != "xno"],
769     [ICONEXT="tiff"],
770     [ICONEXT="xpm"])
773 LIBRARY_SEARCH_PATH="$lib_search_path"
774 HEADER_SEARCH_PATH="$inc_search_path"
776 AC_SUBST(LIBRARY_SEARCH_PATH)
777 AC_SUBST(HEADER_SEARCH_PATH)
780 AC_SUBST(GFXLIBS)
781 AC_SUBST(ICONEXT)
782 AM_CONDITIONAL([ICON_EXT_XPM],  [test "x$ICONEXT" = "xxpm"])
783 AM_CONDITIONAL([ICON_EXT_TIFF], [test "x$ICONEXT" = "xtiff"])
786 dnl ==============================================
787 dnl         End of Graphic Format Libraries
788 dnl ==============================================
792 dnl stdlib.h is checked here, because of conflict in jpeglib.h
793 AC_CHECK_HEADERS(stdlib.h)
796 dnl Support for PIXMAPDIR option
797 dnl ============================
798 AC_ARG_WITH([pixmapdir],
799     [AS_HELP_STRING([--with-pixmapdir=PATH], [specify where pixmaps are located [DATADIR/pixmaps]])],
800     [AS_CASE([$withval],
801         [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-pixmapdir, expected a path]) ],
802         [/*],  [], dnl Absolute path, ok
803         [\$*], [], dnl Assumes it starts with a reference to $prefix or a similar variable, ok
804         [AC_MSG_ERROR([bad path '$withval' for pixmapdir, expecting an absolute path])])],
805     [with_pixmapdir=""])
807 AS_IF([test "x$with_pixmapdir" != "x"],
808     [pixmapdir="$with_pixmapdir"],
809     [pixmapdir='${datadir}/pixmaps'])
810 AC_SUBST([pixmapdir])dnl
813 dnl Support for GNUSTEP_LOCAL_ROOT, for WPrefs.app
814 dnl ==============================================
815 AC_ARG_WITH([gnustepdir],
816     [AS_HELP_STRING([--with-gnustepdir=PATH], [specify the directory for GNUstep applications])],
817     [AS_CASE([$withval],
818         [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-gnustepdir, expected a path]) ],
819         [/*],  [], dnl Absolute path, ok
820         [\$*], [], dnl Assumes it starts with a reference to $prefix or a similar variable, ok
821         [AC_MSG_ERROR([bad path '$withval' for gnustepdir, expecting an absolute path])])],
822     [dnl If no command-line option was given, we use $GNUSTEP_LOCAL_ROOT if it was set
823      with_gnustepdir="$GNUSTEP_LOCAL_ROOT"])
825 AS_IF([test "x$with_gnustepdir" = "x"],
826     [dnl No path specified, use default
827      wprefs_base_dir=${prefix}
828      wprefs_datadir="${datadir}/WPrefs"
829      wprefs_bindir="${bindir}"],
830     [dnl User specified base path
831      wprefs_base_dir="$with_gnustepdir/Applications"
832      wprefs_datadir="$wprefs_base_dir/WPrefs.app"
833      wprefs_bindir="$wprefs_base_dir/WPrefs.app"])
834 AC_SUBST([wprefs_datadir])dnl
835 AC_SUBST([wprefs_bindir])dnl
838 dnl Support for PKGCONFDIR option
839 dnl =============================
840 AC_ARG_WITH([pkgconfdir],
841     [AS_HELP_STRING([--with-pkgconfdir=PATH], [specify where global defaults are located [SYSCONFDIR/WindowMaker]])],
842     [AS_CASE([$withval],
843         [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-pkgconfdir, expected a path]) ],
844         [/*],  [], dnl Absolute path, ok
845         [\$*], [], dnl Assumes it starts with a reference to $prefix or a similar variable, ok
846         [AC_MSG_ERROR([bad path '$withval' for pkgconfdir, expecting an absolute path])])],
847     [with_pkgconfdir=""])
849 dnl Provide a message when trying to use "--with-defsdatadir" so that user can update its
850 dnl arguments. Otherwise only a warning is issued, which is likely to be missed, which will
851 dnl lead to perceived misbehaviour much later (and hard to debug).
852 WM_DENY_ARG_WITH([defsdatadir],
853     [AC_MSG_ERROR([option "--with-defsdatadir" have been replaced by "--with-pkgconfdir"])])
855 AS_IF([test "x$with_pkgconfdir" != "x"],
856     [pkgconfdir="$with_pkgconfdir"],
857     [pkgconfdir='${sysconfdir}/${PACKAGE_TARNAME}'])
858 AC_SUBST([pkgconfdir])dnl
861 dnl Enable User Defined Menu thing
862 dnl ==============================
863 AC_ARG_ENABLE([usermenu],
864     [AS_HELP_STRING([--enable-usermenu], [user defined menus for applications])],
865     [AS_CASE([$enableval],
866         [yes|no], [],
867         [AC_MSG_ERROR([bad value '$enableval' for --enable-usermenu])])],
868     [enable_usermenu=no])
869 AS_IF([test "x$enable_usermenu" = "xyes"],
870     [AC_DEFINE([USER_MENU], [1],
871         [define if you want user defined menus for applications])])
874 dnl Support for removing non-public symbols from a library
875 dnl ======================================================
876 gl_LD_VERSION_SCRIPT
879 dnl Add the post-poned compilation options
880 dnl ======================================
881 WM_CFLAGS_GCC_OPTION_POSTPONED
884 AC_SUBST(lib_search_path)
885 AC_SUBST(inc_search_path)
888 dnl Spit out the configuration
889 dnl ==========================
890 AC_CONFIG_FILES(
891     Makefile
893     dnl WRaster Library
894     wrlib/Makefile wrlib/po/Makefile
895     wrlib/tests/Makefile
897     dnl WINGs toolkit
898     WINGs/Makefile WINGs/WINGs/Makefile WINGs/po/Makefile
899     WINGs/Documentation/Makefile WINGs/Resources/Makefile WINGs/Extras/Makefile
900     WINGs/Examples/Makefile WINGs/Tests/Makefile
902     dnl Window Maker's core
903     src/Makefile src/wconfig.h po/Makefile
904     doc/Makefile doc/build/Makefile
905     doc/sk/Makefile doc/cs/Makefile doc/ru/Makefile
906     WindowMaker/Makefile WindowMaker/Backgrounds/Makefile
907     WindowMaker/Defaults/Makefile WindowMaker/IconSets/Makefile
908     WindowMaker/Icons/Makefile WindowMaker/Pixmaps/Makefile
909     WindowMaker/Styles/Makefile WindowMaker/Themes/Makefile
911     dnl Preference GUI
912     WPrefs.app/Makefile WPrefs.app/po/Makefile
913     WPrefs.app/tiff/Makefile WPrefs.app/xpm/Makefile
915     dnl Command-line utilities
916     util/Makefile util/po/Makefile
918     dnl Misceleanous stuff
919     wmlib/Makefile
920     test/Makefile
923 AC_OUTPUT
926 dnl Provide a summary of the config
927 dnl ===============================
928 echo
929 echo "Window Maker was configured as follows:"
930 echo
931 echo "Installation path prefix            : $prefix"
932 echo "Installation path for binaries      : $_bindir"
933 echo "Installation path for libraries     : $_libdir"
934 echo "Installation path for WPrefs.app    : $wprefs_base_dir" | sed -e 's|\${prefix}|'"$prefix|"
935 echo "Supported core features:            :$supported_core"
936 echo "Supported X extensions:             :$supported_xext"
937 echo "Supported graphic format libraries  :$supported_gfx"
938 echo "Unsupported features                :$unsupported"
939 echo "Pango text layout support in WINGs  : $pango"
940 echo "Translated languages to support     :$supported_locales"
941 AS_IF([test "x$WEB_REPO_ROOT" != "x"],
942     [AS_ECHO(["Git repository for WMaker's Website : $WEB_REPO_ROOT"]) ])
943 AS_IF([test "x$debug" = "xyes"],
944     [AS_ECHO(["Debug enabled: CFLAGS = $CFLAGS"]) ])
945 echo
947 AS_IF([test "x$wm_cv_prog_cc_nestedfunc" != "xyes"],
948     [AC_MSG_WARN([[Your compiler does not support Nested Function, work-around enabled]])])
950 AS_IF([test "x$supported_locales" = "x"],
951     [AC_MSG_WARN([[No language from \$LINGUAS are supported]])])
953 AS_IF([test "x$enable_jpeg" = xno], [dnl
954     AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])
955     AS_ECHO([])
956     AS_ECHO(["JPEG support will not be included because the JPEG library is"])
957     AS_ECHO(["not installed correctly or was not found. Background images"])
958     AS_ECHO(["from themes will not display as they usually are JPEG files."])
959     AS_ECHO([])
960     AS_ECHO(["To fix, download and install the jpeg library and/or make sure you"])
961     AS_ECHO(["installed all jpeg related packages, SPECIALLY the development packages"])
962     AS_ECHO(["like jpeg-dev (if you use some prepackaged version of libjpeg)."])
963     AS_ECHO([])
964     AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])dnl
967 AS_IF([test "x$LINGUAS" != "x"],
968     [AS_IF([test "X$wm_cv_library_constructors" = "Xlegacy"],
969         [AC_MSG_WARN([I18N is enabled, but library constructor attribute is not supported])
970          AS_ECHO(["   If you have translation problems in lib WRaster, yet you know that the translation"])
971          AS_ECHO(["   file (po) is valid, this could be a cause."])
972          AS_ECHO([])dnl
973         ])dnl
974     ])
977 dnl This is for Emacs.  I'm lazy, I know... (nicolai)
978 dnl ================================================
979 dnl Local Variables:
980 dnl compile-command: "autoconf"
981 dnl End: