doc: create the skeleton to have a documentation for Internationalisation
[wmaker-crm.git] / configure.ac
blobf43b2684bfe0f1500cbc1ace98ea0c9bde0a3b86
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_xext=""
241 supported_gfx=""
244 dnl Platform-specific Makefile setup
245 dnl ================================
246 AS_CASE(["$host"],
247     [*-*-linux*|*-*-cygwin*|*-gnu*], [WM_OSDEP="linux" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"],
248     [*-*-freebsd*|*-k*bsd-gnu*],     [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -DFREEBSD"],
249     [*-*-netbsd*],                   [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DNETBSD"],
250     [*-*-openbsd*],                  [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DOPENBSD"],
251     [*-*-dragonfly*],                [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DDRAGONFLYBSD"],
252     [*-apple-darwin*],               [WM_OSDEP="darwin"],
253     [*-*-solaris*],                  [WM_OSDEP="stub"],  dnl  solaris.c when done
254     [WM_OSDEP="stub"])
255 AM_CONDITIONAL([WM_OSDEP_LINUX],   [test "x$WM_OSDEP" = "xlinux"])
256 AM_CONDITIONAL([WM_OSDEP_BSD],     [test "x$WM_OSDEP" = "xbsd"])
257 AM_CONDITIONAL([WM_OSDEP_DARWIN],  [test "x$WM_OSDEP" = "xdarwin"])
258 AM_CONDITIONAL([WM_OSDEP_GENERIC], [test "x$WM_OSDEP" = "xstub"])
261 dnl the prefix
262 dnl ==========
264 dnl move this earlier in the script... anyone know why this is handled
265 dnl in such a bizarre way?
267 test "x$prefix" = xNONE && prefix=$ac_default_prefix
268 dnl Let make expand exec_prefix.
269 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
272 _bindir=`eval echo $bindir`
273 _bindir=`eval echo $_bindir`
275 lib_search_path='-L${libdir}'
277 inc_search_path='-I${includedir}'
279 dnl ===============================================
280 dnl Specify paths to look for libraries and headers
281 dnl ===============================================
282 AC_ARG_WITH(libs-from, AS_HELP_STRING([--with-libs-from], [pass compiler flags to look for libraries]),
283         [lib_search_path="$withval $lib_search_path"])
285 AC_ARG_WITH(incs-from, AS_HELP_STRING([--with-incs-from], [pass compiler flags to look for header files]),
286         [inc_search_path="$withval $inc_search_path"])
289 dnl Boehm GC
290 dnl ========
291 AC_ARG_ENABLE([boehm-gc],
292     [AS_HELP_STRING([--enable-boehm-gc], [use Boehm GC instead of the default libc malloc() [default=no]])],
293     [AS_CASE(["$enableval"],
294         [yes], [with_boehm_gc=yes],
295         [no],  [with_boehm_gc=no],
296         [AC_MSG_ERROR([bad value $enableval for --enable-boehm-gc])] )],
297     [with_boehm_gc=no])
298 AS_IF([test "x$with_boehm_gc" = "xyes"],
299     AC_SEARCH_LIBS([GC_malloc], [gc],
300         [AC_DEFINE(USE_BOEHM_GC, 1, [Define if Boehm GC is to be used])],
301         [AC_MSG_FAILURE([--enable-boehm-gc specified but test for libgc failed])]))
304 dnl LCOV
305 dnl ====
306 AC_ARG_ENABLE([lcov],
307     [AS_HELP_STRING([--enable-lcov[=output-directory]], [enable coverage data generation using LCOV (GCC only) [default=no]])],
308     [],
309     [enable_lcov=no])
311 AS_IF([test "x$enable_lcov" != "xno"],
312     [AX_CFLAGS_GCC_OPTION(-fprofile-arcs -ftest-coverage)
313     AS_IF([test "x$enable_lcov" = "xyes"],
314         [lcov_output_directory="coverage-report"],
315         [lcov_output_directory="${enable_lcov}/coverage-report"])
316     AC_SUBST(lcov_output_directory)])
318 AM_CONDITIONAL([USE_LCOV], [test "x$enable_lcov" != "xno"])
321 dnl ============================
322 dnl Checks for library functions
323 dnl ============================
324 AC_FUNC_MEMCMP
325 AC_FUNC_VPRINTF
326 WM_FUNC_SECURE_GETENV
327 AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
328                setsid mallinfo mkstemp sysconf)
329 AC_SEARCH_LIBS([strerror], [cposix])
331 dnl nanosleep is generally available in standard libc, although not always the
332 dnl case. One known example is Solaris which needs -lrt
333 AC_SEARCH_LIBS([nanosleep], [rt], [],
334     [AC_MSG_ERROR([function 'nanosleep' not found, please report to wmaker-dev@lists.windowmaker.org])])
336 dnl the flag 'O_NOFOLLOW' for 'open' is used in WINGs
337 WM_FUNC_OPEN_NOFOLLOW
340 dnl Check for strlcat/strlcpy
341 dnl =========================
342 AC_ARG_WITH([libbsd],
343   [AS_HELP_STRING([--without-libbsd], [do not use libbsd for strlcat and strlcpy [default=check]])],
344   [AS_IF([test "x$with_libbsd" != "xno"],
345     [with_libbsd=bsd]
346     [with_libbsd=]
347   )],
348   [with_libbsd=bsd])
350 tmp_libs=$LIBS
351 AC_SEARCH_LIBS([strlcat],[$with_libbsd],
352   [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available])],
353   [],
354   []
356 AC_SEARCH_LIBS([strlcpy],[$with_libbsd],
357   [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcpy is available])],
358   [],
359   []
361 LIBS=$tmp_libs
363 LIBBSD=
364 AS_IF([test "x$ac_cv_search_strlcat" = "x-lbsd" -o "x$ac_cv_search_strlcpy" = "x-lbsd"],
365   [LIBBSD=-lbsd
366    AC_CHECK_HEADERS([bsd/string.h])]
368 AC_SUBST(LIBBSD)
371 dnl Check for OpenBSD kernel memory interface - kvm(3)
372 dnl ==================================================
373 AS_IF([test "x$WM_OSDEP" = "xbsd"],
374   AC_SEARCH_LIBS([kvm_openfiles], [kvm]) )
377 dnl Check for inotify
378 dnl =================
379 dnl It is used by WindowMaker to reload automatically the configuration when the
380 dnl user changed it using WPref or wdwrite
381 AC_CHECK_HEADERS([sys/inotify.h],
382     [AC_DEFINE([HAVE_INOTIFY], [1], [Check for inotify])])
385 dnl Check for syslog 
386 dnl ================
387 dnl It is used by WUtil to log the wwarning, werror and wfatal
388 AC_CHECK_HEADERS([syslog.h], [AC_DEFINE([HAVE_SYSLOG], [1], [Check for syslog])])
391 dnl Checks for header files
392 dnl =======================
393 AC_HEADER_SYS_WAIT
394 AC_HEADER_TIME
395 AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h libintl.h poll.h malloc.h ctype.h \
396                  string.h strings.h)
399 dnl Checks for typedefs, structures, and compiler characteristics
400 dnl =============================================================
401 AC_C_CONST
402 AC_C_INLINE
403 WM_C_NORETURN
404 AC_TYPE_SIZE_T
405 AC_TYPE_PID_T
406 WM_TYPE_SIGNAL
409 dnl pkg-config
410 dnl ==========
411 AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config])
414 dnl gettext
415 dnl =======
417 dnl AM_GNU_GETTEXT
419 INTLIBS=""
421 AC_CHECK_FUNC(gettext, [HAVEGETTEXT="yes"], 
422         AC_CHECK_LIB(intl, gettext, [INTLIBS="-lintl" HAVEGETTEXT="yes"],
423                          INTLIBS="" ))
425 AC_CHECK_PROG(XGETTEXT, xgettext, xgettext)
427 if test "$XGETTEXT" != ""; then 
428     if $XGETTEXT --help 2>&1 | grep illegal >/dev/null ; then
429         echo "xgettext isn't GNU version"
430         XGETTEXT=""
431     fi
434 if test "$LINGUAS" != ""; then
435     if test "$XGETTEXT" != "" -a "$HAVEGETTEXT" != ""; then
436         AC_DEFINE(I18N, 1, [Internationalization (I18N) support (set by configure)])
437         PO=""
438         echo "xgettext and gettext() exist; will build i18n support for $LINGUAS"
439     else
440         LINGUAS=""
441         PO=""
442         echo "xgettext and libintl.a don't both exist; will not build i18n support"
443     fi
444 else
445         INTLIBS=""
446         MOFILES=""
447         WPMOFILES=""
448         UTILMOFILES=""
449         PO=""
453 dnl The Tower of Babel
454 dnl ==================
456 dnl List of supported locales
457 dnl =========================
458 supported_locales="be bg bs ca cs da de el es et fi fr gl hr hu hy it ja ko ms nl no pl pt ro ru sk sv tr zh_CN zh_TW"
459 supported_wprefs_locales="bg ca cs de es et fi fr hr hu it ja ko nl pt ru sk zh_CN zh_TW"
460 supported_wings_locales="bg ca cs de fr hu nl sk"
461 supported_util_locales="de es fr nl pt"
463 for lang in $LINGUAS; do
464         ok=0
465         for l in $supported_locales; do
466                 if test "$l" = "$lang"; then
467                         ok=1
468                         break
469                 fi
470         done
471         if test "$ok" = 1; then
472                 MOFILES="$MOFILES $lang.mo"
473         else
474                 echo "Locale $lang is not supported."
475         fi
476         ok=0
477         for l in $supported_wprefs_locales; do
478                 if test "$l" = "$lang"; then
479                         ok=1
480                         break
481                 fi
482         done
483         if test "$ok" = 1; then
484                 WPMOFILES="$WPMOFILES $lang.mo"
485         fi
486         ok=0
487         for l in $supported_util_locales; do
488                 if test "$l" = "$lang"; then
489                         ok=1
490                         break
491                 fi
492         done
493         if test "$ok" = 1; then
494                 UTILMOFILES="$UTILMOFILES $lang.mo"
495         fi
496         ok=0
497         for l in $supported_wings_locales; do
498                 if test "$l" = "$lang"; then
499                         ok=1
500                         break
501                 fi
502         done
503         if test "$ok" = 1; then
504                 WINGSMOFILES="$WINGSMOFILES $lang.mo"
505         fi
506 done
509 dnl Added by Oliver - Support for NLSDIR option
510 dnl ===========================================
511 AC_ARG_WITH(nlsdir, AS_HELP_STRING([--with-nlsdir=PATH], [specify where the locale stuff should go]))
513 if test "x$NLSDIR" = "x"; then
514         if test "x$with_nlsdir" != "x"; then
515                 NLSDIR=$with_nlsdir
516         else
517                 NLSDIR='$(prefix)/lib/locale'
518         fi
521 menutextdomain=
522 AC_ARG_WITH(menu-textdomain, AS_HELP_STRING([--with-menu-textdomain=DOMAIN], [specify gettext domain used for menu translations]),
523         [if test "x$withval" != "xno"; then
524          menutextdomain=$withval
525          fi])
526 AC_SUBST(menutextdomain)
528 AC_SUBST(INTLIBS)
529 AC_SUBST(NLSDIR)
530 AC_SUBST(MOFILES)
531 AC_SUBST(WPMOFILES)
532 AC_SUBST(UTILMOFILES)
533 AC_SUBST(WINGSMOFILES)
534 AC_SUBST(supported_locales)
537 dnl ===========================================
538 dnl             Stuff that uses X
539 dnl ===========================================
541 AC_PATH_XTRA
543 AS_IF([test "x$no_x" = "xyes"],
544     [AC_MSG_ERROR([The path for the X11 files not found!
545 Make sure you have X and it's headers and libraries (the -devel packages
546 in Linux) installed.])])
548 X_LIBRARY_PATH=$x_libraries
549 XCFLAGS="$X_CFLAGS"
550 XLFLAGS="$X_LIBS"
551 XLIBS="-lX11 $X_EXTRA_LIBS"
553 lib_search_path="$lib_search_path $XLFLAGS"
554 inc_search_path="$inc_search_path $XCFLAGS"
556 AC_SUBST(X_LIBRARY_PATH)
559 dnl Decide which locale function to use, setlocale() or _Xsetlocale()
560 dnl by MANOME Tomonori 
561 dnl ===========================================
562 use_locale=yes
563 AC_ARG_ENABLE(locale, AS_HELP_STRING([--disable-locale], [disable use of X locale support]),
564               use_locale=no)
566 if test "$use_locale" = yes; then
567         AC_CHECK_LIB(X11, _Xsetlocale,
568                 AC_DEFINE(X_LOCALE, 1, [define if you want support for X window's X_LOCALE (set by configure)]),,
569                 $XLFLAGS $XLIBS)
573 dnl Check whether XInternAtoms() exist
574 dnl ==================================
575 AC_CHECK_LIB([X11], [XInternAtoms],
576     [AC_DEFINE([HAVE_XINTERNATOMS], [1],
577         [define if your X server has XInternAtoms() (set by configure)])],
578     [], [$XLFLAGS $XLIBS])
581 dnl Check whether XConvertCase() exist
582 dnl ==================================
583 AC_CHECK_LIB([X11], [XConvertCase],
584     [AC_DEFINE([HAVE_XCONVERTCASE], [1],
585         [define if your X server has XConvertCase() (set by configure)])],
586     [], [$XLFLAGS $XLIBS])
589 dnl XKB keyboard language status
590 dnl ============================
591 AC_ARG_ENABLE([modelock],
592     [AS_HELP_STRING([--enable-modelock], [XKB keyboard language status support])],
593     [AS_CASE([$enableval],
594         [yes|no], [],
595         [AC_MSG_ERROR([bad value '$enableval' for --enable-modelock])])],
596     [enable_modelock=no])
597 AS_IF([test "x$enable_modelock" = "xyes"],
598     [AC_DEFINE([XKB_MODELOCK], [1], [whether XKB language MODELOCK should be enabled]) ])
601 dnl XDND Drag-nd-Drop support
602 dnl =========================
603 AC_ARG_ENABLE([xdnd],
604     [AS_HELP_STRING([--disable-xdnd], [disable Drag-nd-Drop support])],
605     [AS_CASE(["$enableval"],
606         [yes|no], [],
607         [AC_MSG_ERROR([bad value $enableval for --disable-xdnd]) ]) ],
608     [enable_xdnd=yes])
609 AS_IF([test "x$enable_xdnd" = "xyes"],
610     [supported_xext="$supported_xext XDnD"
611      AC_DEFINE([XDND], [1], [whether Drag-nd-Drop support should be enabled])],
612     [unsupported="$unsupported XDnd"])
615 dnl XShape support
616 dnl ==============
617 AC_ARG_ENABLE([shape],
618     [AS_HELP_STRING([--disable-shape], [disable shaped window extension support])],
619     [AS_CASE(["$enableval"],
620         [yes|no], [],
621         [AC_MSG_ERROR([bad value $enableval for --enable-shape]) ]) ],
622     [enable_shape=auto])
623 WM_XEXT_CHECK_XSHAPE
626 dnl MIT-SHM support
627 dnl ===============
628 AC_ARG_ENABLE([shm],
629     [AS_HELP_STRING([--disable-shm], [disable usage of MIT-SHM extension])],
630     [AS_CASE(["$enableval"],
631         [yes|no], [],
632         [AC_MSG_ERROR([bad value $enableval for --enable-shm]) ]) ],
633     [enable_shm=auto])
634 WM_XEXT_CHECK_XSHM
637 dnl X Misceleanous Utility
638 dnl ======================
639 dnl the libXmu is used in WRaster
640 WM_EXT_CHECK_XMU
643 dnl XINERAMA support
644 dnl ================
645 AC_ARG_ENABLE([xinerama],
646     [AS_HELP_STRING([--enable-xinerama], [enable Xinerama extension support])],
647     [AS_CASE(["$enableval"],
648         [yes|no], [],
649         [AC_MSG_ERROR([bad value $enableval for --enable-xinerama]) ]) ],
650     [enable_xinerama=auto])
651 WM_XEXT_CHECK_XINERAMA
654 dnl RandR support
655 dnl =============
656 AC_ARG_ENABLE([randr],
657     [AS_HELP_STRING([--enable-randr], [enable RandR extension support (NOT recommended, buggy)])],
658     [AS_CASE(["$enableval"],
659         [yes|no], [],
660         [AC_MSG_ERROR([bad value $enableval for --enable-randr]) ]) ],
661     [enable_randr=no])
662 WM_XEXT_CHECK_XRANDR
665 dnl Math library
666 dnl ============
667 dnl libWINGS uses math functions, check whether usage requires linking
668 dnl against libm
669 WM_CHECK_LIBM
672 dnl FontConfig
673 dnl ==========
674 dnl libWINGS uses FcPatternDel from libfontconfig
675 AC_MSG_CHECKING([for fontconfig library])
676 FCLIBS=`$PKGCONFIG fontconfig --libs`
677 if test "x$FCLIBS" = "x" ; then
678         AC_MSG_RESULT([not found])
679 else
680         AC_MSG_RESULT([found])
682 AC_SUBST(FCLIBS)
685 dnl Xft2 antialiased font support
686 dnl =============================
688 xft=yes
689 XFTLIBS=""
691 if test "x$PKGCONFIG" != x -a "`$PKGCONFIG xft; echo $?`" = 0; then
692         XFTCONFIG="$PKGCONFIG xft"
693         pkgconfig_xft=yes
694 else
695         AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config)
698 AC_MSG_CHECKING([for the Xft2 library])
700 if test "x$XFTCONFIG" != x; then
701         XFTLIBS=`$XFTCONFIG --libs`
702         XFTFLAGS=`$XFTCONFIG --cflags`
703         AC_MSG_RESULT([found])
704 else
705         AC_MSG_RESULT([not found])
706         echo
707         echo "ERROR!!! libXft2 is not installed or could not be found."
708         echo "         Xft2 is a requirement for building Window Maker."
709         echo "         Please install it (along with fontconfig) before continuing."
710         echo
711         exit 1
714 minXFT="2.1.0"
715 goodxft="no"
718 dnl The macro below will use $XFTFLAGS (defined above) to find Xft.h
720 WM_CHECK_XFT_VERSION($minXFT, goodxft=yes, goodxft=no)
722 if test "$goodxft" = no; then
723         echo
724         echo "ERROR!!! libXft on this system is an old version."
725         echo "         Please consider upgrading to at least version ${minXFT}."
726         echo
727         exit 1
730 AC_SUBST(XFTFLAGS)
731 AC_SUBST(XFTLIBS)
733 dnl PANGO support
734 dnl =============
735 pango=no
736 AC_ARG_ENABLE(pango, AS_HELP_STRING([--enable-pango], [enable Pango text layout support]),
737                 pango=$enableval, pango=no)
739 PANGOFLAGS=
740 PANGOLIBS=
741 if test "$pango" = yes; then
742         PANGOLIBS=`$PKGCONFIG pangoxft --libs`
743         PANGOFLAGS=`$PKGCONFIG pangoxft --cflags`
744         if test "x$PANGOLIBS" = "x" ; then
745                 AC_MSG_RESULT([not found])
746         else
747                 AC_DEFINE(USE_PANGO, 1, [Define if Pango is to be used])
748                 AC_MSG_RESULT([found])
749         fi
751 inc_search_path="$inc_search_path $PANGOFLAGS"
752 AC_SUBST(PANGOLIBS)
754 dnl ==============================================
755 dnl         Graphic Format Libraries
756 dnl ==============================================
758 dnl XPM Support
759 dnl ===========
760 AC_ARG_ENABLE([xpm],
761     [AS_HELP_STRING([--disable-xpm], [disable use of XPM pixmaps through libXpm])],
762     [AS_CASE(["$enableval"],
763         [yes|no], [],
764         [AC_MSG_ERROR([bad value $enableval for --enable-xpm])] )],
765     [enable_xpm=auto])
766 WM_IMGFMT_CHECK_XPM
769 # for wmlib
770 AC_SUBST(XCFLAGS)
771 # for test
772 AC_SUBST(XLFLAGS)
773 AC_SUBST(XLIBS)
774 AC_SUBST(X_EXTRA_LIBS)
776 dnl ===============================================
777 dnl             End of stuff that uses X
778 dnl ===============================================
780 dnl EXIF Support
781 dnl ============
782 WM_CHECK_LIBEXIF
783 AS_IF([test "x$LIBEXIF" != "x"],
784         [AC_DEFINE(HAVE_EXIF, 1, [Define if EXIF can be used])])
787 dnl PNG Support
788 dnl ===========
789 AC_ARG_ENABLE([png],
790     [AS_HELP_STRING([--disable-png], [disable PNG support through libpng])],
791     [AS_CASE(["$enableval"],
792         [yes|no], [],
793         [AC_MSG_ERROR([bad value $enableval for --enable-png])] )],
794     [enable_png=auto])
795 WM_IMGFMT_CHECK_PNG
798 dnl JPEG Support
799 dnl ============
800 AC_ARG_ENABLE([jpeg],
801     [AS_HELP_STRING([--disable-jpeg], [disable JPEG support through libjpeg])],
802     [AS_CASE(["$enableval"],
803         [yes|no], [],
804         [AC_MSG_ERROR([bad value $enableval for --enable-jpeg])] )],
805     [enable_jpeg=auto])
806 WM_IMGFMT_CHECK_JPEG
809 dnl GIF Support
810 dnl ============
811 AC_ARG_ENABLE(gif,
812     [AS_HELP_STRING([--disable-gif], [disable GIF support through libgif or libungif])],
813     [AS_CASE(["$enableval"],
814         [yes|no], [],
815         [AC_MSG_ERROR([bad value $enableval for --enable-gif])] )],
816     [enable_gif=auto])
817 WM_IMGFMT_CHECK_GIF
820 dnl TIFF Support
821 dnl ============
822 AC_ARG_ENABLE([tiff],
823     [AS_HELP_STRING([--disable-tiff], [disable use of TIFF images through libtiff])],
824     [AS_CASE(["$enableval"],
825         [yes|no], [],
826         [AC_MSG_ERROR([bad value $enableval for --enable-tiff])] )],
827     [enable_tiff=auto])
828 WM_IMGFMT_CHECK_TIFF
831 dnl WEBP Support
832 dnl ============
833 AC_ARG_ENABLE([webp],
834     [AS_HELP_STRING([--disable-webp], [disable WEBP support through libwebp])],
835     [AS_CASE(["$enableval"],
836         [yes|no], [],
837         [AC_MSG_ERROR([bad value $enableval for --enable-webp])] )],
838     [enable_webp=auto])
839 WM_IMGFMT_CHECK_WEBP
842 dnl MagicK Support
843 dnl ==============
844 AC_ARG_ENABLE([magick],
845     [AS_HELP_STRING([--disable-magick], [disable MAGICK support through libMagickWand])],
846     [AS_CASE(["$enableval"],
847         [yes|no], [],
848         [AC_MSG_ERROR([bad value $enableval for --enable-magick])] )],
849     [enable_magick=auto])
850 WM_IMGFMT_CHECK_MAGICK
853 dnl PPM Support
854 dnl ===========
855 # The PPM format is always enabled because we have built-in support for the format
856 # We are not using any external library like libppm
857 supported_gfx="$supported_gfx builtin-PPM"
860 # Choice of the default format for icons
861 AS_IF([test "x$enable_tiff" != "xno"],
862     [ICONEXT="tiff"],
863     [ICONEXT="xpm"])
866 LIBRARY_SEARCH_PATH="$lib_search_path"
867 HEADER_SEARCH_PATH="$inc_search_path"
869 AC_SUBST(LIBRARY_SEARCH_PATH)
870 AC_SUBST(HEADER_SEARCH_PATH)
873 AC_SUBST(GFXLIBS)
874 AC_SUBST(ICONEXT)
875 AM_CONDITIONAL([ICON_EXT_XPM],  [test "x$ICONEXT" = "xxpm"])
876 AM_CONDITIONAL([ICON_EXT_TIFF], [test "x$ICONEXT" = "xtiff"])
879 dnl ==============================================
880 dnl         End of Graphic Format Libraries
881 dnl ==============================================
885 dnl stdlib.h is checked here, because of conflict in jpeglib.h
886 AC_CHECK_HEADERS(stdlib.h)
889 dnl Support for PIXMAPDIR option
890 dnl ============================
891 AC_ARG_WITH([pixmapdir],
892     [AS_HELP_STRING([--with-pixmapdir=PATH], [specify where pixmaps are located [DATADIR/pixmaps]])],
893     [AS_CASE([$withval],
894         [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-pixmapdir, expected a path]) ],
895         [/*],  [], dnl Absolute path, ok
896         [\$*], [], dnl Assumes it starts with a reference to $prefix or a similar variable, ok
897         [AC_MSG_ERROR([bad path '$withval' for pixmapdir, expecting an absolute path])])],
898     [with_pixmapdir=""])
900 AS_IF([test "x$with_pixmapdir" != "x"],
901     [pixmapdir="$with_pixmapdir"],
902     [pixmapdir='${datadir}/pixmaps'])
903 AC_SUBST([pixmapdir])dnl
906 dnl Support for GNUSTEP_LOCAL_ROOT, for WPrefs.app
907 dnl ==============================================
908 AC_ARG_WITH([gnustepdir],
909     [AS_HELP_STRING([--with-gnustepdir=PATH], [specify the directory for GNUstep applications])],
910     [AS_CASE([$withval],
911         [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-gnustepdir, 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 gnustepdir, expecting an absolute path])])],
915     [dnl If no command-line option was given, we use $GNUSTEP_LOCAL_ROOT if it was set
916      with_gnustepdir="$GNUSTEP_LOCAL_ROOT"])
918 AS_IF([test "x$with_gnustepdir" = "x"],
919     [dnl No path specified, use default
920      wprefs_base_dir=${prefix}
921      wprefs_datadir="${datadir}/WPrefs"
922      wprefs_bindir="${bindir}"],
923     [dnl User specified base path
924      wprefs_base_dir="$with_gnustepdir/Applications"
925      wprefs_datadir="$wprefs_base_dir/WPrefs.app"
926      wprefs_bindir="$wprefs_base_dir/WPrefs.app"])
927 AC_SUBST([wprefs_datadir])dnl
928 AC_SUBST([wprefs_bindir])dnl
931 dnl Enable User Defined Menu thing
932 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 AS_IF([test "x$enable_usermenu" = "xyes"],
940     [AC_DEFINE([USER_MENU], [1],
941         [define if you want user defined menus for applications])])
944 dnl Support for removing non-public symbols from a library
945 dnl ======================================================
946 gl_LD_VERSION_SCRIPT
949 dnl Add the post-poned compilation options
950 dnl ======================================
951 WM_CFLAGS_GCC_OPTION_POSTPONED
954 AC_SUBST(lib_search_path)
955 AC_SUBST(inc_search_path)
958 dnl Spit out the configuration
959 dnl ==========================
960 AC_CONFIG_FILES(
961     Makefile
963     dnl WRaster Library
964     wrlib/Makefile
965     wrlib/tests/Makefile
967     dnl WINGs toolkit
968     WINGs/Makefile WINGs/WINGs/Makefile WINGs/po/Makefile
969     WINGs/Documentation/Makefile WINGs/Resources/Makefile WINGs/Extras/Makefile
970     WINGs/Examples/Makefile WINGs/Tests/Makefile
972     dnl Window Maker's core
973     src/Makefile src/wconfig.h po/Makefile
974     doc/Makefile doc/build/Makefile
975     doc/sk/Makefile doc/cs/Makefile doc/ru/Makefile
976     WindowMaker/Makefile WindowMaker/Backgrounds/Makefile
977     WindowMaker/Defaults/Makefile WindowMaker/IconSets/Makefile
978     WindowMaker/Icons/Makefile WindowMaker/Pixmaps/Makefile
979     WindowMaker/Styles/Makefile WindowMaker/Themes/Makefile
981     dnl Preference GUI
982     WPrefs.app/Makefile WPrefs.app/po/Makefile
983     WPrefs.app/tiff/Makefile WPrefs.app/xpm/Makefile
985     dnl Command-line utilities
986     util/Makefile util/po/Makefile
988     dnl Misceleanous stuff
989     wmlib/Makefile
990     test/Makefile
993 AC_OUTPUT
996 dnl Provide a summary of the config
997 dnl ===============================
998 if test "x$MOFILES" = "x"; then
999         mof=None
1000 else
1001         mof=`echo $MOFILES`
1004 if test "x$MOFILES" = "x"; then
1005         languages=None
1006 else
1007         languages=`echo $MOFILES | sed 's/.mo//g'`
1010 echo
1011 echo "Window Maker was configured as follows:"
1012 echo
1013 echo "Installation path prefix            : $prefix"
1014 echo "Installation path for binaries      : $_bindir"
1015 echo "Installation path for libraries     : $libdir"
1016 echo "Installation path for WPrefs.app    : $wprefs_base_dir" | sed -e 's|\${prefix}|'"$prefix|"
1017 echo "Supported X extensions:             :$supported_xext"
1018 echo "Supported graphic format libraries  :$supported_gfx"
1019 echo "Unsupported features                :$unsupported"
1020 echo "Antialiased text support in WINGs   : $xft"
1021 echo "Pango text layout support in WINGs  : $pango"
1022 echo "Translated message files to install : $mof"
1023 dnl echo "Supported languages beside English  : $languages"
1024 if test "x$MOFILES" != "x"; then
1025         echo "Installation path for translations  : $NLSDIR" | sed -e 's|\$(prefix)|'"$prefix|"
1027 AS_IF([test "x$debug" = "xyes"],
1028     [AS_ECHO(["Debug enabled: CFLAGS = $CFLAGS"]) ])
1029 echo
1031 AS_IF([test "x$wm_cv_prog_cc_nestedfunc" != "xyes"],
1032     [AC_MSG_WARN([[Your compiler does not support Nested Function, work-around enabled]])])
1034 AS_IF([test "x$enable_jpeg" = xno], [dnl
1035     AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])
1036     AS_ECHO([])
1037     AS_ECHO(["JPEG support will not be included because the JPEG library is"])
1038     AS_ECHO(["not installed correctly or was not found. Background images"])
1039     AS_ECHO(["from themes will not display as they usually are JPEG files."])
1040     AS_ECHO([])
1041     AS_ECHO(["To fix, download and install the jpeg library and/or make sure you"])
1042     AS_ECHO(["installed all jpeg related packages, SPECIALLY the development packages"])
1043     AS_ECHO(["like jpeg-dev (if you use some prepackaged version of libjpeg)."])
1044     AS_ECHO([])
1045     AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])dnl
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: