wmaker: make the '--replace' de-activable at compile time
[wmaker-crm.git] / configure.ac
blob40f76fb3dbf5a8e06ecf0dcd3a1f50c3661ab7c0
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.6],[wmaker-dev@lists.windowmaker.org],[WindowMaker],[http://www.windowmaker.org/])
38 AC_CONFIG_MACRO_DIR([m4])
39 AC_CONFIG_HEADERS([config.h])
40 AM_INIT_AUTOMAKE([1.11 silent-rules])
42 dnl Reference file used by 'configure' to make sure the path to sources is valid
43 AC_CONFIG_SRCDIR([src/WindowMaker.h])
45 dnl Include at the end of 'config.h', this file is generated by top-level Makefile
46 AH_BOTTOM([@%:@include "config-paths.h"])
49 dnl libtool library versioning
50 dnl ==========================
51 dnl
52 dnl current
53 dnl revision
54 dnl age
55 dnl
56 dnl 1. Start with version information of ‘0:0:0’ for each libtool library.
57 dnl 2. Update the version information only immediately before a public
58 dnl release of your software. More frequent updates are unnecessary, and
59 dnl only guarantee that the current interface number gets larger faster.
60 dnl 3. If the library source code has changed at all since the last
61 dnl update, then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
62 dnl 4. If any interfaces have been added, removed, or changed since the
63 dnl last update, increment current, and set revision to 0.
64 dnl 5. If any interfaces have been added since the last public release,
65 dnl then increment age.
66 dnl 6. If any interfaces have been removed or changed since the last
67 dnl public release, then set age to 0.
68 dnl
69 dnl libwraster
70 WRASTER_CURRENT=5
71 WRASTER_REVISION=0
72 WRASTER_AGE=0
73 WRASTER_VERSION=$WRASTER_CURRENT:$WRASTER_REVISION:$WRASTER_AGE
74 AC_SUBST(WRASTER_VERSION)
75 dnl
76 dnl libWINGs
77 WINGS_CURRENT=4
78 WINGS_REVISION=0
79 WINGS_AGE=1
80 WINGS_VERSION=$WINGS_CURRENT:$WINGS_REVISION:$WINGS_AGE
81 AC_SUBST(WINGS_VERSION)
82 dnl
83 dnl libWUtil
84 WUTIL_CURRENT=5
85 WUTIL_REVISION=0
86 WUTIL_AGE=0
87 WUTIL_VERSION=$WUTIL_CURRENT:$WUTIL_REVISION:$WUTIL_AGE
88 AC_SUBST(WUTIL_VERSION)
91 dnl Checks for programs
92 dnl ===================
93 AC_PROG_CC
94 WM_PROG_CC_C11
95 AC_PROG_LN_S
96 AC_PROG_GCC_TRADITIONAL
97 LT_INIT
100 dnl Debugging Options
101 dnl =================
102 AC_ARG_ENABLE([debug],
103     [AS_HELP_STRING([--enable-debug], [enable debugging options, @<:@default=no@:>@])],
104     [AS_CASE(["$enableval"],
105         [yes], [debug=yes],
106         [no],  [debug=no],
107         [AC_MSG_ERROR([bad value $enableval for --enable-debug])] )],
108     [debug=no])
109 AS_IF([test "x$debug" = "xyes"],
110     [dnl This flag should have already been detected and added, but if user
111      dnl provided an explicit CFLAGS it may not be the case
112      AS_IF([echo " $CFLAGS " | grep " -g " 2>&1 > /dev/null],
113            [@%:@ Debug symbol already activated],
114            [AX_CFLAGS_GCC_OPTION([-g])])
115      dnl
116      dnl This flag generally makes debugging nightmarish, remove it if present
117      CFLAGS="`echo "$CFLAGS" | sed -e 's/-fomit-frame-pointer *//' `"
118      dnl
119      dnl Enable internal debug code
120      CPPFLAGS="$CPPFLAGS -DDEBUG"
121 ],  [dnl
122      dnl When debug is not enabled, the user probably does not wants to keep
123      dnl assertions in the final program
124      CPPFLAGS="$CPPFLAGS -DNDEBUG"
128 AX_CFLAGS_GCC_OPTION([-Wall])
129 AX_CFLAGS_GCC_OPTION([-Wextra -Wno-sign-compare])
131 dnl The use of trampolines cause code that can crash on some secured OS, it is
132 dnl also known to be a source of crash if not used properly, in a more general
133 dnl way it tends to generate binary code that may not be optimal, and it is
134 dnl not compatible with the 'nested-func-to-macro' workaround
135 WM_CFLAGS_CHECK_FIRST([-Wtrampolines],
136          [-Werror=trampolines  dnl try to generate an error if possible
137           -Wtrampolines        dnl if not, try to fall back to a simple warning
138          ])
140 AS_IF([test "x$debug" = "xyes"],
141     [dnl When debug is enabled, we try to activate more checks from
142      dnl the compiler. They are on independant check because the
143      dnl macro checks all the options at once, but we may have cases
144      dnl where some options are not supported and we don't want to
145      dnl loose all of them.
146      dnl
147      dnl clang, suggest parenthesis on bit operations that could be
148      dnl misunderstood due to C operator precedence
149      AX_CFLAGS_GCC_OPTION([-Wbitwise-op-parentheses])
150      dnl
151      dnl Points at code that gcc thinks is so complicated that gcc
152      dnl gives up trying to optimize, which probably also means it is
153      dnl too complicated to maintain
154      AX_CFLAGS_GCC_OPTION([-Wdisabled-optimization])
155      dnl
156      dnl Floating-point comparison is not a good idea
157      AX_CFLAGS_GCC_OPTION([-Wfloat-equal])
158      dnl
159      dnl clang warns about constants that may have portability issues due
160      dnl to the endianness of the host
161      AX_CFLAGS_GCC_OPTION([-Wfour-char-constants])
162      dnl
163      dnl clang warns about constant that may be too big to be portable
164      AX_CFLAGS_GCC_OPTION([-Wliteral-range])
165      dnl
166      dnl Try to report misuses of '&' versus '&&' and similar
167      AX_CFLAGS_GCC_OPTION([-Wlogical-op])
168      dnl
169      dnl clang, reports cases where the code assumes everyone is an
170      dnl expert in C operator precedence... which is unlikely!
171      AX_CFLAGS_GCC_OPTION([-Wlogical-op-parentheses])
172      dnl
173      dnl Reports declaration of global things that are done inside
174      dnl a local environment, instead of using the appropriate
175      dnl header
176      AX_CFLAGS_GCC_OPTION([-Wnested-externs])
177      dnl
178      dnl Warn about constant strings that could pose portability issues
179      AX_CFLAGS_GCC_OPTION([-Woverlength-strings])
180      dnl
181      dnl Use of 'sizeof()' on inappropriate pointer types
182      AX_CFLAGS_GCC_OPTION([-Wpointer-arith])
183      dnl
184      dnl Having more than 1 prototype for a function makes code updates
185      dnl more difficult, so try to avoid it
186      AX_CFLAGS_GCC_OPTION([-Wredundant-decls])
187      dnl
188      dnl clang, detect some misuses of sizeof. We also count in our code
189      dnl on the use of the macro 'wlength' which contains a check if the
190      dnl compiler support C11's static_assert
191      AX_CFLAGS_GCC_OPTION([-Wsizeof-array-argument])
192      dnl
193      dnl Prototype of function must be explicit, no deprecated K&R syntax
194      dnl and no empty argument list which prevents compiler from doing
195      dnl type checking when using the function
196      WM_CFLAGS_GCC_OPTION_STRICTPROTO
197      dnl
198      dnl Proper attributes helps the compiler to produce better code
199      WM_CFLAGS_CHECK_FIRST([format attribute suggest],
200          [-Wsuggest-attribute=format  dnl new gcc syntax
201           -Wmissing-format-attribute  dnl old gcc syntax, clang
202          ])
203      WM_CFLAGS_CHECK_FIRST([no-return attribute suggest],
204          [-Wsuggest-attribute=noreturn  dnl gcc syntax
205           -Wmissing-noreturn            dnl clang syntax
206          ])
207      dnl
208      dnl GCC provides a couple of checks to detect incorrect macro uses
209      AX_CFLAGS_GCC_OPTION([-Wundef])
210      WM_CFLAGS_GCC_OPTION_UNUSEDMACROS
211      dnl
212      dnl clang reports stuff marked unused but which is actually used
213      AX_CFLAGS_GCC_OPTION([-Wused-but-marked-unused])
214 ], [dnl
215      dnl When debug not enabled, we try to avoid some non-necessary
216      dnl messages from the compiler
217      dnl
218      dnl To support legacy X servers, we have sometime to use
219      dnl functions marked as deprecated. We do not wish our users
220      dnl to be worried about it
221      AX_CFLAGS_GCC_OPTION([-Wno-deprecated])
222      AX_CFLAGS_GCC_OPTION([-Wno-deprecated-declarations])
226 dnl Support for Nested Functions by the compiler
227 dnl ============================================
228 WM_PROG_CC_NESTEDFUNC
231 dnl Posix thread
232 dnl ============
233 dnl they are used by util/wmiv
234 AX_PTHREAD
237 dnl Tracking on what is detected for final status
238 dnl =============================================
239 unsupported=""
240 supported_core=""
241 supported_xext=""
242 supported_gfx=""
245 dnl Platform-specific Makefile setup
246 dnl ================================
247 AS_CASE(["$host"],
248     [*-*-linux*|*-*-cygwin*|*-gnu*], [WM_OSDEP="linux" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"],
249     [*-*-freebsd*|*-k*bsd-gnu*],     [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -DFREEBSD"],
250     [*-*-netbsd*],                   [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DNETBSD"],
251     [*-*-openbsd*],                  [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DOPENBSD"],
252     [*-*-dragonfly*],                [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DDRAGONFLYBSD"],
253     [*-apple-darwin*],               [WM_OSDEP="darwin"],
254     [*-*-solaris*],                  [WM_OSDEP="stub"],  dnl  solaris.c when done
255     [WM_OSDEP="stub"])
256 AM_CONDITIONAL([WM_OSDEP_LINUX],   [test "x$WM_OSDEP" = "xlinux"])
257 AM_CONDITIONAL([WM_OSDEP_BSD],     [test "x$WM_OSDEP" = "xbsd"])
258 AM_CONDITIONAL([WM_OSDEP_DARWIN],  [test "x$WM_OSDEP" = "xdarwin"])
259 AM_CONDITIONAL([WM_OSDEP_GENERIC], [test "x$WM_OSDEP" = "xstub"])
262 dnl the prefix
263 dnl ==========
265 dnl move this earlier in the script... anyone know why this is handled
266 dnl in such a bizarre way?
268 test "x$prefix" = xNONE && prefix=$ac_default_prefix
269 dnl Let make expand exec_prefix.
270 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
273 _bindir=`eval echo $bindir`
274 _bindir=`eval echo $_bindir`
276 lib_search_path='-L${libdir}'
278 inc_search_path='-I${includedir}'
280 dnl ===============================================
281 dnl Specify paths to look for libraries and headers
282 dnl ===============================================
283 AC_ARG_WITH(libs-from, AS_HELP_STRING([--with-libs-from], [pass compiler flags to look for libraries]),
284         [lib_search_path="$withval $lib_search_path"])
286 AC_ARG_WITH(incs-from, AS_HELP_STRING([--with-incs-from], [pass compiler flags to look for header files]),
287         [inc_search_path="$withval $inc_search_path"])
290 dnl Features Configuration
291 dnl ======================
292 AC_ARG_ENABLE([animations],
293     [AS_HELP_STRING([--disable-animations], [disable permanently animations @<:@default=enabled@:>@])],
294     [AS_CASE(["$enableval"],
295         [yes|no], [],
296         [AC_MSG_ERROR([bad value $enableval for --enable-animations])])],
297     [enable_animations="yes"])
298 AS_IF([test "x$enable_animations" = "xno"],
299     [unsupported="$unsupported Animations"],
300     [AC_DEFINE([USE_ANIMATIONS], [1], [Defined when user did not request to disable animations])
301      supported_core="$supported_core Animations"])
304 AC_ARG_ENABLE([mwm-hints],
305     [AS_HELP_STRING([--disable-mwm-hints], [disable support for Motif WM hints @<:@default=enabled@:>@])],
306     [AS_CASE(["$enableval"],
307         [yes|no], [],
308         [AC_MSG_ERROR([bad value $enableval for --enable-mwm-hints])])],
309     [enable_mwm_hints="yes"])
310 AS_IF([test "x$enable_mwm_hints" = "xno"],
311     [unsupported="$unsupported MWMHints"],
312     [AC_DEFINE([USE_MWM_HINTS], [1], [Defined when used did not request to disable Motif WM hints])
313      supported_core="$supported_core MWMHints"])
314 AM_CONDITIONAL([USE_MWM_HINTS], [test "x$enable_mwm_hints" != "xno"])
317 dnl Boehm GC
318 dnl ========
319 AC_ARG_ENABLE([boehm-gc],
320     [AS_HELP_STRING([--enable-boehm-gc], [use Boehm GC instead of the default libc malloc() [default=no]])],
321     [AS_CASE(["$enableval"],
322         [yes], [with_boehm_gc=yes],
323         [no],  [with_boehm_gc=no],
324         [AC_MSG_ERROR([bad value $enableval for --enable-boehm-gc])] )],
325     [with_boehm_gc=no])
326 AS_IF([test "x$with_boehm_gc" = "xyes"],
327     AC_SEARCH_LIBS([GC_malloc], [gc],
328         [AC_DEFINE(USE_BOEHM_GC, 1, [Define if Boehm GC is to be used])],
329         [AC_MSG_FAILURE([--enable-boehm-gc specified but test for libgc failed])]))
332 dnl LCOV
333 dnl ====
334 AC_ARG_ENABLE([lcov],
335     [AS_HELP_STRING([--enable-lcov[=output-directory]], [enable coverage data generation using LCOV (GCC only) [default=no]])],
336     [],
337     [enable_lcov=no])
339 AS_IF([test "x$enable_lcov" != "xno"],
340     [AX_CFLAGS_GCC_OPTION(-fprofile-arcs -ftest-coverage)
341     AS_IF([test "x$enable_lcov" = "xyes"],
342         [lcov_output_directory="coverage-report"],
343         [lcov_output_directory="${enable_lcov}/coverage-report"])
344     AC_SUBST(lcov_output_directory)])
346 AM_CONDITIONAL([USE_LCOV], [test "x$enable_lcov" != "xno"])
349 dnl ============================
350 dnl Checks for library functions
351 dnl ============================
352 AC_FUNC_MEMCMP
353 AC_FUNC_VPRINTF
354 WM_FUNC_SECURE_GETENV
355 AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
356                setsid mallinfo mkstemp sysconf)
357 AC_SEARCH_LIBS([strerror], [cposix])
359 dnl nanosleep is generally available in standard libc, although not always the
360 dnl case. One known example is Solaris which needs -lrt
361 AC_SEARCH_LIBS([nanosleep], [rt], [],
362     [AC_MSG_ERROR([function 'nanosleep' not found, please report to wmaker-dev@lists.windowmaker.org])])
364 dnl the flag 'O_NOFOLLOW' for 'open' is used in WINGs
365 WM_FUNC_OPEN_NOFOLLOW
368 dnl Check for strlcat/strlcpy
369 dnl =========================
370 AC_ARG_WITH([libbsd],
371   [AS_HELP_STRING([--without-libbsd], [do not use libbsd for strlcat and strlcpy [default=check]])],
372   [AS_IF([test "x$with_libbsd" != "xno"],
373     [with_libbsd=bsd]
374     [with_libbsd=]
375   )],
376   [with_libbsd=bsd])
378 tmp_libs=$LIBS
379 AC_SEARCH_LIBS([strlcat],[$with_libbsd],
380   [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available])],
381   [],
382   []
384 AC_SEARCH_LIBS([strlcpy],[$with_libbsd],
385   [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcpy is available])],
386   [],
387   []
389 LIBS=$tmp_libs
391 LIBBSD=
392 AS_IF([test "x$ac_cv_search_strlcat" = "x-lbsd" -o "x$ac_cv_search_strlcpy" = "x-lbsd"],
393   [LIBBSD=-lbsd
394    AC_CHECK_HEADERS([bsd/string.h])]
396 AC_SUBST(LIBBSD)
399 dnl Check for OpenBSD kernel memory interface - kvm(3)
400 dnl ==================================================
401 AS_IF([test "x$WM_OSDEP" = "xbsd"],
402   AC_SEARCH_LIBS([kvm_openfiles], [kvm]) )
405 dnl Check for inotify
406 dnl =================
407 dnl It is used by WindowMaker to reload automatically the configuration when the
408 dnl user changed it using WPref or wdwrite
409 AC_CHECK_HEADERS([sys/inotify.h],
410     [AC_DEFINE([HAVE_INOTIFY], [1], [Check for inotify])])
413 dnl Check for syslog 
414 dnl ================
415 dnl It is used by WUtil to log the wwarning, werror and wfatal
416 AC_CHECK_HEADERS([syslog.h], [AC_DEFINE([HAVE_SYSLOG], [1], [Check for syslog])])
419 dnl Checks for header files
420 dnl =======================
421 AC_HEADER_SYS_WAIT
422 AC_HEADER_TIME
423 AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h libintl.h poll.h malloc.h ctype.h \
424                  string.h strings.h)
427 dnl Checks for typedefs, structures, and compiler characteristics
428 dnl =============================================================
429 AC_C_CONST
430 AC_C_INLINE
431 WM_C_NORETURN
432 AC_TYPE_SIZE_T
433 AC_TYPE_PID_T
434 WM_TYPE_SIGNAL
437 dnl pkg-config
438 dnl ==========
439 AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config])
443 dnl Internationalization
444 dnl ====================
445 dnl Detect the language for translations to be installed and check
446 dnl that the gettext environment works
447 WM_I18N_LANGUAGES
448 WM_I18N_XGETTEXT
449 WM_I18N_MENUTEXTDOMAIN
451 dnl 2014/12/29: The option is deprecated, we should keep this message for at
452 dnl least 2 years to ensure users see it and update their build scripts
453 AC_ARG_WITH([nlsdir], [],
454     [AC_MSG_ERROR([option '--with-nlsdir' is deprecated, please use autoconf's standard '--localedir' instead])])
457 dnl ===========================================
458 dnl             Stuff that uses X
459 dnl ===========================================
461 AC_PATH_XTRA
463 AS_IF([test "x$no_x" = "xyes"],
464     [AC_MSG_ERROR([The path for the X11 files not found!
465 Make sure you have X and it's headers and libraries (the -devel packages
466 in Linux) installed.])])
468 X_LIBRARY_PATH=$x_libraries
469 XCFLAGS="$X_CFLAGS"
470 XLFLAGS="$X_LIBS"
471 XLIBS="-lX11 $X_EXTRA_LIBS"
473 lib_search_path="$lib_search_path $XLFLAGS"
474 inc_search_path="$inc_search_path $XCFLAGS"
476 AC_SUBST(X_LIBRARY_PATH)
479 dnl Decide which locale function to use, setlocale() or _Xsetlocale()
480 dnl by MANOME Tomonori 
481 dnl ===========================================
482 WM_I18N_XLOCALE
486 dnl Check whether XInternAtoms() exist
487 dnl ==================================
488 AC_CHECK_LIB([X11], [XInternAtoms],
489     [AC_DEFINE([HAVE_XINTERNATOMS], [1],
490         [define if your X server has XInternAtoms() (set by configure)])],
491     [], [$XLFLAGS $XLIBS])
494 dnl Check whether XConvertCase() exist
495 dnl ==================================
496 AC_CHECK_LIB([X11], [XConvertCase],
497     [AC_DEFINE([HAVE_XCONVERTCASE], [1],
498         [define if your X server has XConvertCase() (set by configure)])],
499     [], [$XLFLAGS $XLIBS])
502 dnl XKB keyboard language status
503 dnl ============================
504 AC_ARG_ENABLE([modelock],
505     [AS_HELP_STRING([--enable-modelock], [XKB keyboard language status support])],
506     [AS_CASE([$enableval],
507         [yes|no], [],
508         [AC_MSG_ERROR([bad value '$enableval' for --enable-modelock])])],
509     [enable_modelock=no])
510 AS_IF([test "x$enable_modelock" = "xyes"],
511     [AC_DEFINE([XKB_MODELOCK], [1], [whether XKB language MODELOCK should be enabled]) ])
514 dnl XDND Drag-nd-Drop support
515 dnl =========================
516 AC_ARG_ENABLE([xdnd],
517     [AS_HELP_STRING([--disable-xdnd], [disable support for Drag-and-Drop on the dock @<:@default=enabled@:>@])],
518     [AS_CASE(["$enableval"],
519         [yes|no], [],
520         [AC_MSG_ERROR([bad value $enableval for --disable-xdnd]) ]) ],
521     [enable_xdnd=yes])
522 AS_IF([test "x$enable_xdnd" = "xyes"],
523     [supported_core="$supported_core XDnD"
524      AC_DEFINE([USE_DOCK_XDND], [1], [whether Drag-and-Drop on the dock should be enabled])],
525     [unsupported="$unsupported XDnd"])
526 AM_CONDITIONAL([USE_DOCK_XDND], [test "x$enable_dock_xdnd" != "xno"])
529 dnl Support for ICCCM 2.0 Window Manager replacement
530 dnl ================================================
531 AC_ARG_ENABLE([wmreplace],
532     [AS_HELP_STRING([--enable-wmreplace], [support for ICCCM window manager replacement])],
533     [AS_CASE([$enableval],
534         [yes|no], [],
535         [AC_MSG_ERROR([bad value '$enableval' for --enable-wmreplace])])],
536     [enable_wmreplace=no])
537 AS_IF([test "x$enable_wmreplace" = "xyes"],
538     [AC_DEFINE([USE_ICCCM_WMREPLACE], [1],
539        [define to support ICCCM protocol for window manager replacement])
540      supported_xext="$supported_xext WMReplace"])
543 dnl XShape support
544 dnl ==============
545 AC_ARG_ENABLE([shape],
546     [AS_HELP_STRING([--disable-shape], [disable shaped window extension support])],
547     [AS_CASE(["$enableval"],
548         [yes|no], [],
549         [AC_MSG_ERROR([bad value $enableval for --enable-shape]) ]) ],
550     [enable_shape=auto])
551 WM_XEXT_CHECK_XSHAPE
554 dnl MIT-SHM support
555 dnl ===============
556 AC_ARG_ENABLE([shm],
557     [AS_HELP_STRING([--disable-shm], [disable usage of MIT-SHM extension])],
558     [AS_CASE(["$enableval"],
559         [yes|no], [],
560         [AC_MSG_ERROR([bad value $enableval for --enable-shm]) ]) ],
561     [enable_shm=auto])
562 WM_XEXT_CHECK_XSHM
565 dnl X Misceleanous Utility
566 dnl ======================
567 dnl the libXmu is used in WRaster
568 WM_EXT_CHECK_XMU
571 dnl XINERAMA support
572 dnl ================
573 AC_ARG_ENABLE([xinerama],
574     [AS_HELP_STRING([--enable-xinerama], [enable Xinerama extension support])],
575     [AS_CASE(["$enableval"],
576         [yes|no], [],
577         [AC_MSG_ERROR([bad value $enableval for --enable-xinerama]) ]) ],
578     [enable_xinerama=auto])
579 WM_XEXT_CHECK_XINERAMA
582 dnl RandR support
583 dnl =============
584 AC_ARG_ENABLE([randr],
585     [AS_HELP_STRING([--enable-randr], [enable RandR extension support (NOT recommended, buggy)])],
586     [AS_CASE(["$enableval"],
587         [yes|no], [],
588         [AC_MSG_ERROR([bad value $enableval for --enable-randr]) ]) ],
589     [enable_randr=no])
590 WM_XEXT_CHECK_XRANDR
593 dnl Math library
594 dnl ============
595 dnl libWINGS uses math functions, check whether usage requires linking
596 dnl against libm
597 WM_CHECK_LIBM
600 dnl FontConfig
601 dnl ==========
602 dnl libWINGS uses FcPatternDel from libfontconfig
603 AC_MSG_CHECKING([for fontconfig library])
604 FCLIBS=`$PKGCONFIG fontconfig --libs`
605 if test "x$FCLIBS" = "x" ; then
606         AC_MSG_RESULT([not found])
607 else
608         AC_MSG_RESULT([found])
610 AC_SUBST(FCLIBS)
613 dnl Xft2 antialiased font support
614 dnl =============================
616 xft=yes
617 XFTLIBS=""
619 if test "x$PKGCONFIG" != x -a "`$PKGCONFIG xft; echo $?`" = 0; then
620         XFTCONFIG="$PKGCONFIG xft"
621         pkgconfig_xft=yes
622 else
623         AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config)
626 AC_MSG_CHECKING([for the Xft2 library])
628 if test "x$XFTCONFIG" != x; then
629         XFTLIBS=`$XFTCONFIG --libs`
630         XFTFLAGS=`$XFTCONFIG --cflags`
631         AC_MSG_RESULT([found])
632 else
633         AC_MSG_RESULT([not found])
634         echo
635         echo "ERROR!!! libXft2 is not installed or could not be found."
636         echo "         Xft2 is a requirement for building Window Maker."
637         echo "         Please install it (along with fontconfig) before continuing."
638         echo
639         exit 1
642 minXFT="2.1.0"
643 goodxft="no"
646 dnl The macro below will use $XFTFLAGS (defined above) to find Xft.h
648 WM_CHECK_XFT_VERSION($minXFT, goodxft=yes, goodxft=no)
650 if test "$goodxft" = no; then
651         echo
652         echo "ERROR!!! libXft on this system is an old version."
653         echo "         Please consider upgrading to at least version ${minXFT}."
654         echo
655         exit 1
658 AC_SUBST(XFTFLAGS)
659 AC_SUBST(XFTLIBS)
661 dnl PANGO support
662 dnl =============
663 pango=no
664 AC_ARG_ENABLE(pango, AS_HELP_STRING([--enable-pango], [enable Pango text layout support]),
665                 pango=$enableval, pango=no)
667 PANGOFLAGS=
668 PANGOLIBS=
669 if test "$pango" = yes; then
670         PANGOLIBS=`$PKGCONFIG pangoxft --libs`
671         PANGOFLAGS=`$PKGCONFIG pangoxft --cflags`
672         if test "x$PANGOLIBS" = "x" ; then
673                 AC_MSG_RESULT([not found])
674         else
675                 AC_DEFINE(USE_PANGO, 1, [Define if Pango is to be used])
676                 AC_MSG_RESULT([found])
677         fi
679 inc_search_path="$inc_search_path $PANGOFLAGS"
680 AC_SUBST(PANGOLIBS)
682 dnl ==============================================
683 dnl         Graphic Format Libraries
684 dnl ==============================================
686 dnl XPM Support
687 dnl ===========
688 AC_ARG_ENABLE([xpm],
689     [AS_HELP_STRING([--disable-xpm], [disable use of XPM pixmaps through libXpm])],
690     [AS_CASE(["$enableval"],
691         [yes|no], [],
692         [AC_MSG_ERROR([bad value $enableval for --enable-xpm])] )],
693     [enable_xpm=auto])
694 WM_IMGFMT_CHECK_XPM
697 # for wmlib
698 AC_SUBST(XCFLAGS)
699 # for test
700 AC_SUBST(XLFLAGS)
701 AC_SUBST(XLIBS)
702 AC_SUBST(X_EXTRA_LIBS)
704 dnl ===============================================
705 dnl             End of stuff that uses X
706 dnl ===============================================
708 dnl EXIF Support
709 dnl ============
710 WM_CHECK_LIBEXIF
711 AS_IF([test "x$LIBEXIF" != "x"],
712         [AC_DEFINE(HAVE_EXIF, 1, [Define if EXIF can be used])])
715 dnl PNG Support
716 dnl ===========
717 AC_ARG_ENABLE([png],
718     [AS_HELP_STRING([--disable-png], [disable PNG support through libpng])],
719     [AS_CASE(["$enableval"],
720         [yes|no], [],
721         [AC_MSG_ERROR([bad value $enableval for --enable-png])] )],
722     [enable_png=auto])
723 WM_IMGFMT_CHECK_PNG
726 dnl JPEG Support
727 dnl ============
728 AC_ARG_ENABLE([jpeg],
729     [AS_HELP_STRING([--disable-jpeg], [disable JPEG support through libjpeg])],
730     [AS_CASE(["$enableval"],
731         [yes|no], [],
732         [AC_MSG_ERROR([bad value $enableval for --enable-jpeg])] )],
733     [enable_jpeg=auto])
734 WM_IMGFMT_CHECK_JPEG
737 dnl GIF Support
738 dnl ============
739 AC_ARG_ENABLE(gif,
740     [AS_HELP_STRING([--disable-gif], [disable GIF support through libgif or libungif])],
741     [AS_CASE(["$enableval"],
742         [yes|no], [],
743         [AC_MSG_ERROR([bad value $enableval for --enable-gif])] )],
744     [enable_gif=auto])
745 WM_IMGFMT_CHECK_GIF
748 dnl TIFF Support
749 dnl ============
750 AC_ARG_ENABLE([tiff],
751     [AS_HELP_STRING([--disable-tiff], [disable use of TIFF images through libtiff])],
752     [AS_CASE(["$enableval"],
753         [yes|no], [],
754         [AC_MSG_ERROR([bad value $enableval for --enable-tiff])] )],
755     [enable_tiff=auto])
756 WM_IMGFMT_CHECK_TIFF
759 dnl WEBP Support
760 dnl ============
761 AC_ARG_ENABLE([webp],
762     [AS_HELP_STRING([--disable-webp], [disable WEBP support through libwebp])],
763     [AS_CASE(["$enableval"],
764         [yes|no], [],
765         [AC_MSG_ERROR([bad value $enableval for --enable-webp])] )],
766     [enable_webp=auto])
767 WM_IMGFMT_CHECK_WEBP
770 dnl MagicK Support
771 dnl ==============
772 AC_ARG_ENABLE([magick],
773     [AS_HELP_STRING([--disable-magick], [disable MAGICK support through libMagickWand])],
774     [AS_CASE(["$enableval"],
775         [yes|no], [],
776         [AC_MSG_ERROR([bad value $enableval for --enable-magick])] )],
777     [enable_magick=auto])
778 WM_IMGFMT_CHECK_MAGICK
781 dnl PPM Support
782 dnl ===========
783 # The PPM format is always enabled because we have built-in support for the format
784 # We are not using any external library like libppm
785 supported_gfx="$supported_gfx builtin-PPM"
788 # Choice of the default format for icons
789 AS_IF([test "x$enable_tiff" != "xno"],
790     [ICONEXT="tiff"],
791     [ICONEXT="xpm"])
794 LIBRARY_SEARCH_PATH="$lib_search_path"
795 HEADER_SEARCH_PATH="$inc_search_path"
797 AC_SUBST(LIBRARY_SEARCH_PATH)
798 AC_SUBST(HEADER_SEARCH_PATH)
801 AC_SUBST(GFXLIBS)
802 AC_SUBST(ICONEXT)
803 AM_CONDITIONAL([ICON_EXT_XPM],  [test "x$ICONEXT" = "xxpm"])
804 AM_CONDITIONAL([ICON_EXT_TIFF], [test "x$ICONEXT" = "xtiff"])
807 dnl ==============================================
808 dnl         End of Graphic Format Libraries
809 dnl ==============================================
813 dnl stdlib.h is checked here, because of conflict in jpeglib.h
814 AC_CHECK_HEADERS(stdlib.h)
817 dnl Support for PIXMAPDIR option
818 dnl ============================
819 AC_ARG_WITH([pixmapdir],
820     [AS_HELP_STRING([--with-pixmapdir=PATH], [specify where pixmaps are located [DATADIR/pixmaps]])],
821     [AS_CASE([$withval],
822         [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-pixmapdir, expected a path]) ],
823         [/*],  [], dnl Absolute path, ok
824         [\$*], [], dnl Assumes it starts with a reference to $prefix or a similar variable, ok
825         [AC_MSG_ERROR([bad path '$withval' for pixmapdir, expecting an absolute path])])],
826     [with_pixmapdir=""])
828 AS_IF([test "x$with_pixmapdir" != "x"],
829     [pixmapdir="$with_pixmapdir"],
830     [pixmapdir='${datadir}/pixmaps'])
831 AC_SUBST([pixmapdir])dnl
834 dnl Support for GNUSTEP_LOCAL_ROOT, for WPrefs.app
835 dnl ==============================================
836 AC_ARG_WITH([gnustepdir],
837     [AS_HELP_STRING([--with-gnustepdir=PATH], [specify the directory for GNUstep applications])],
838     [AS_CASE([$withval],
839         [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-gnustepdir, expected a path]) ],
840         [/*],  [], dnl Absolute path, ok
841         [\$*], [], dnl Assumes it starts with a reference to $prefix or a similar variable, ok
842         [AC_MSG_ERROR([bad path '$withval' for gnustepdir, expecting an absolute path])])],
843     [dnl If no command-line option was given, we use $GNUSTEP_LOCAL_ROOT if it was set
844      with_gnustepdir="$GNUSTEP_LOCAL_ROOT"])
846 AS_IF([test "x$with_gnustepdir" = "x"],
847     [dnl No path specified, use default
848      wprefs_base_dir=${prefix}
849      wprefs_datadir="${datadir}/WPrefs"
850      wprefs_bindir="${bindir}"],
851     [dnl User specified base path
852      wprefs_base_dir="$with_gnustepdir/Applications"
853      wprefs_datadir="$wprefs_base_dir/WPrefs.app"
854      wprefs_bindir="$wprefs_base_dir/WPrefs.app"])
855 AC_SUBST([wprefs_datadir])dnl
856 AC_SUBST([wprefs_bindir])dnl
859 dnl Enable User Defined Menu thing
860 dnl ==============================
861 AC_ARG_ENABLE([usermenu],
862     [AS_HELP_STRING([--enable-usermenu], [user defined menus for applications])],
863     [AS_CASE([$enableval],
864         [yes|no], [],
865         [AC_MSG_ERROR([bad value '$enableval' for --enable-usermenu])])],
866     [enable_usermenu=no])
867 AS_IF([test "x$enable_usermenu" = "xyes"],
868     [AC_DEFINE([USER_MENU], [1],
869         [define if you want user defined menus for applications])])
872 dnl Support for removing non-public symbols from a library
873 dnl ======================================================
874 gl_LD_VERSION_SCRIPT
877 dnl Add the post-poned compilation options
878 dnl ======================================
879 WM_CFLAGS_GCC_OPTION_POSTPONED
882 AC_SUBST(lib_search_path)
883 AC_SUBST(inc_search_path)
886 dnl Spit out the configuration
887 dnl ==========================
888 AC_CONFIG_FILES(
889     Makefile
891     dnl WRaster Library
892     wrlib/Makefile
893     wrlib/tests/Makefile
895     dnl WINGs toolkit
896     WINGs/Makefile WINGs/WINGs/Makefile WINGs/po/Makefile
897     WINGs/Documentation/Makefile WINGs/Resources/Makefile WINGs/Extras/Makefile
898     WINGs/Examples/Makefile WINGs/Tests/Makefile
900     dnl Window Maker's core
901     src/Makefile src/wconfig.h po/Makefile
902     doc/Makefile doc/build/Makefile
903     doc/sk/Makefile doc/cs/Makefile doc/ru/Makefile
904     WindowMaker/Makefile WindowMaker/Backgrounds/Makefile
905     WindowMaker/Defaults/Makefile WindowMaker/IconSets/Makefile
906     WindowMaker/Icons/Makefile WindowMaker/Pixmaps/Makefile
907     WindowMaker/Styles/Makefile WindowMaker/Themes/Makefile
909     dnl Preference GUI
910     WPrefs.app/Makefile WPrefs.app/po/Makefile
911     WPrefs.app/tiff/Makefile WPrefs.app/xpm/Makefile
913     dnl Command-line utilities
914     util/Makefile util/po/Makefile
916     dnl Misceleanous stuff
917     wmlib/Makefile
918     test/Makefile
921 AC_OUTPUT
924 dnl Provide a summary of the config
925 dnl ===============================
926 echo
927 echo "Window Maker was configured as follows:"
928 echo
929 echo "Installation path prefix            : $prefix"
930 echo "Installation path for binaries      : $_bindir"
931 echo "Installation path for libraries     : $libdir"
932 echo "Installation path for WPrefs.app    : $wprefs_base_dir" | sed -e 's|\${prefix}|'"$prefix|"
933 echo "Supported core features:            :$supported_core"
934 echo "Supported X extensions:             :$supported_xext"
935 echo "Supported graphic format libraries  :$supported_gfx"
936 echo "Unsupported features                :$unsupported"
937 echo "Antialiased text support in WINGs   : $xft"
938 echo "Pango text layout support in WINGs  : $pango"
939 echo "Translated languages to support     :$supported_locales"
940 AS_IF([test "x$debug" = "xyes"],
941     [AS_ECHO(["Debug enabled: CFLAGS = $CFLAGS"]) ])
942 echo
944 AS_IF([test "x$wm_cv_prog_cc_nestedfunc" != "xyes"],
945     [AC_MSG_WARN([[Your compiler does not support Nested Function, work-around enabled]])])
947 AS_IF([test "x$supported_locales" = "x"],
948     [AC_MSG_WARN([[No language from \$LINGUAS are supported]])])
950 AS_IF([test "x$enable_jpeg" = xno], [dnl
951     AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])
952     AS_ECHO([])
953     AS_ECHO(["JPEG support will not be included because the JPEG library is"])
954     AS_ECHO(["not installed correctly or was not found. Background images"])
955     AS_ECHO(["from themes will not display as they usually are JPEG files."])
956     AS_ECHO([])
957     AS_ECHO(["To fix, download and install the jpeg library and/or make sure you"])
958     AS_ECHO(["installed all jpeg related packages, SPECIALLY the development packages"])
959     AS_ECHO(["like jpeg-dev (if you use some prepackaged version of libjpeg)."])
960     AS_ECHO([])
961     AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])dnl
965 dnl This is for Emacs.  I'm lazy, I know... (nicolai)
966 dnl ================================================
967 dnl Local Variables:
968 dnl compile-command: "autoconf"
969 dnl End: