configure: Add option to specify global defaults directory.
[wmaker-crm.git] / configure.ac
blob2b43e00d21b56d38b579a6fcea7c4de94cca1ff0
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.7],[wmaker-dev@lists.windowmaker.org],[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])
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 Support for Nested Functions by the compiler
236 dnl ============================================
237 WM_PROG_CC_NESTEDFUNC
240 dnl Posix thread
241 dnl ============
242 dnl they are used by util/wmiv
243 AX_PTHREAD
246 dnl Tracking on what is detected for final status
247 dnl =============================================
248 unsupported=""
249 supported_core=""
250 supported_xext=""
251 supported_gfx=""
254 dnl Platform-specific Makefile setup
255 dnl ================================
256 AS_CASE(["$host"],
257     [*-*-linux*|*-*-cygwin*|*-gnu*], [WM_OSDEP="linux" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"],
258     [*-*-freebsd*|*-k*bsd-gnu*],     [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -DFREEBSD"],
259     [*-*-netbsd*],                   [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DNETBSD"],
260     [*-*-openbsd*],                  [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DOPENBSD"],
261     [*-*-dragonfly*],                [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DDRAGONFLYBSD"],
262     [*-apple-darwin*],               [WM_OSDEP="darwin"],
263     [*-*-solaris*],                  [WM_OSDEP="stub"],  dnl  solaris.c when done
264     [WM_OSDEP="stub"])
265 AM_CONDITIONAL([WM_OSDEP_LINUX],   [test "x$WM_OSDEP" = "xlinux"])
266 AM_CONDITIONAL([WM_OSDEP_BSD],     [test "x$WM_OSDEP" = "xbsd"])
267 AM_CONDITIONAL([WM_OSDEP_DARWIN],  [test "x$WM_OSDEP" = "xdarwin"])
268 AM_CONDITIONAL([WM_OSDEP_GENERIC], [test "x$WM_OSDEP" = "xstub"])
271 dnl the prefix
272 dnl ==========
274 dnl move this earlier in the script... anyone know why this is handled
275 dnl in such a bizarre way?
277 test "x$prefix" = xNONE && prefix=$ac_default_prefix
278 dnl Let make expand exec_prefix.
279 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
282 _bindir=`eval echo $bindir`
283 _bindir=`eval echo $_bindir`
284 _libdir=`eval echo $libdir`
285 _libdir=`eval echo $_libdir`
287 lib_search_path='-L${libdir}'
289 inc_search_path='-I${includedir}'
291 dnl ===============================================
292 dnl Specify paths to look for libraries and headers
293 dnl ===============================================
294 AC_ARG_WITH(libs-from, AS_HELP_STRING([--with-libs-from], [pass compiler flags to look for libraries]),
295         [lib_search_path="$withval $lib_search_path"])
297 AC_ARG_WITH(incs-from, AS_HELP_STRING([--with-incs-from], [pass compiler flags to look for header files]),
298         [inc_search_path="$withval $inc_search_path"])
301 dnl Features Configuration
302 dnl ======================
303 AC_ARG_ENABLE([animations],
304     [AS_HELP_STRING([--disable-animations], [disable permanently animations @<:@default=enabled@:>@])],
305     [AS_CASE(["$enableval"],
306         [yes|no], [],
307         [AC_MSG_ERROR([bad value $enableval for --enable-animations])])],
308     [enable_animations="yes"])
309 AS_IF([test "x$enable_animations" = "xno"],
310     [unsupported="$unsupported Animations"],
311     [AC_DEFINE([USE_ANIMATIONS], [1], [Defined when user did not request to disable animations])
312      supported_core="$supported_core Animations"])
315 AC_ARG_ENABLE([mwm-hints],
316     [AS_HELP_STRING([--disable-mwm-hints], [disable support for Motif WM hints @<:@default=enabled@:>@])],
317     [AS_CASE(["$enableval"],
318         [yes|no], [],
319         [AC_MSG_ERROR([bad value $enableval for --enable-mwm-hints])])],
320     [enable_mwm_hints="yes"])
321 AS_IF([test "x$enable_mwm_hints" = "xno"],
322     [unsupported="$unsupported MWMHints"],
323     [AC_DEFINE([USE_MWM_HINTS], [1], [Defined when used did not request to disable Motif WM hints])
324      supported_core="$supported_core MWMHints"])
325 AM_CONDITIONAL([USE_MWM_HINTS], [test "x$enable_mwm_hints" != "xno"])
328 dnl Boehm GC
329 dnl ========
330 AC_ARG_ENABLE([boehm-gc],
331     [AS_HELP_STRING([--enable-boehm-gc], [use Boehm GC instead of the default libc malloc() [default=no]])],
332     [AS_CASE(["$enableval"],
333         [yes], [with_boehm_gc=yes],
334         [no],  [with_boehm_gc=no],
335         [AC_MSG_ERROR([bad value $enableval for --enable-boehm-gc])] )],
336     [with_boehm_gc=no])
337 AS_IF([test "x$with_boehm_gc" = "xyes"],
338     AC_SEARCH_LIBS([GC_malloc], [gc],
339         [AC_DEFINE(USE_BOEHM_GC, 1, [Define if Boehm GC is to be used])],
340         [AC_MSG_FAILURE([--enable-boehm-gc specified but test for libgc failed])]))
343 dnl LCOV
344 dnl ====
345 AC_ARG_ENABLE([lcov],
346     [AS_HELP_STRING([--enable-lcov[=output-directory]], [enable coverage data generation using LCOV (GCC only) [default=no]])],
347     [],
348     [enable_lcov=no])
350 AS_IF([test "x$enable_lcov" != "xno"],
351     [AX_CFLAGS_GCC_OPTION(-fprofile-arcs -ftest-coverage)
352     AS_IF([test "x$enable_lcov" = "xyes"],
353         [lcov_output_directory="coverage-report"],
354         [lcov_output_directory="${enable_lcov}/coverage-report"])
355     AC_SUBST(lcov_output_directory)])
357 AM_CONDITIONAL([USE_LCOV], [test "x$enable_lcov" != "xno"])
360 dnl ============================
361 dnl Checks for library functions
362 dnl ============================
363 AC_FUNC_MEMCMP
364 AC_FUNC_VPRINTF
365 WM_FUNC_SECURE_GETENV
366 AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
367                setsid mallinfo mkstemp sysconf)
368 AC_SEARCH_LIBS([strerror], [cposix])
370 dnl nanosleep is generally available in standard libc, although not always the
371 dnl case. One known example is Solaris which needs -lrt
372 AC_SEARCH_LIBS([nanosleep], [rt], [],
373     [AC_MSG_ERROR([function 'nanosleep' not found, please report to wmaker-dev@lists.windowmaker.org])])
375 dnl the flag 'O_NOFOLLOW' for 'open' is used in WINGs
376 WM_FUNC_OPEN_NOFOLLOW
379 dnl Check for strlcat/strlcpy
380 dnl =========================
381 AC_ARG_WITH([libbsd],
382   [AS_HELP_STRING([--without-libbsd], [do not use libbsd for strlcat and strlcpy [default=check]])],
383   [AS_IF([test "x$with_libbsd" != "xno"],
384     [with_libbsd=bsd]
385     [with_libbsd=]
386   )],
387   [with_libbsd=bsd])
389 tmp_libs=$LIBS
390 AC_SEARCH_LIBS([strlcat],[$with_libbsd],
391   [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available])],
392   [],
393   []
395 AC_SEARCH_LIBS([strlcpy],[$with_libbsd],
396   [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcpy is available])],
397   [],
398   []
400 LIBS=$tmp_libs
402 LIBBSD=
403 AS_IF([test "x$ac_cv_search_strlcat" = "x-lbsd" -o "x$ac_cv_search_strlcpy" = "x-lbsd"],
404   [LIBBSD=-lbsd
405    AC_CHECK_HEADERS([bsd/string.h])]
407 AC_SUBST(LIBBSD)
410 dnl Check for OpenBSD kernel memory interface - kvm(3)
411 dnl ==================================================
412 AS_IF([test "x$WM_OSDEP" = "xbsd"],
413   AC_SEARCH_LIBS([kvm_openfiles], [kvm]) )
416 dnl Check for inotify
417 dnl =================
418 dnl It is used by WindowMaker to reload automatically the configuration when the
419 dnl user changed it using WPref or wdwrite
420 AC_CHECK_HEADERS([sys/inotify.h],
421     [AC_DEFINE([HAVE_INOTIFY], [1], [Check for inotify])])
424 dnl Check for syslog 
425 dnl ================
426 dnl It is used by WUtil to log the wwarning, werror and wfatal
427 AC_CHECK_HEADERS([syslog.h], [AC_DEFINE([HAVE_SYSLOG], [1], [Check for syslog])])
430 dnl Checks for header files
431 dnl =======================
432 AC_HEADER_SYS_WAIT
433 AC_HEADER_TIME
434 AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h libintl.h poll.h malloc.h ctype.h \
435                  string.h strings.h)
438 dnl Checks for typedefs, structures, and compiler characteristics
439 dnl =============================================================
440 AC_C_CONST
441 AC_C_INLINE
442 WM_C_NORETURN
443 AC_TYPE_SIZE_T
444 AC_TYPE_PID_T
445 WM_TYPE_SIGNAL
448 dnl pkg-config
449 dnl ==========
450 PKG_PROG_PKG_CONFIG
451 AS_IF([test -z "$PKG_CONFIG"],[AC_MSG_ERROR([pkg-config is required.])])
455 dnl Internationalization
456 dnl ====================
457 dnl Detect the language for translations to be installed and check
458 dnl that the gettext environment works
459 WM_I18N_LANGUAGES
460 WM_I18N_XGETTEXT
461 WM_I18N_MENUTEXTDOMAIN
463 dnl 2014/12/29: The option is deprecated, we should keep this message for at
464 dnl least 2 years to ensure users see it and update their build scripts
465 AC_ARG_WITH([nlsdir], [],
466     [AC_MSG_ERROR([option '--with-nlsdir' is deprecated, please use autoconf's standard '--localedir' instead])])
469 dnl ===========================================
470 dnl             Stuff that uses X
471 dnl ===========================================
473 AC_PATH_XTRA
475 AS_IF([test "x$no_x" = "xyes"],
476     [AC_MSG_ERROR([The path for the X11 files not found!
477 Make sure you have X and it's headers and libraries (the -devel packages
478 in Linux) installed.])])
480 X_LIBRARY_PATH=$x_libraries
481 XCFLAGS="$X_CFLAGS"
482 XLFLAGS="$X_LIBS"
483 XLIBS="-lX11 $X_EXTRA_LIBS"
485 lib_search_path="$lib_search_path $XLFLAGS"
486 inc_search_path="$inc_search_path $XCFLAGS"
488 AC_SUBST(X_LIBRARY_PATH)
491 dnl Decide which locale function to use, setlocale() or _Xsetlocale()
492 dnl by MANOME Tomonori 
493 dnl ===========================================
494 WM_I18N_XLOCALE
498 dnl Check whether XInternAtoms() exist
499 dnl ==================================
500 AC_CHECK_LIB([X11], [XInternAtoms],
501     [AC_DEFINE([HAVE_XINTERNATOMS], [1],
502         [define if your X server has XInternAtoms() (set by configure)])],
503     [], [$XLFLAGS $XLIBS])
506 dnl Check whether XConvertCase() exist
507 dnl ==================================
508 AC_CHECK_LIB([X11], [XConvertCase],
509     [AC_DEFINE([HAVE_XCONVERTCASE], [1],
510         [define if your X server has XConvertCase() (set by configure)])],
511     [], [$XLFLAGS $XLIBS])
514 dnl XKB keyboard language status
515 dnl ============================
516 AC_ARG_ENABLE([modelock],
517     [AS_HELP_STRING([--enable-modelock], [XKB keyboard language status support])],
518     [AS_CASE([$enableval],
519         [yes|no], [],
520         [AC_MSG_ERROR([bad value '$enableval' for --enable-modelock])])],
521     [enable_modelock=no])
522 AS_IF([test "x$enable_modelock" = "xyes"],
523     [AC_DEFINE([XKB_MODELOCK], [1], [whether XKB language MODELOCK should be enabled]) ])
526 dnl XDND Drag-nd-Drop support
527 dnl =========================
528 AC_ARG_ENABLE([xdnd],
529     [AS_HELP_STRING([--disable-xdnd], [disable support for Drag-and-Drop on the dock @<:@default=enabled@:>@])],
530     [AS_CASE(["$enableval"],
531         [yes|no], [],
532         [AC_MSG_ERROR([bad value $enableval for --disable-xdnd]) ]) ],
533     [enable_xdnd=yes])
534 AS_IF([test "x$enable_xdnd" = "xyes"],
535     [supported_core="$supported_core XDnD"
536      AC_DEFINE([USE_DOCK_XDND], [1], [whether Drag-and-Drop on the dock should be enabled])],
537     [unsupported="$unsupported XDnd"])
538 AM_CONDITIONAL([USE_DOCK_XDND], [test "x$enable_xdnd" != "xno"])
541 dnl Support for ICCCM 2.0 Window Manager replacement
542 dnl ================================================
543 AC_ARG_ENABLE([wmreplace],
544     [AS_HELP_STRING([--enable-wmreplace], [support for ICCCM window manager replacement])],
545     [AS_CASE([$enableval],
546         [yes|no], [],
547         [AC_MSG_ERROR([bad value '$enableval' for --enable-wmreplace])])],
548     [enable_wmreplace=no])
549 AS_IF([test "x$enable_wmreplace" = "xyes"],
550     [AC_DEFINE([USE_ICCCM_WMREPLACE], [1],
551        [define to support ICCCM protocol for window manager replacement])
552      supported_xext="$supported_xext WMReplace"])
555 dnl XShape support
556 dnl ==============
557 AC_ARG_ENABLE([shape],
558     [AS_HELP_STRING([--disable-shape], [disable shaped window extension support])],
559     [AS_CASE(["$enableval"],
560         [yes|no], [],
561         [AC_MSG_ERROR([bad value $enableval for --enable-shape]) ]) ],
562     [enable_shape=auto])
563 WM_XEXT_CHECK_XSHAPE
566 dnl MIT-SHM support
567 dnl ===============
568 AC_ARG_ENABLE([shm],
569     [AS_HELP_STRING([--disable-shm], [disable usage of MIT-SHM extension])],
570     [AS_CASE(["$enableval"],
571         [yes|no], [],
572         [AC_MSG_ERROR([bad value $enableval for --enable-shm]) ]) ],
573     [enable_shm=auto])
574 WM_XEXT_CHECK_XSHM
577 dnl X Misceleanous Utility
578 dnl ======================
579 dnl the libXmu is used in WRaster
580 WM_EXT_CHECK_XMU
583 dnl XINERAMA support
584 dnl ================
585 AC_ARG_ENABLE([xinerama],
586     [AS_HELP_STRING([--enable-xinerama], [enable Xinerama extension support])],
587     [AS_CASE(["$enableval"],
588         [yes|no], [],
589         [AC_MSG_ERROR([bad value $enableval for --enable-xinerama]) ]) ],
590     [enable_xinerama=auto])
591 WM_XEXT_CHECK_XINERAMA
594 dnl RandR support
595 dnl =============
596 AC_ARG_ENABLE([randr],
597     [AS_HELP_STRING([--enable-randr], [enable RandR extension support (NOT recommended, buggy)])],
598     [AS_CASE(["$enableval"],
599         [yes|no], [],
600         [AC_MSG_ERROR([bad value $enableval for --enable-randr]) ]) ],
601     [enable_randr=no])
602 WM_XEXT_CHECK_XRANDR
605 dnl Math library
606 dnl ============
607 dnl libWINGS uses math functions, check whether usage requires linking
608 dnl against libm
609 WM_CHECK_LIBM
612 dnl FontConfig
613 dnl ==========
614 dnl libWINGS uses FcPatternDel from libfontconfig
615 AC_MSG_CHECKING([for fontconfig library])
616 FCLIBS=`$PKG_CONFIG fontconfig --libs`
617 if test "x$FCLIBS" = "x" ; then
618         AC_MSG_RESULT([not found])
619 else
620         AC_MSG_RESULT([found])
622 AC_SUBST(FCLIBS)
625 dnl Xft2 antialiased font support
626 dnl =============================
628 xft=yes
629 XFTLIBS=""
631 if test "x$PKG_CONFIG" != x -a "`$PKG_CONFIG xft; echo $?`" = 0; then
632         XFTCONFIG="$PKG_CONFIG xft"
633         pkgconfig_xft=yes
634 else
635         AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config)
638 AC_MSG_CHECKING([for the Xft2 library])
640 if test "x$XFTCONFIG" != x; then
641         XFTLIBS=`$XFTCONFIG --libs`
642         XFTFLAGS=`$XFTCONFIG --cflags`
643         AC_MSG_RESULT([found])
644 else
645         AC_MSG_RESULT([not found])
646         echo
647         echo "ERROR!!! libXft2 is not installed or could not be found."
648         echo "         Xft2 is a requirement for building Window Maker."
649         echo "         Please install it (along with fontconfig) before continuing."
650         echo
651         exit 1
654 minXFT="2.1.0"
655 goodxft="no"
658 dnl The macro below will use $XFTFLAGS (defined above) to find Xft.h
660 WM_CHECK_XFT_VERSION($minXFT, goodxft=yes, goodxft=no)
662 if test "$goodxft" = no; then
663         echo
664         echo "ERROR!!! libXft on this system is an old version."
665         echo "         Please consider upgrading to at least version ${minXFT}."
666         echo
667         exit 1
670 AC_SUBST(XFTFLAGS)
671 AC_SUBST(XFTLIBS)
673 dnl PANGO support
674 dnl =============
675 pango=no
676 AC_ARG_ENABLE(pango, AS_HELP_STRING([--enable-pango], [enable Pango text layout support]),
677                 pango=$enableval, pango=no)
679 PANGOFLAGS=
680 PANGOLIBS=
681 if test "$pango" = yes; then
682         PANGOLIBS=`$PKG_CONFIG pangoxft --libs`
683         PANGOFLAGS=`$PKG_CONFIG pangoxft --cflags`
684         if test "x$PANGOLIBS" = "x" ; then
685                 AC_MSG_RESULT([not found])
686         else
687                 AC_DEFINE(USE_PANGO, 1, [Define if Pango is to be used])
688                 AC_MSG_RESULT([found])
689         fi
691 inc_search_path="$inc_search_path $PANGOFLAGS"
692 AC_SUBST(PANGOLIBS)
694 dnl ==============================================
695 dnl         Graphic Format Libraries
696 dnl ==============================================
698 dnl XPM Support
699 dnl ===========
700 AC_ARG_ENABLE([xpm],
701     [AS_HELP_STRING([--disable-xpm], [disable use of XPM pixmaps through libXpm])],
702     [AS_CASE(["$enableval"],
703         [yes|no], [],
704         [AC_MSG_ERROR([bad value $enableval for --enable-xpm])] )],
705     [enable_xpm=auto])
706 WM_IMGFMT_CHECK_XPM
709 # for wmlib
710 AC_SUBST(XCFLAGS)
711 # for test
712 AC_SUBST(XLFLAGS)
713 AC_SUBST(XLIBS)
714 AC_SUBST(X_EXTRA_LIBS)
716 dnl ===============================================
717 dnl             End of stuff that uses X
718 dnl ===============================================
720 dnl EXIF Support
721 dnl ============
722 WM_CHECK_LIBEXIF
723 AS_IF([test "x$LIBEXIF" != "x"],
724         [AC_DEFINE(HAVE_EXIF, 1, [Define if EXIF can be used])])
727 dnl PNG Support
728 dnl ===========
729 AC_ARG_ENABLE([png],
730     [AS_HELP_STRING([--disable-png], [disable PNG support through libpng])],
731     [AS_CASE(["$enableval"],
732         [yes|no], [],
733         [AC_MSG_ERROR([bad value $enableval for --enable-png])] )],
734     [enable_png=auto])
735 WM_IMGFMT_CHECK_PNG
738 dnl JPEG Support
739 dnl ============
740 AC_ARG_ENABLE([jpeg],
741     [AS_HELP_STRING([--disable-jpeg], [disable JPEG support through libjpeg])],
742     [AS_CASE(["$enableval"],
743         [yes|no], [],
744         [AC_MSG_ERROR([bad value $enableval for --enable-jpeg])] )],
745     [enable_jpeg=auto])
746 WM_IMGFMT_CHECK_JPEG
749 dnl GIF Support
750 dnl ============
751 AC_ARG_ENABLE(gif,
752     [AS_HELP_STRING([--disable-gif], [disable GIF support through libgif or libungif])],
753     [AS_CASE(["$enableval"],
754         [yes|no], [],
755         [AC_MSG_ERROR([bad value $enableval for --enable-gif])] )],
756     [enable_gif=auto])
757 WM_IMGFMT_CHECK_GIF
760 dnl TIFF Support
761 dnl ============
762 AC_ARG_ENABLE([tiff],
763     [AS_HELP_STRING([--disable-tiff], [disable use of TIFF images through libtiff])],
764     [AS_CASE(["$enableval"],
765         [yes|no], [],
766         [AC_MSG_ERROR([bad value $enableval for --enable-tiff])] )],
767     [enable_tiff=auto])
768 WM_IMGFMT_CHECK_TIFF
771 dnl WEBP Support
772 dnl ============
773 AC_ARG_ENABLE([webp],
774     [AS_HELP_STRING([--disable-webp], [disable WEBP support through libwebp])],
775     [AS_CASE(["$enableval"],
776         [yes|no], [],
777         [AC_MSG_ERROR([bad value $enableval for --enable-webp])] )],
778     [enable_webp=auto])
779 WM_IMGFMT_CHECK_WEBP
782 dnl MagicK Support
783 dnl ==============
784 AC_ARG_ENABLE([magick],
785     [AS_HELP_STRING([--disable-magick], [disable MAGICK support through libMagickWand])],
786     [AS_CASE(["$enableval"],
787         [yes|no], [],
788         [AC_MSG_ERROR([bad value $enableval for --enable-magick])] )],
789     [enable_magick=auto])
790 WM_IMGFMT_CHECK_MAGICK
793 dnl PPM Support
794 dnl ===========
795 # The PPM format is always enabled because we have built-in support for the format
796 # We are not using any external library like libppm
797 supported_gfx="$supported_gfx builtin-PPM"
800 # Choice of the default format for icons
801 AS_IF([test "x$enable_tiff" != "xno"],
802     [ICONEXT="tiff"],
803     [ICONEXT="xpm"])
806 LIBRARY_SEARCH_PATH="$lib_search_path"
807 HEADER_SEARCH_PATH="$inc_search_path"
809 AC_SUBST(LIBRARY_SEARCH_PATH)
810 AC_SUBST(HEADER_SEARCH_PATH)
813 AC_SUBST(GFXLIBS)
814 AC_SUBST(ICONEXT)
815 AM_CONDITIONAL([ICON_EXT_XPM],  [test "x$ICONEXT" = "xxpm"])
816 AM_CONDITIONAL([ICON_EXT_TIFF], [test "x$ICONEXT" = "xtiff"])
819 dnl ==============================================
820 dnl         End of Graphic Format Libraries
821 dnl ==============================================
825 dnl stdlib.h is checked here, because of conflict in jpeglib.h
826 AC_CHECK_HEADERS(stdlib.h)
829 dnl Support for PIXMAPDIR option
830 dnl ============================
831 AC_ARG_WITH([pixmapdir],
832     [AS_HELP_STRING([--with-pixmapdir=PATH], [specify where pixmaps are located [DATADIR/pixmaps]])],
833     [AS_CASE([$withval],
834         [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-pixmapdir, expected a path]) ],
835         [/*],  [], dnl Absolute path, ok
836         [\$*], [], dnl Assumes it starts with a reference to $prefix or a similar variable, ok
837         [AC_MSG_ERROR([bad path '$withval' for pixmapdir, expecting an absolute path])])],
838     [with_pixmapdir=""])
840 AS_IF([test "x$with_pixmapdir" != "x"],
841     [pixmapdir="$with_pixmapdir"],
842     [pixmapdir='${datadir}/pixmaps'])
843 AC_SUBST([pixmapdir])dnl
846 dnl Support for GNUSTEP_LOCAL_ROOT, for WPrefs.app
847 dnl ==============================================
848 AC_ARG_WITH([gnustepdir],
849     [AS_HELP_STRING([--with-gnustepdir=PATH], [specify the directory for GNUstep applications])],
850     [AS_CASE([$withval],
851         [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-gnustepdir, expected a path]) ],
852         [/*],  [], dnl Absolute path, ok
853         [\$*], [], dnl Assumes it starts with a reference to $prefix or a similar variable, ok
854         [AC_MSG_ERROR([bad path '$withval' for gnustepdir, expecting an absolute path])])],
855     [dnl If no command-line option was given, we use $GNUSTEP_LOCAL_ROOT if it was set
856      with_gnustepdir="$GNUSTEP_LOCAL_ROOT"])
858 AS_IF([test "x$with_gnustepdir" = "x"],
859     [dnl No path specified, use default
860      wprefs_base_dir=${prefix}
861      wprefs_datadir="${datadir}/WPrefs"
862      wprefs_bindir="${bindir}"],
863     [dnl User specified base path
864      wprefs_base_dir="$with_gnustepdir/Applications"
865      wprefs_datadir="$wprefs_base_dir/WPrefs.app"
866      wprefs_bindir="$wprefs_base_dir/WPrefs.app"])
867 AC_SUBST([wprefs_datadir])dnl
868 AC_SUBST([wprefs_bindir])dnl
870 dnl Support for DEFSDATADIR option
871 dnl ============================
872 AC_ARG_WITH([defsdatadir],
873     [AS_HELP_STRING([--with-defsdatadir=PATH], [specify where global defaults are located [SYSCONFDIR/WindowMaker]])],
874     [AS_CASE([$withval],
875         [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-defsdatadir, expected a path]) ],
876         [/*],  [], dnl Absolute path, ok
877         [\$*], [], dnl Assumes it starts with a reference to $prefix or a similar variable, ok
878         [AC_MSG_ERROR([bad path '$withval' for defsdatadir, expecting an absolute path])])],
879     [with_defsdatadir=""])
881 AS_IF([test "x$with_defsdatadir" != "x"],
882     [defsdatadir="$with_defsdatadir"],
883     [defsdatadir='${sysconfdir}/WindowMaker'])
884 AC_SUBST([defsdatadir])dnl
886 dnl Enable User Defined Menu thing
887 dnl ==============================
888 AC_ARG_ENABLE([usermenu],
889     [AS_HELP_STRING([--enable-usermenu], [user defined menus for applications])],
890     [AS_CASE([$enableval],
891         [yes|no], [],
892         [AC_MSG_ERROR([bad value '$enableval' for --enable-usermenu])])],
893     [enable_usermenu=no])
894 AS_IF([test "x$enable_usermenu" = "xyes"],
895     [AC_DEFINE([USER_MENU], [1],
896         [define if you want user defined menus for applications])])
899 dnl Support for removing non-public symbols from a library
900 dnl ======================================================
901 gl_LD_VERSION_SCRIPT
904 dnl Add the post-poned compilation options
905 dnl ======================================
906 WM_CFLAGS_GCC_OPTION_POSTPONED
909 AC_SUBST(lib_search_path)
910 AC_SUBST(inc_search_path)
913 dnl Spit out the configuration
914 dnl ==========================
915 AC_CONFIG_FILES(
916     Makefile
918     dnl WRaster Library
919     wrlib/Makefile
920     wrlib/tests/Makefile
922     dnl WINGs toolkit
923     WINGs/Makefile WINGs/WINGs/Makefile WINGs/po/Makefile
924     WINGs/Documentation/Makefile WINGs/Resources/Makefile WINGs/Extras/Makefile
925     WINGs/Examples/Makefile WINGs/Tests/Makefile
927     dnl Window Maker's core
928     src/Makefile src/wconfig.h po/Makefile
929     doc/Makefile doc/build/Makefile
930     doc/sk/Makefile doc/cs/Makefile doc/ru/Makefile
931     WindowMaker/Makefile WindowMaker/Backgrounds/Makefile
932     WindowMaker/Defaults/Makefile WindowMaker/IconSets/Makefile
933     WindowMaker/Icons/Makefile WindowMaker/Pixmaps/Makefile
934     WindowMaker/Styles/Makefile WindowMaker/Themes/Makefile
936     dnl Preference GUI
937     WPrefs.app/Makefile WPrefs.app/po/Makefile
938     WPrefs.app/tiff/Makefile WPrefs.app/xpm/Makefile
940     dnl Command-line utilities
941     util/Makefile util/po/Makefile
943     dnl Misceleanous stuff
944     wmlib/Makefile
945     test/Makefile
948 AC_OUTPUT
951 dnl Provide a summary of the config
952 dnl ===============================
953 echo
954 echo "Window Maker was configured as follows:"
955 echo
956 echo "Installation path prefix            : $prefix"
957 echo "Installation path for binaries      : $_bindir"
958 echo "Installation path for libraries     : $_libdir"
959 echo "Installation path for WPrefs.app    : $wprefs_base_dir" | sed -e 's|\${prefix}|'"$prefix|"
960 echo "Supported core features:            :$supported_core"
961 echo "Supported X extensions:             :$supported_xext"
962 echo "Supported graphic format libraries  :$supported_gfx"
963 echo "Unsupported features                :$unsupported"
964 echo "Antialiased text support in WINGs   : $xft"
965 echo "Pango text layout support in WINGs  : $pango"
966 echo "Translated languages to support     :$supported_locales"
967 AS_IF([test "x$debug" = "xyes"],
968     [AS_ECHO(["Debug enabled: CFLAGS = $CFLAGS"]) ])
969 echo
971 AS_IF([test "x$wm_cv_prog_cc_nestedfunc" != "xyes"],
972     [AC_MSG_WARN([[Your compiler does not support Nested Function, work-around enabled]])])
974 AS_IF([test "x$supported_locales" = "x"],
975     [AC_MSG_WARN([[No language from \$LINGUAS are supported]])])
977 AS_IF([test "x$enable_jpeg" = xno], [dnl
978     AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])
979     AS_ECHO([])
980     AS_ECHO(["JPEG support will not be included because the JPEG library is"])
981     AS_ECHO(["not installed correctly or was not found. Background images"])
982     AS_ECHO(["from themes will not display as they usually are JPEG files."])
983     AS_ECHO([])
984     AS_ECHO(["To fix, download and install the jpeg library and/or make sure you"])
985     AS_ECHO(["installed all jpeg related packages, SPECIALLY the development packages"])
986     AS_ECHO(["like jpeg-dev (if you use some prepackaged version of libjpeg)."])
987     AS_ECHO([])
988     AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])dnl
992 dnl This is for Emacs.  I'm lazy, I know... (nicolai)
993 dnl ================================================
994 dnl Local Variables:
995 dnl compile-command: "autoconf"
996 dnl End: