Coverity: fix wmsetbg string not null terminated
[wmaker-crm.git] / configure.ac
blobf5567ac14103d134587dfd66d9b24aafa1b38159
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=7
75 WRASTER_REVISION=0
76 WRASTER_AGE=1
77 WRASTER_VERSION=$WRASTER_CURRENT:$WRASTER_REVISION:$WRASTER_AGE
78 AC_SUBST(WRASTER_VERSION)
79 dnl
80 dnl libWINGs
81 WINGS_CURRENT=5
82 WINGS_REVISION=0
83 WINGS_AGE=2
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 m4_divert_push([INIT_PREPARE])dnl
107 AC_ARG_ENABLE([debug],
108     [AS_HELP_STRING([--enable-debug], [enable debugging options, @<:@default=no@:>@])],
109     [AS_CASE(["$enableval"],
110         [yes], [debug=yes],
111         [no],  [debug=no],
112         [AC_MSG_ERROR([bad value $enableval for --enable-debug])] )],
113     [debug=no])
114 m4_divert_pop([INIT_PREPARE])dnl
115 AS_IF([test "x$debug" = "xyes"],
116     [dnl This flag should have already been detected and added, but if user
117      dnl provided an explicit CFLAGS it may not be the case
118      AS_IF([echo " $CFLAGS " | grep " -g " 2>&1 > /dev/null],
119            [@%:@ Debug symbol already activated],
120            [AX_CFLAGS_GCC_OPTION([-g])])
121      dnl
122      dnl This flag generally makes debugging nightmarish, remove it if present
123      CFLAGS="`echo "$CFLAGS" | sed -e 's/-fomit-frame-pointer *//' `"
124      dnl
125      dnl Enable internal debug code
126      CPPFLAGS="$CPPFLAGS -DDEBUG"
127 ],  [dnl
128      dnl When debug is not enabled, the user probably does not wants to keep
129      dnl assertions in the final program
130      CPPFLAGS="$CPPFLAGS -DNDEBUG"
134 AX_CFLAGS_GCC_OPTION([-Wall])
135 AX_CFLAGS_GCC_OPTION([-Wextra -Wno-sign-compare])
137 dnl The use of trampolines cause code that can crash on some secured OS, it is
138 dnl also known to be a source of crash if not used properly, in a more general
139 dnl way it tends to generate binary code that may not be optimal, and it is
140 dnl not compatible with the 'nested-func-to-macro' workaround
141 WM_CFLAGS_CHECK_FIRST([-Wtrampolines],
142          [-Werror=trampolines  dnl try to generate an error if possible
143           -Wtrampolines        dnl if not, try to fall back to a simple warning
144          ])
146 AS_IF([test "x$debug" = "xyes"],
147     [dnl When debug is enabled, we try to activate more checks from
148      dnl the compiler. They are on independant check because the
149      dnl macro checks all the options at once, but we may have cases
150      dnl where some options are not supported and we don't want to
151      dnl loose all of them.
152      dnl
153      dnl clang, suggest parenthesis on bit operations that could be
154      dnl misunderstood due to C operator precedence
155      AX_CFLAGS_GCC_OPTION([-Wbitwise-op-parentheses])
156      dnl
157      dnl Points at code that gcc thinks is so complicated that gcc
158      dnl gives up trying to optimize, which probably also means it is
159      dnl too complicated to maintain
160      AX_CFLAGS_GCC_OPTION([-Wdisabled-optimization])
161      dnl
162      dnl Because of C's type promotion, the compiler has to generate
163      dnl less optimal code when a double constant is used in a
164      dnl float expression
165      AX_CFLAGS_GCC_OPTION([-Wdouble-promotion])
166      dnl
167      dnl Floating-point comparison is not a good idea
168      AX_CFLAGS_GCC_OPTION([-Wfloat-equal])
169      dnl
170      dnl clang warns about constants that may have portability issues due
171      dnl to the endianness of the host
172      AX_CFLAGS_GCC_OPTION([-Wfour-char-constants])
173      dnl
174      dnl clang warns about constant that may be too big to be portable
175      AX_CFLAGS_GCC_OPTION([-Wliteral-range])
176      dnl
177      dnl Try to report misuses of '&' versus '&&' and similar
178      AX_CFLAGS_GCC_OPTION([-Wlogical-op])
179      dnl
180      dnl clang, reports cases where the code assumes everyone is an
181      dnl expert in C operator precedence... which is unlikely!
182      AX_CFLAGS_GCC_OPTION([-Wlogical-op-parentheses])
183      dnl
184      dnl Reports declaration of global things that are done inside
185      dnl a local environment, instead of using the appropriate
186      dnl header
187      AX_CFLAGS_GCC_OPTION([-Wnested-externs])
188      dnl
189      dnl Warn about constant strings that could pose portability issues
190      AX_CFLAGS_GCC_OPTION([-Woverlength-strings])
191      dnl
192      dnl Use of 'sizeof()' on inappropriate pointer types
193      AX_CFLAGS_GCC_OPTION([-Wpointer-arith])
194      dnl
195      dnl Having more than 1 prototype for a function makes code updates
196      dnl more difficult, so try to avoid it
197      AX_CFLAGS_GCC_OPTION([-Wredundant-decls])
198      dnl
199      dnl clang, detect some misuses of sizeof. We also count in our code
200      dnl on the use of the macro 'wlength' which contains a check if the
201      dnl compiler support C11's static_assert
202      AX_CFLAGS_GCC_OPTION([-Wsizeof-array-argument])
203      dnl
204      dnl Prototype of function must be explicit, no deprecated K&R syntax
205      dnl and no empty argument list which prevents compiler from doing
206      dnl type checking when using the function
207      WM_CFLAGS_GCC_OPTION_STRICTPROTO
208      dnl
209      dnl Proper attributes helps the compiler to produce better code
210      WM_CFLAGS_CHECK_FIRST([format attribute suggest],
211          [-Wsuggest-attribute=format  dnl new gcc syntax
212           -Wmissing-format-attribute  dnl old gcc syntax, clang
213          ])
214      WM_CFLAGS_CHECK_FIRST([no-return attribute suggest],
215          [-Wsuggest-attribute=noreturn  dnl gcc syntax
216           -Wmissing-noreturn            dnl clang syntax
217          ])
218      dnl
219      dnl GCC provides a couple of checks to detect incorrect macro uses
220      AX_CFLAGS_GCC_OPTION([-Wundef])
221      WM_CFLAGS_GCC_OPTION_UNUSEDMACROS
222      dnl
223      dnl clang reports stuff marked unused but which is actually used
224      AX_CFLAGS_GCC_OPTION([-Wused-but-marked-unused])
225 ], [dnl
226      dnl When debug not enabled, we try to avoid some non-necessary
227      dnl messages from the compiler
228      dnl
229      dnl To support legacy X servers, we have sometime to use
230      dnl functions marked as deprecated. We do not wish our users
231      dnl to be worried about it
232      AX_CFLAGS_GCC_OPTION([-Wno-deprecated])
233      AX_CFLAGS_GCC_OPTION([-Wno-deprecated-declarations])
237 dnl To upload documentation to the Website
238 dnl ======================================
239 m4_divert_push([INIT_PREPARE])dnl
240 AC_ARG_WITH([web-repo],
241     [AS_HELP_STRING([--with-web-repo=PATH], [path to your git repository for the Web home page (maintainer stuff)])],
242     [AS_CASE([$withval],
243         [yes], [AC_MSG_ERROR([bad value '$withval' for --with-web-repo, expected a path]) ],
244         [no],  [WEB_REPO_ROOT=""],
245         [WEB_REPO_ROOT=$withval])],
246     [WEB_REPO_ROOT=""])
247 m4_divert_pop([INIT_PREPARE])dnl
248 WM_CHECK_WEBREPODIR
251 dnl Support for Nested Functions by the compiler
252 dnl ============================================
253 WM_PROG_CC_NESTEDFUNC
256 dnl Posix thread
257 dnl ============
258 dnl they are used by util/wmiv
259 AX_PTHREAD
262 dnl Tracking on what is detected for final status
263 dnl =============================================
264 unsupported=""
265 supported_core=""
266 supported_xext=""
267 supported_gfx=""
270 dnl Platform-specific Makefile setup
271 dnl ================================
272 AS_CASE(["$host"],
273     [*-*-linux*|*-*-cygwin*|*-gnu*], [WM_OSDEP="linux" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=700"],
274     [*-*-freebsd*|*-k*bsd-gnu*],     [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=700 -DFREEBSD"],
275     [*-*-netbsd*],                   [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DNETBSD"],
276     [*-*-openbsd*],                  [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DOPENBSD"],
277     [*-*-dragonfly*],                [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DDRAGONFLYBSD"],
278     [*-apple-darwin*],               [WM_OSDEP="darwin"],
279     [*-*-solaris*],                  [WM_OSDEP="stub"],  dnl  solaris.c when done
280     [WM_OSDEP="stub"])
281 AM_CONDITIONAL([WM_OSDEP_LINUX],   [test "x$WM_OSDEP" = "xlinux"])
282 AM_CONDITIONAL([WM_OSDEP_BSD],     [test "x$WM_OSDEP" = "xbsd"])
283 AM_CONDITIONAL([WM_OSDEP_DARWIN],  [test "x$WM_OSDEP" = "xdarwin"])
284 AM_CONDITIONAL([WM_OSDEP_GENERIC], [test "x$WM_OSDEP" = "xstub"])
287 dnl the prefix
288 dnl ==========
290 dnl move this earlier in the script... anyone know why this is handled
291 dnl in such a bizarre way?
293 test "x$prefix" = xNONE && prefix=$ac_default_prefix
294 dnl Let make expand exec_prefix.
295 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
298 _bindir=`eval echo $bindir`
299 _bindir=`eval echo $_bindir`
300 _libdir=`eval echo $libdir`
301 _libdir=`eval echo $_libdir`
303 dnl ===============================================
304 dnl Specify paths to look for libraries and headers
305 dnl ===============================================
306 AC_ARG_WITH(libs-from, AS_HELP_STRING([--with-libs-from], [pass compiler flags to look for libraries]),
307         [lib_search_path="$withval"], [lib_search_path='-L${libdir}'])
309 AC_ARG_WITH(incs-from, AS_HELP_STRING([--with-incs-from], [pass compiler flags to look for header files]),
310         [inc_search_path="$withval"], [inc_search_path='-I${includedir}'])
313 dnl Features Configuration
314 dnl ======================
315 m4_divert_push([INIT_PREPARE])dnl
316 AC_ARG_ENABLE([animations],
317     [AS_HELP_STRING([--disable-animations], [disable permanently animations @<:@default=enabled@:>@])],
318     [AS_CASE(["$enableval"],
319         [yes|no], [],
320         [AC_MSG_ERROR([bad value $enableval for --enable-animations])])],
321     [enable_animations="yes"])
322 m4_divert_pop([INIT_PREPARE])dnl
324 AS_IF([test "x$enable_animations" = "xno"],
325     [unsupported="$unsupported Animations"],
326     [AC_DEFINE([USE_ANIMATIONS], [1], [Defined when user did not request to disable animations])
327      supported_core="$supported_core Animations"])
330 m4_divert_push([INIT_PREPARE])dnl
331 AC_ARG_ENABLE([mwm-hints],
332     [AS_HELP_STRING([--disable-mwm-hints], [disable support for Motif WM hints @<:@default=enabled@:>@])],
333     [AS_CASE(["$enableval"],
334         [yes|no], [],
335         [AC_MSG_ERROR([bad value $enableval for --enable-mwm-hints])])],
336     [enable_mwm_hints="yes"])
337 m4_divert_pop([INIT_PREPARE])dnl
339 AS_IF([test "x$enable_mwm_hints" = "xno"],
340     [unsupported="$unsupported MWMHints"],
341     [AC_DEFINE([USE_MWM_HINTS], [1], [Defined when used did not request to disable Motif WM hints])
342      supported_core="$supported_core MWMHints"])
343 AM_CONDITIONAL([USE_MWM_HINTS], [test "x$enable_mwm_hints" != "xno"])
346 dnl Boehm GC
347 dnl ========
348 m4_divert_push([INIT_PREPARE])dnl
349 AC_ARG_ENABLE([boehm-gc],
350     [AS_HELP_STRING([--enable-boehm-gc], [use Boehm GC instead of the default libc malloc() [default=no]])],
351     [AS_CASE(["$enableval"],
352         [yes], [with_boehm_gc=yes],
353         [no],  [with_boehm_gc=no],
354         [AC_MSG_ERROR([bad value $enableval for --enable-boehm-gc])] )],
355     [with_boehm_gc=no])
356 m4_divert_pop([INIT_PREPARE])dnl
358 AS_IF([test "x$with_boehm_gc" = "xyes"],
359     AC_SEARCH_LIBS([GC_malloc], [gc],
360         [AC_DEFINE(USE_BOEHM_GC, 1, [Define if Boehm GC is to be used])],
361         [AC_MSG_FAILURE([--enable-boehm-gc specified but test for libgc failed])]))
364 dnl LCOV
365 dnl ====
366 m4_divert_push([INIT_PREPARE])dnl
367 AC_ARG_ENABLE([lcov],
368     [AS_HELP_STRING([--enable-lcov[=output-directory]], [enable coverage data generation using LCOV (GCC only) [default=no]])],
369     [],
370     [enable_lcov=no])
371 m4_divert_pop([INIT_PREPARE])dnl
373 AS_IF([test "x$enable_lcov" != "xno"],
374     [AX_CFLAGS_GCC_OPTION(-fprofile-arcs -ftest-coverage)
375     AS_IF([test "x$enable_lcov" = "xyes"],
376         [lcov_output_directory="coverage-report"],
377         [lcov_output_directory="${enable_lcov}/coverage-report"])
378     AC_SUBST(lcov_output_directory)])
380 AM_CONDITIONAL([USE_LCOV], [test "x$enable_lcov" != "xno"])
383 dnl ============================
384 dnl Checks for library functions
385 dnl ============================
386 AC_FUNC_MEMCMP
387 AC_FUNC_VPRINTF
388 WM_FUNC_SECURE_GETENV
389 AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
390                setsid mallinfo2 mkstemp sysconf)
391 AC_SEARCH_LIBS([strerror], [cposix])
393 dnl nanosleep is generally available in standard libc, although not always the
394 dnl case. One known example is Solaris which needs -lrt
395 AC_SEARCH_LIBS([nanosleep], [rt], [],
396     [AC_MSG_ERROR([function 'nanosleep' not found, please report to wmaker-dev@googlegroups.com])])
398 dnl the flag 'O_NOFOLLOW' for 'open' is used in WINGs
399 WM_FUNC_OPEN_NOFOLLOW
402 dnl Check for strlcat/strlcpy
403 dnl =========================
404 m4_divert_push([INIT_PREPARE])dnl
405 AC_ARG_WITH([libbsd],
406   [AS_HELP_STRING([--without-libbsd], [do not use libbsd for strlcat and strlcpy [default=check]])],
407   [AS_IF([test "x$with_libbsd" != "xno"],
408     [with_libbsd=bsd],
409     [with_libbsd=]
410   )],
411   [with_libbsd=bsd])
412 m4_divert_pop([INIT_PREPARE])dnl
414 tmp_libs=$LIBS
415 AC_SEARCH_LIBS([strlcat],[$with_libbsd],
416   [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available])],
417   [],
418   []
420 AC_SEARCH_LIBS([strlcpy],[$with_libbsd],
421   [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcpy is available])],
422   [],
423   []
425 LIBS=$tmp_libs
427 LIBBSD=
428 AS_IF([test "x$ac_cv_search_strlcat" = "x-lbsd" -o "x$ac_cv_search_strlcpy" = "x-lbsd"],
429   [LIBBSD=-lbsd
430    AC_CHECK_HEADERS([bsd/string.h])]
432 AC_SUBST(LIBBSD)
435 dnl Check for OpenBSD kernel memory interface - kvm(3)
436 dnl ==================================================
437 AS_IF([test "x$WM_OSDEP" = "xbsd"],
438   AC_SEARCH_LIBS([kvm_openfiles], [kvm]) )
441 dnl Check for inotify
442 dnl =================
443 dnl It is used by WindowMaker to reload automatically the configuration when the
444 dnl user changed it using WPref or wdwrite
445 AC_CHECK_HEADERS([sys/inotify.h],
446     [AC_DEFINE([HAVE_INOTIFY], [1], [Check for inotify])])
449 dnl Check for syslog
450 dnl ================
451 dnl It is used by WUtil to log the wwarning, werror and wfatal
452 AC_CHECK_HEADERS([syslog.h], [AC_DEFINE([HAVE_SYSLOG], [1], [Check for syslog])])
455 dnl Checks for header files
456 dnl =======================
457 AC_HEADER_SYS_WAIT
458 AC_HEADER_TIME
459 AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h libintl.h poll.h malloc.h ctype.h \
460                  string.h strings.h)
463 dnl Checks for typedefs, structures, and compiler characteristics
464 dnl =============================================================
465 AC_C_CONST
466 AC_C_INLINE
467 WM_C_NORETURN
468 AC_TYPE_SIZE_T
469 AC_TYPE_PID_T
470 WM_TYPE_SIGNAL
473 dnl pkg-config
474 dnl ==========
475 PKG_PROG_PKG_CONFIG
476 AS_IF([test -z "$PKG_CONFIG"],[AC_MSG_ERROR([pkg-config is required.])])
480 dnl Internationalization
481 dnl ====================
482 dnl Detect the language for translations to be installed and check
483 dnl that the gettext environment works
484 WM_I18N_LANGUAGES
485 WM_I18N_XGETTEXT
486 WM_I18N_MENUTEXTDOMAIN
487 WM_LIBRARY_CONSTRUCTORS
489 dnl ===========================================
490 dnl             Stuff that uses X
491 dnl ===========================================
493 AC_PATH_XTRA
495 AS_IF([test "x$no_x" = "xyes"],
496     [AC_MSG_ERROR([The path for the X11 files not found!
497 Make sure you have X and its headers and libraries (the -devel packages
498 in Linux) installed.])])
500 X_LIBRARY_PATH=$x_libraries
501 XCFLAGS="$X_CFLAGS"
502 XLFLAGS="$X_LIBS"
503 XLIBS="-lX11 $X_EXTRA_LIBS"
505 lib_search_path="$lib_search_path $XLFLAGS"
506 inc_search_path="$inc_search_path $XCFLAGS"
508 AC_SUBST(X_LIBRARY_PATH)
511 dnl Decide which locale function to use, setlocale() or _Xsetlocale()
512 dnl by MANOME Tomonori
513 dnl ===========================================
514 WM_I18N_XLOCALE
518 dnl Check whether XInternAtoms() exist
519 dnl ==================================
520 AC_CHECK_LIB([X11], [XInternAtoms],
521     [AC_DEFINE([HAVE_XINTERNATOMS], [1],
522         [define if your X server has XInternAtoms() (set by configure)])],
523     [], [$XLFLAGS $XLIBS])
526 dnl Check whether XConvertCase() exist
527 dnl ==================================
528 AC_CHECK_LIB([X11], [XConvertCase],
529     [AC_DEFINE([HAVE_XCONVERTCASE], [1],
530         [define if your X server has XConvertCase() (set by configure)])],
531     [], [$XLFLAGS $XLIBS])
534 dnl XKB keyboard language status
535 dnl ============================
536 m4_divert_push([INIT_PREPARE])dnl
537 AC_ARG_ENABLE([modelock],
538     [AS_HELP_STRING([--enable-modelock], [XKB keyboard language status support])],
539     [AS_CASE([$enableval],
540         [yes|no], [],
541         [AC_MSG_ERROR([bad value '$enableval' for --enable-modelock])])],
542     [enable_modelock=no])
543 m4_divert_pop([INIT_PREPARE])dnl
545 AS_IF([test "x$enable_modelock" = "xyes"],
546     [AC_DEFINE([XKB_MODELOCK], [1], [whether XKB language MODELOCK should be enabled]) ])
549 dnl XDND Drag-nd-Drop support
550 dnl =========================
551 m4_divert_push([INIT_PREPARE])dnl
552 AC_ARG_ENABLE([xdnd],
553     [AS_HELP_STRING([--disable-xdnd], [disable support for Drag-and-Drop on the dock @<:@default=enabled@:>@])],
554     [AS_CASE(["$enableval"],
555         [yes|no], [],
556         [AC_MSG_ERROR([bad value $enableval for --disable-xdnd]) ]) ],
557     [enable_xdnd=yes])
558 m4_divert_pop([INIT_PREPARE])dnl
560 AS_IF([test "x$enable_xdnd" = "xyes"],
561     [supported_core="$supported_core XDnD"
562      AC_DEFINE([USE_DOCK_XDND], [1], [whether Drag-and-Drop on the dock should be enabled])],
563     [unsupported="$unsupported XDnd"])
564 AM_CONDITIONAL([USE_DOCK_XDND], [test "x$enable_xdnd" != "xno"])
567 dnl Support for ICCCM 2.0 Window Manager replacement
568 dnl ================================================
569 m4_divert_push([INIT_PREPARE])dnl
570 AC_ARG_ENABLE([wmreplace],
571     [AS_HELP_STRING([--enable-wmreplace], [support for ICCCM window manager replacement])],
572     [AS_CASE([$enableval],
573         [yes|no], [],
574         [AC_MSG_ERROR([bad value '$enableval' for --enable-wmreplace])])],
575     [enable_wmreplace=no])
576 m4_divert_pop([INIT_PREPARE])dnl
578 AS_IF([test "x$enable_wmreplace" = "xyes"],
579     [AC_DEFINE([USE_ICCCM_WMREPLACE], [1],
580        [define to support ICCCM protocol for window manager replacement])
581      supported_xext="$supported_xext WMReplace"])
583 dnl XRes support
584 dnl ==============
585 m4_divert_push([INIT_PREPARE])dnl
586 AC_ARG_ENABLE([res],
587     [AS_HELP_STRING([--disable-res], [disable resource window extension support])],
588     [AS_CASE(["$enableval"],
589         [yes|no], [],
590         [AC_MSG_ERROR([bad value $enableval for --enable-res]) ]) ],
591     [enable_res=auto])
592 m4_divert_pop([INIT_PREPARE])dnl
594 WM_XEXT_CHECK_XRES
596 dnl XShape support
597 dnl ==============
598 m4_divert_push([INIT_PREPARE])dnl
599 AC_ARG_ENABLE([shape],
600     [AS_HELP_STRING([--disable-shape], [disable shaped window extension support])],
601     [AS_CASE(["$enableval"],
602         [yes|no], [],
603         [AC_MSG_ERROR([bad value $enableval for --enable-shape]) ]) ],
604     [enable_shape=auto])
605 m4_divert_pop([INIT_PREPARE])dnl
607 WM_XEXT_CHECK_XSHAPE
610 dnl MIT-SHM support
611 dnl ===============
612 m4_divert_push([INIT_PREPARE])dnl
613 AC_ARG_ENABLE([shm],
614     [AS_HELP_STRING([--disable-shm], [disable usage of MIT-SHM extension])],
615     [AS_CASE(["$enableval"],
616         [yes|no], [],
617         [AC_MSG_ERROR([bad value $enableval for --enable-shm]) ]) ],
618     [enable_shm=auto])
619 m4_divert_pop([INIT_PREPARE])dnl
620 WM_XEXT_CHECK_XSHM
623 dnl X Misceleanous Utility
624 dnl ======================
625 dnl the libXmu is used in WRaster
626 WM_EXT_CHECK_XMU
629 dnl XINERAMA support
630 dnl ================
631 m4_divert_push([INIT_PREPARE])dnl
632 AC_ARG_ENABLE([xinerama],
633     [AS_HELP_STRING([--enable-xinerama], [enable Xinerama extension support])],
634     [AS_CASE(["$enableval"],
635         [yes|no], [],
636         [AC_MSG_ERROR([bad value $enableval for --enable-xinerama]) ]) ],
637     [enable_xinerama=auto])
638 m4_divert_pop([INIT_PREPARE])dnl
639 WM_XEXT_CHECK_XINERAMA
642 dnl RandR support
643 dnl =============
644 m4_divert_push([INIT_PREPARE])dnl
645 AC_ARG_ENABLE([randr],
646     [AS_HELP_STRING([--enable-randr], [enable RandR extension support (NOT recommended, buggy)])],
647     [AS_CASE(["$enableval"],
648         [yes|no], [],
649         [AC_MSG_ERROR([bad value $enableval for --enable-randr]) ]) ],
650     [enable_randr=no])
651 m4_divert_pop([INIT_PREPARE])dnl
652 WM_XEXT_CHECK_XRANDR
655 dnl Math library
656 dnl ============
657 dnl libWINGS uses math functions, check whether usage requires linking
658 dnl against libm
659 WM_CHECK_LIBM
662 dnl FontConfig
663 dnl ==========
664 dnl libWINGS uses FcPatternDel from libfontconfig
665 AC_MSG_CHECKING([for fontconfig library])
666 FCLIBS=`$PKG_CONFIG fontconfig --libs`
667 if test "x$FCLIBS" = "x" ; then
668         AC_MSG_RESULT([not found])
669 else
670         AC_MSG_RESULT([found])
672 AC_SUBST(FCLIBS)
675 dnl Xft2 antialiased font support
676 dnl =============================
677 m4_define([XFT_MIN_VERSION], [2.1.0])
678 PKG_CHECK_MODULES([XFT], [xft >= ]XFT_MIN_VERSION,
679     [], dnl Module found, nothing to do
680     [XFT_CFLAGS=failed])
681 AS_IF([test "x$XFT_CFLAGS" = "xfailed"],
682     [dnl pkg-config did not find it, try the legacy method
683      AC_CHECK_PROG([XFTCONFIG], [xft-config], [xft-config])
684      AS_IF([test -z "$XFTCONFIG"],
685          [AC_MSG_ERROR([libXft2 is not installed, is too old or could not be found -- $XFT_PKG_ERRORS]) ])
686      XFT_LIBS=`$XFTCONFIG --libs`
687      XFT_CFLAGS=`$XFTCONFIG --cflags`
688      WM_CHECK_XFT_VERSION(XFT_MIN_VERSION,
689          [], dnl Version is ok, nothing to do
690          [AC_MSG_ERROR([Version of libXft is too old, consider upgrading to] XFT_MIN_VERSION [or newer]) ])
691     ])
692 AC_SUBST(XFT_CFLAGS)
693 AC_SUBST(XFT_LIBS)
696 dnl PANGO support
697 dnl =============
698 dnl The libray can be used by WINGs to get better support on UTF-8 for i18n
699 m4_divert_push([INIT_PREPARE])dnl
700 AC_ARG_ENABLE([pango],
701     [AS_HELP_STRING([--disable-pango], [disable Pango text layout support @<:@default=auto@:>@])],
702     [AS_CASE([$enableval],
703         [yes|no], [],
704         [AC_MSG_ERROR([bad value $enableval for --disable-pango])] )],
705     [enable_pango=auto])
706 m4_divert_pop([INIT_PREPARE])dnl
707 WM_CHECK_LIBPANGO
710 dnl ==============================================
711 dnl         Graphic Format Libraries
712 dnl ==============================================
714 dnl XPM Support
715 dnl ===========
716 m4_divert_push([INIT_PREPARE])dnl
717 AC_ARG_ENABLE([xpm],
718     [AS_HELP_STRING([--disable-xpm], [disable use of XPM pixmaps through libXpm])],
719     [AS_CASE(["$enableval"],
720         [yes|no], [],
721         [AC_MSG_ERROR([bad value $enableval for --enable-xpm])] )],
722     [enable_xpm=auto])
723 m4_divert_pop([INIT_PREPARE])dnl
724 WM_IMGFMT_CHECK_XPM
727 # for wmlib
728 AC_SUBST(XCFLAGS)
729 # for test
730 AC_SUBST(XLFLAGS)
731 AC_SUBST(XLIBS)
732 AC_SUBST(X_EXTRA_LIBS)
734 dnl ===============================================
735 dnl             End of stuff that uses X
736 dnl ===============================================
738 dnl EXIF Support
739 dnl ============
740 WM_CHECK_LIBEXIF
741 AS_IF([test "x$LIBEXIF" != "x"],
742         [AC_DEFINE(HAVE_EXIF, 1, [Define if EXIF can be used])])
745 dnl PNG Support
746 dnl ===========
747 m4_divert_push([INIT_PREPARE])dnl
748 AC_ARG_ENABLE([png],
749     [AS_HELP_STRING([--disable-png], [disable PNG support through libpng])],
750     [AS_CASE(["$enableval"],
751         [yes|no], [],
752         [AC_MSG_ERROR([bad value $enableval for --enable-png])] )],
753     [enable_png=auto])
754 m4_divert_pop([INIT_PREPARE])dnl
755 WM_IMGFMT_CHECK_PNG
758 dnl JPEG Support
759 dnl ============
760 m4_divert_push([INIT_PREPARE])dnl
761 AC_ARG_ENABLE([jpeg],
762     [AS_HELP_STRING([--disable-jpeg], [disable JPEG support through libjpeg])],
763     [AS_CASE(["$enableval"],
764         [yes|no], [],
765         [AC_MSG_ERROR([bad value $enableval for --enable-jpeg])] )],
766     [enable_jpeg=auto])
767 m4_divert_pop([INIT_PREPARE])dnl
768 WM_IMGFMT_CHECK_JPEG
771 dnl GIF Support
772 dnl ============
773 m4_divert_push([INIT_PREPARE])dnl
774 AC_ARG_ENABLE(gif,
775     [AS_HELP_STRING([--disable-gif], [disable GIF support through libgif or libungif])],
776     [AS_CASE(["$enableval"],
777         [yes|no], [],
778         [AC_MSG_ERROR([bad value $enableval for --enable-gif])] )],
779     [enable_gif=auto])
780 m4_divert_pop([INIT_PREPARE])dnl
781 WM_IMGFMT_CHECK_GIF
784 dnl TIFF Support
785 dnl ============
786 m4_divert_push([INIT_PREPARE])dnl
787 AC_ARG_ENABLE([tiff],
788     [AS_HELP_STRING([--disable-tiff], [disable use of TIFF images through libtiff])],
789     [AS_CASE(["$enableval"],
790         [yes|no], [],
791         [AC_MSG_ERROR([bad value $enableval for --enable-tiff])] )],
792     [enable_tiff=auto])
793 m4_divert_pop([INIT_PREPARE])dnl
794 WM_IMGFMT_CHECK_TIFF
797 dnl WEBP Support
798 dnl ============
799 m4_divert_push([INIT_PREPARE])dnl
800 AC_ARG_ENABLE([webp],
801     [AS_HELP_STRING([--disable-webp], [disable WEBP support through libwebp])],
802     [AS_CASE(["$enableval"],
803         [yes|no], [],
804         [AC_MSG_ERROR([bad value $enableval for --enable-webp])] )],
805     [enable_webp=auto])
806 m4_divert_pop([INIT_PREPARE])dnl
807 WM_IMGFMT_CHECK_WEBP
810 dnl MagicK Support
811 dnl ==============
812 m4_divert_push([INIT_PREPARE])dnl
813 AC_ARG_ENABLE([magick],
814     [AS_HELP_STRING([--disable-magick], [disable MAGICK support through libMagickWand])],
815     [AS_CASE(["$enableval"],
816         [yes|no], [],
817         [AC_MSG_ERROR([bad value $enableval for --enable-magick])] )],
818     [enable_magick=auto])
819 m4_divert_pop([INIT_PREPARE])dnl
820 WM_IMGFMT_CHECK_MAGICK
823 dnl PPM Support
824 dnl ===========
825 # The PPM format is always enabled because we have built-in support for the format
826 # We are not using any external library like libppm
827 supported_gfx="$supported_gfx builtin-PPM"
830 # Choice of the default format for icons
831 AS_IF([test "x$enable_tiff" != "xno"],
832     [ICONEXT="tiff"],
833     [ICONEXT="xpm"])
836 LIBRARY_SEARCH_PATH="$lib_search_path"
837 HEADER_SEARCH_PATH="$inc_search_path"
839 AC_SUBST(LIBRARY_SEARCH_PATH)
840 AC_SUBST(HEADER_SEARCH_PATH)
843 AC_SUBST(GFXLIBS)
844 AC_SUBST(ICONEXT)
845 AM_CONDITIONAL([ICON_EXT_XPM],  [test "x$ICONEXT" = "xxpm"])
846 AM_CONDITIONAL([ICON_EXT_TIFF], [test "x$ICONEXT" = "xtiff"])
849 dnl ==============================================
850 dnl         End of Graphic Format Libraries
851 dnl ==============================================
855 dnl stdlib.h is checked here, because of conflict in jpeglib.h
856 AC_CHECK_HEADERS(stdlib.h)
859 dnl Support for PIXMAPDIR option
860 dnl ============================
861 m4_divert_push([INIT_PREPARE])dnl
862 AC_ARG_WITH([pixmapdir],
863     [AS_HELP_STRING([--with-pixmapdir=PATH], [specify where pixmaps are located [DATADIR/pixmaps]])],
864     [AS_CASE([$withval],
865         [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-pixmapdir, expected a path]) ],
866         [/*],  [], dnl Absolute path, ok
867         [\$*], [], dnl Assumes it starts with a reference to $prefix or a similar variable, ok
868         [AC_MSG_ERROR([bad path '$withval' for pixmapdir, expecting an absolute path])])],
869     [with_pixmapdir=""])
870 m4_divert_pop([INIT_PREPARE])dnl
872 AS_IF([test "x$with_pixmapdir" != "x"],
873     [pixmapdir="$with_pixmapdir"],
874     [pixmapdir='${datadir}/pixmaps'])
875 AC_SUBST([pixmapdir])dnl
878 dnl Support for GNUSTEP_LOCAL_ROOT, for WPrefs.app
879 dnl ==============================================
880 m4_divert_push([INIT_PREPARE])dnl
881 AC_ARG_WITH([gnustepdir],
882     [AS_HELP_STRING([--with-gnustepdir=PATH], [specify the directory for GNUstep applications])],
883     [AS_CASE([$withval],
884         [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-gnustepdir, expected a path]) ],
885         [/*],  [], dnl Absolute path, ok
886         [\$*], [], dnl Assumes it starts with a reference to $prefix or a similar variable, ok
887         [AC_MSG_ERROR([bad path '$withval' for gnustepdir, expecting an absolute path])])],
888     [dnl If no command-line option was given, we use $GNUSTEP_LOCAL_ROOT if it was set
889      with_gnustepdir="$GNUSTEP_LOCAL_ROOT"])
890 m4_divert_pop([INIT_PREPARE])dnl
892 AS_IF([test "x$with_gnustepdir" = "x"],
893     [dnl No path specified, use default
894      wprefs_base_dir=${prefix}
895      wprefs_datadir="${datadir}/WPrefs"
896      wprefs_bindir="${bindir}"],
897     [dnl User specified base path
898      wprefs_base_dir="$with_gnustepdir/Applications"
899      wprefs_datadir="$wprefs_base_dir/WPrefs.app"
900      wprefs_bindir="$wprefs_base_dir/WPrefs.app"])
901 AC_SUBST([wprefs_datadir])dnl
902 AC_SUBST([wprefs_bindir])dnl
905 dnl Support for PKGCONFDIR option
906 dnl =============================
907 m4_divert_push([INIT_PREPARE])dnl
908 AC_ARG_WITH([pkgconfdir],
909     [AS_HELP_STRING([--with-pkgconfdir=PATH], [specify where global defaults are located [SYSCONFDIR/WindowMaker]])],
910     [AS_CASE([$withval],
911         [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-pkgconfdir, expected a path]) ],
912         [/*],  [], dnl Absolute path, ok
913         [\$*], [], dnl Assumes it starts with a reference to $prefix or a similar variable, ok
914         [AC_MSG_ERROR([bad path '$withval' for pkgconfdir, expecting an absolute path])])],
915     [with_pkgconfdir=""])
916 m4_divert_pop([INIT_PREPARE])dnl
918 dnl Provide a message when trying to use "--with-defsdatadir" so that user can update its
919 dnl arguments. Otherwise only a warning is issued, which is likely to be missed, which will
920 dnl lead to perceived misbehaviour much later (and hard to debug).
921 WM_DENY_ARG_WITH([defsdatadir],
922     [AC_MSG_ERROR([option "--with-defsdatadir" have been replaced by "--with-pkgconfdir"])])
924 AS_IF([test "x$with_pkgconfdir" != "x"],
925     [pkgconfdir="$with_pkgconfdir"],
926     [pkgconfdir='${sysconfdir}/${PACKAGE_TARNAME}'])
927 AC_SUBST([pkgconfdir])dnl
930 dnl Enable User Defined Menu thing
931 dnl ==============================
932 m4_divert_push([INIT_PREPARE])dnl
933 AC_ARG_ENABLE([usermenu],
934     [AS_HELP_STRING([--enable-usermenu], [user defined menus for applications])],
935     [AS_CASE([$enableval],
936         [yes|no], [],
937         [AC_MSG_ERROR([bad value '$enableval' for --enable-usermenu])])],
938     [enable_usermenu=no])
939 m4_divert_pop([INIT_PREPARE])dnl
941 AS_IF([test "x$enable_usermenu" = "xyes"],
942     [AC_DEFINE([USER_MENU], [1],
943         [define if you want user defined menus for applications])])
946 dnl Support for removing non-public symbols from a library
947 dnl ======================================================
948 gl_LD_VERSION_SCRIPT
951 dnl Add the post-poned compilation options
952 dnl ======================================
953 WM_CFLAGS_GCC_OPTION_POSTPONED
956 AC_SUBST(lib_search_path)
957 AC_SUBST(inc_search_path)
960 dnl Spit out the configuration
961 dnl ==========================
962 AC_CONFIG_FILES(
963     Makefile
965     dnl WRaster Library
966     wrlib/Makefile wrlib/po/Makefile
967     wrlib/tests/Makefile
969     dnl WINGs toolkit
970     WINGs/Makefile WINGs/WINGs/Makefile WINGs/po/Makefile
971     WINGs/Documentation/Makefile WINGs/Resources/Makefile WINGs/Extras/Makefile
972     WINGs/Examples/Makefile WINGs/Tests/Makefile
974     dnl Window Maker's core
975     src/Makefile src/wconfig.h po/Makefile
976     doc/Makefile doc/build/Makefile
977     doc/sk/Makefile doc/cs/Makefile doc/ru/Makefile
978     WindowMaker/Makefile WindowMaker/Backgrounds/Makefile
979     WindowMaker/Defaults/Makefile WindowMaker/IconSets/Makefile
980     WindowMaker/Icons/Makefile WindowMaker/Pixmaps/Makefile
981     WindowMaker/Styles/Makefile WindowMaker/Themes/Makefile
983     dnl Preference GUI
984     WPrefs.app/Makefile WPrefs.app/po/Makefile
985     WPrefs.app/tiff/Makefile WPrefs.app/xpm/Makefile
987     dnl Command-line utilities
988     util/Makefile util/po/Makefile
990     dnl Misceleanous stuff
991     wmlib/Makefile
992     test/Makefile
995 AC_OUTPUT
998 dnl Provide a summary of the config
999 dnl ===============================
1000 echo
1001 echo "Window Maker was configured as follows:"
1002 echo
1003 echo "Installation path prefix            : $prefix"
1004 echo "Installation path for binaries      : $_bindir"
1005 echo "Installation path for libraries     : $_libdir"
1006 echo "Installation path for WPrefs.app    : $wprefs_base_dir" | sed -e 's|\${prefix}|'"$prefix|"
1007 echo "Supported core features:            :$supported_core"
1008 echo "Supported X extensions:             :$supported_xext"
1009 echo "Supported graphic format libraries  :$supported_gfx"
1010 echo "Unsupported features                :$unsupported"
1011 echo "Pango text layout support in WINGs  : $pango"
1012 echo "Translated languages to support     :$supported_locales"
1013 AS_IF([test "x$WEB_REPO_ROOT" != "x"],
1014     [AS_ECHO(["Git repository for WMaker's Website : $WEB_REPO_ROOT"]) ])
1015 AS_IF([test "x$debug" = "xyes"],
1016     [AS_ECHO(["Debug enabled: CFLAGS = $CFLAGS"]) ])
1017 echo
1019 AS_IF([test "x$wm_cv_prog_cc_nestedfunc" != "xyes"],
1020     [AC_MSG_WARN([[Your compiler does not support Nested Function, work-around enabled]])])
1022 AS_IF([test "x$supported_locales" = "x"],
1023     [AC_MSG_WARN([[No language from \$LINGUAS are supported]])])
1025 AS_IF([test "x$enable_jpeg" = xno], [dnl
1026     AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])
1027     AS_ECHO([])
1028     AS_ECHO(["JPEG support will not be included because the JPEG library is"])
1029     AS_ECHO(["not installed correctly or was not found. Background images"])
1030     AS_ECHO(["from themes will not display as they usually are JPEG files."])
1031     AS_ECHO([])
1032     AS_ECHO(["To fix, download and install the jpeg library and/or make sure you"])
1033     AS_ECHO(["installed all jpeg related packages, SPECIALLY the development packages"])
1034     AS_ECHO(["like jpeg-dev (if you use some prepackaged version of libjpeg)."])
1035     AS_ECHO([])
1036     AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])dnl
1039 AS_IF([test "x$LINGUAS" != "x"],
1040     [AS_IF([test "X$wm_cv_library_constructors" = "Xlegacy"],
1041         [AC_MSG_WARN([I18N is enabled, but library constructor attribute is not supported])
1042          AS_ECHO(["   If you have translation problems in lib WRaster, yet you know that the translation"])
1043          AS_ECHO(["   file (po) is valid, this could be a cause."])
1044          AS_ECHO([])dnl
1045         ])dnl
1046     ])
1049 dnl This is for Emacs.  I'm lazy, I know... (nicolai)
1050 dnl ================================================
1051 dnl Local Variables:
1052 dnl compile-command: "autoconf"
1053 dnl End: