wmaker: remove execute permissions on the source file 'wsmap.c'
[wmaker-crm.git] / configure.ac
blobf98b6f79f68b284d1e08615b6cb6f4152c616a2c
1 dnl
2 dnl Window Maker autoconf input.
3 dnl
4 dnl Process with:
5 dnl               aclocal
6 dnl               autoheader
7 dnl               autoconf
8 dnl               libtoolize --force --automake
9 dnl               automake -a --gnu --include-deps
10 dnl
13 dnl Due to a bug in Autoconf 2.68 (apparently a regression), we need at least
14 dnl version 2.68b which includes this patch:
15 dnl   http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commit;h=2b0d95faef68d7ed7c08b0edb9ff1c38728376fa
16 dnl
17 dnl Because the 2.69 was released only a few month later, let's just ask for it
18 AC_PREREQ([2.69])
21 AC_INIT(WindowMaker, 0.95.6, , WindowMaker, http://www.windowmaker.org/)
22 AC_CONFIG_SRCDIR(src/WindowMaker.h)
23 AC_CONFIG_MACRO_DIR([m4])
24 AC_CONFIG_HEADERS(config.h)
25 AM_INIT_AUTOMAKE([1.11 silent-rules])
27 AH_BOTTOM([#include "config-paths.h"])
29 dnl libtool library versioning
30 dnl =======================
31 dnl
32 dnl current
33 dnl revision
34 dnl age
35 dnl
36 dnl 1. Start with version information of ‘0:0:0’ for each libtool library.
37 dnl 2. Update the version information only immediately before a public
38 dnl release of your software. More frequent updates are unnecessary, and
39 dnl only guarantee that the current interface number gets larger faster.
40 dnl 3. If the library source code has changed at all since the last
41 dnl update, then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
42 dnl 4. If any interfaces have been added, removed, or changed since the
43 dnl last update, increment current, and set revision to 0.
44 dnl 5. If any interfaces have been added since the last public release,
45 dnl then increment age.
46 dnl 6. If any interfaces have been removed or changed since the last
47 dnl public release, then set age to 0.
48 dnl
49 dnl libwraster
50 WRASTER_CURRENT=5
51 WRASTER_REVISION=0
52 WRASTER_AGE=0
53 WRASTER_VERSION=$WRASTER_CURRENT:$WRASTER_REVISION:$WRASTER_AGE
54 AC_SUBST(WRASTER_VERSION)
55 dnl
56 dnl libWINGs
57 WINGS_CURRENT=4
58 WINGS_REVISION=0
59 WINGS_AGE=1
60 WINGS_VERSION=$WINGS_CURRENT:$WINGS_REVISION:$WINGS_AGE
61 AC_SUBST(WINGS_VERSION)
62 dnl
63 dnl libWUtil
64 WUTIL_CURRENT=5
65 WUTIL_REVISION=0
66 WUTIL_AGE=0
67 WUTIL_VERSION=$WUTIL_CURRENT:$WUTIL_REVISION:$WUTIL_AGE
68 AC_SUBST(WUTIL_VERSION)
71 dnl Checks for host/os name
72 dnl =======================
73 dnl AC_CANONICAL_HOST -- already done by AC_PROG_LIBTOOL
75 dnl Checks for programs.
76 dnl ===================
77 AC_PROG_CC
78 WM_PROG_CC_C11
79 AC_PROG_LN_S
80 AC_PROG_GCC_TRADITIONAL
81 AC_PROG_LIBTOOL
84 dnl Debugging Options
85 dnl =================
86 AC_ARG_ENABLE(debug,
87     [AS_HELP_STRING([--enable-debug], [enable debugging options, @<:@default=no@:>@])],
88     [AS_CASE(["$enableval"],
89         [yes], [debug=yes],
90         [no],  [debug=no],
91         [AC_MSG_ERROR([bad value $enableval for --enable-debug])] )],
92     [debug=no])
93 AS_IF([test "x$debug" = "xyes"],
94     [dnl This flag should have already been detected and added, but if user
95      dnl provided an explicit CFLAGS it may not be the case
96      AS_IF([echo " $CFLAGS " | grep " -g " 2>&1 > /dev/null],
97            [@%:@ Debug symbol already activated],
98            [AX_CFLAGS_GCC_OPTION([-g])])
99      dnl
100      dnl This flag generally makes debugging nightmarish, remove it if present
101      CFLAGS="`echo "$CFLAGS" | sed -e 's/-fomit-frame-pointer *//' `"
102      dnl
103      dnl Enable internal debug code
104      CPPFLAGS="$CPPFLAGS -DDEBUG"
105 ],  [dnl
106      dnl When debug is not enabled, the user probably does not wants to keep
107      dnl assertions in the final program
108      CPPFLAGS="$CPPFLAGS -DNDEBUG"
112 AX_CFLAGS_GCC_OPTION(-Wall)
113 AX_CFLAGS_GCC_OPTION(-Wextra -Wno-sign-compare)
115 dnl The use of trampolines cause code that can crash on some secured OS, it is
116 dnl also known to be a source of crash if not used properly, in a more general
117 dnl way it tends to generate binary code that may not be optimal, and it is
118 dnl not compatible with the 'nested-func-to-macro' workaround
119 WM_CFLAGS_CHECK_FIRST([-Wtrampolines],
120          [-Werror=trampolines  dnl try to generate an error if possible
121           -Wtrampolines        dnl if not, try to fall back to a simple warning
122          ])
124 AS_IF([test "x$debug" = "xyes"],
125     [dnl When debug is enabled, we try to activate more checks from
126      dnl the compiler. They are on independant check because the
127      dnl macro checks all the options at once, but we may have cases
128      dnl where some options are not supported and we don't want to
129      dnl loose all of them.
130      dnl
131      dnl clang, suggest parenthesis on bit operations that could be
132      dnl misunderstood due to C operator precedence
133      AX_CFLAGS_GCC_OPTION([-Wbitwise-op-parentheses])
134      dnl
135      dnl Points at code that gcc thinks is so complicated that gcc
136      dnl gives up trying to optimize, which probably also means it is
137      dnl too complicated to maintain
138      AX_CFLAGS_GCC_OPTION([-Wdisabled-optimization])
139      dnl
140      dnl Floating-point comparison is not a good idea
141      AX_CFLAGS_GCC_OPTION([-Wfloat-equal])
142      dnl
143      dnl clang warns about constants that may have portability issues due
144      dnl to the endianness of the host
145      AX_CFLAGS_GCC_OPTION([-Wfour-char-constants])
146      dnl
147      dnl clang warns about constant that may be too big to be portable
148      AX_CFLAGS_GCC_OPTION([-Wliteral-range])
149      dnl
150      dnl Try to report misuses of '&' versus '&&' and similar
151      AX_CFLAGS_GCC_OPTION([-Wlogical-op])
152      dnl
153      dnl clang, reports cases where the code assumes everyone is an
154      dnl expert in C operator precedence... which is unlikely!
155      AX_CFLAGS_GCC_OPTION([-Wlogical-op-parentheses])
156      dnl
157      dnl Reports declaration of global things that are done inside
158      dnl a local environment, instead of using the appropriate
159      dnl header
160      AX_CFLAGS_GCC_OPTION([-Wnested-externs])
161      dnl
162      dnl Warn about constant strings that could pose portability issues
163      AX_CFLAGS_GCC_OPTION([-Woverlength-strings])
164      dnl
165      dnl Use of 'sizeof()' on inappropriate pointer types
166      AX_CFLAGS_GCC_OPTION([-Wpointer-arith])
167      dnl
168      dnl Having more than 1 prototype for a function makes code updates
169      dnl more difficult, so try to avoid it
170      AX_CFLAGS_GCC_OPTION([-Wredundant-decls])
171      dnl
172      dnl clang, detect some misuses of sizeof. We also count in our code
173      dnl on the use of the macro 'wlength' which contains a check if the
174      dnl compiler support C11's static_assert
175      AX_CFLAGS_GCC_OPTION([-Wsizeof-array-argument])
176      dnl
177      dnl Prototype of function must be explicit, no deprecated K&R syntax
178      dnl and no empty argument list which prevents compiler from doing
179      dnl type checking when using the function
180      WM_CFLAGS_GCC_OPTION_STRICTPROTO
181      dnl
182      dnl Proper attributes helps the compiler to produce better code
183      WM_CFLAGS_CHECK_FIRST([format attribute suggest],
184          [-Wsuggest-attribute=format  dnl new gcc syntax
185           -Wmissing-format-attribute  dnl old gcc syntax, clang
186          ])
187      WM_CFLAGS_CHECK_FIRST([no-return attribute suggest],
188          [-Wsuggest-attribute=noreturn  dnl gcc syntax
189           -Wmissing-noreturn            dnl clang syntax
190          ])
191      dnl
192      dnl GCC provides a couple of checks to detect incorrect macro uses
193      AX_CFLAGS_GCC_OPTION([-Wundef])
194      WM_CFLAGS_GCC_OPTION_UNUSEDMACROS
195      dnl
196      dnl clang reports stuff marked unused but which is actually used
197      AX_CFLAGS_GCC_OPTION([-Wused-but-marked-unused])
198 ], [dnl
199      dnl When debug not enabled, we try to avoid some non-necessary
200      dnl messages from the compiler
201      dnl
202      dnl To support legacy X servers, we have sometime to use
203      dnl functions marked as deprecated. We do not wish our users
204      dnl to be worried about it
205      AX_CFLAGS_GCC_OPTION([-Wno-deprecated])
206      AX_CFLAGS_GCC_OPTION([-Wno-deprecated-declarations])
210 dnl Support for Nested Functions by the compiler
211 dnl ============================================
212 WM_PROG_CC_NESTEDFUNC
215 dnl Posix thread
216 dnl =================
217 AX_PTHREAD
220 dnl Tracking on what is detected for final status
221 dnl =============================================
222 unsupported=""
223 supported_xext=""
224 supported_gfx=""
227 dnl Platform-specific Makefile setup
228 dnl ================================
229 AS_CASE(["$host"],
230     [*-*-linux*|*-*-cygwin*|*-gnu*], [WM_OSDEP="linux" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"],
231     [*-*-freebsd*|*-k*bsd-gnu*],     [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -DFREEBSD"],
232     [*-*-netbsd*],                   [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DNETBSD"],
233     [*-*-openbsd*],                  [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DOPENBSD"],
234     [*-*-dragonfly*],                [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DDRAGONFLYBSD"],
235     [*-apple-darwin*],               [WM_OSDEP="darwin"],
236     [*-*-solaris*],                  [WM_OSDEP="stub"],  dnl  solaris.c when done
237     [WM_OSDEP="stub"])
238 AM_CONDITIONAL([WM_OSDEP_LINUX],   [test "x$WM_OSDEP" = "xlinux"])
239 AM_CONDITIONAL([WM_OSDEP_BSD],     [test "x$WM_OSDEP" = "xbsd"])
240 AM_CONDITIONAL([WM_OSDEP_DARWIN],  [test "x$WM_OSDEP" = "xdarwin"])
241 AM_CONDITIONAL([WM_OSDEP_GENERIC], [test "x$WM_OSDEP" = "xstub"])
244 dnl the prefix
245 dnl ==========
247 dnl move this earlier in the script... anyone know why this is handled
248 dnl in such a bizarre way?
250 test "x$prefix" = xNONE && prefix=$ac_default_prefix
251 dnl Let make expand exec_prefix.
252 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
255 _bindir=`eval echo $bindir`
256 _bindir=`eval echo $_bindir`
258 lib_search_path='-L${libdir}'
260 inc_search_path='-I${includedir}'
262 dnl ===============================================
263 dnl Specify paths to look for libraries and headers
264 dnl ===============================================
265 AC_ARG_WITH(libs-from, AS_HELP_STRING([--with-libs-from], [pass compiler flags to look for libraries]),
266         [lib_search_path="$withval $lib_search_path"])
268 AC_ARG_WITH(incs-from, AS_HELP_STRING([--with-incs-from], [pass compiler flags to look for header files]),
269         [inc_search_path="$withval $inc_search_path"])
272 dnl Boehm GC
273 dnl ========
274 AC_ARG_ENABLE([boehm-gc],
275     [AS_HELP_STRING([--enable-boehm-gc], [use Boehm GC instead of the default libc malloc() [default=no]])],
276     [AS_CASE(["$enableval"],
277         [yes], [with_boehm_gc=yes],
278         [no],  [with_boehm_gc=no],
279         [AC_MSG_ERROR([bad value $enableval for --enable-boehm-gc])] )],
280     [with_boehm_gc=no])
281 AS_IF([test "x$with_boehm_gc" = "xyes"],
282     AC_SEARCH_LIBS([GC_malloc], [gc],
283         [AC_DEFINE(USE_BOEHM_GC, 1, [Define if Boehm GC is to be used])],
284         [AC_MSG_FAILURE([--enable-boehm-gc specified but test for libgc failed])]))
287 dnl LCOV
288 dnl ====
289 AC_ARG_ENABLE([lcov],
290     [AS_HELP_STRING([--enable-lcov[=output-directory]], [enable coverage data generation using LCOV (GCC only) [default=no]])],
291     [],
292     [enable_lcov=no])
294 AS_IF([test "x$enable_lcov" != "xno"],
295     [AX_CFLAGS_GCC_OPTION(-fprofile-arcs -ftest-coverage)
296     AS_IF([test "x$enable_lcov" = "xyes"],
297         [lcov_output_directory="coverage-report"],
298         [lcov_output_directory="${enable_lcov}/coverage-report"])
299     AC_SUBST(lcov_output_directory)])
301 AM_CONDITIONAL([USE_LCOV], [test "x$enable_lcov" != "xno"])
304 dnl ============================
305 dnl Checks for library functions
306 dnl ============================
307 dnl not used anywhere
308 AC_FUNC_MEMCMP
309 AC_FUNC_VPRINTF
310 WM_FUNC_SECURE_GETENV
311 AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
312                setsid mallinfo mkstemp sysconf)
313 AC_SEARCH_LIBS([strerror], [cposix])
315 dnl nanosleep is generally available in standard libc, although not always the
316 dnl case. One known example is Solaris which needs -lrt
317 AC_SEARCH_LIBS([nanosleep], [rt], [],
318     [AC_MSG_ERROR([function 'nanosleep' not found, please report to wmaker-dev@lists.windowmaker.org])])
320 dnl the flag 'O_NOFOLLOW' for 'open' is used in WINGs
321 WM_FUNC_OPEN_NOFOLLOW
324 dnl Check for strlcat/strlcpy
325 dnl =========================
326 AC_ARG_WITH([libbsd],
327   [AS_HELP_STRING([--without-libbsd], [do not use libbsd for strlcat and strlcpy [default=check]])],
328   [AS_IF([test "x$with_libbsd" != "xno"],
329     [with_libbsd=bsd]
330     [with_libbsd=]
331   )],
332   [with_libbsd=bsd])
334 tmp_libs=$LIBS
335 AC_SEARCH_LIBS([strlcat],[$with_libbsd],
336   [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available])],
337   [],
338   []
340 AC_SEARCH_LIBS([strlcpy],[$with_libbsd],
341   [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcpy is available])],
342   [],
343   []
345 LIBS=$tmp_libs
347 LIBBSD=
348 AS_IF([test "x$ac_cv_search_strlcat" = "x-lbsd" -o "x$ac_cv_search_strlcpy" = "x-lbsd"],
349   [LIBBSD=-lbsd
350    AC_CHECK_HEADERS([bsd/string.h])]
352 AC_SUBST(LIBBSD)
354 dnl Check for OpenBSD kernel memory interface - kvm(3)
355 dnl ==================================================
356 AS_IF([test "x$WM_OSDEP" = "xbsd"],
357   AC_SEARCH_LIBS([kvm_openfiles], [kvm]) )
359 dnl Check for inotify
360 dnl =================
361 AC_CHECK_HEADERS(sys/inotify.h, AC_DEFINE(HAVE_INOTIFY, 1, Check for inotify))
364 dnl Check for syslog 
365 dnl =================
366 AC_CHECK_HEADERS([syslog.h], [AC_DEFINE([HAVE_SYSLOG], [1], [Check for syslog])])
369 dnl Checks for header files.
370 dnl =======================
371 AC_HEADER_SYS_WAIT
372 AC_HEADER_TIME
373 AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h libintl.h poll.h malloc.h ctype.h \
374                  string.h strings.h)
377 dnl Checks for typedefs, structures, and compiler characteristics.
378 dnl ==============================================================
379 AC_DECL_SYS_SIGLIST
380 AC_C_CONST
381 AC_C_INLINE
382 WM_C_NORETURN
383 AC_TYPE_SIZE_T
384 AC_TYPE_PID_T
385 AC_TYPE_SIGNAL
388 dnl pkg-config
389 dnl ==========
390 dnl AC_ARG_VAR(PKGCONFIG, [pkg-config command])
391 AC_CHECK_PROG(PKGCONFIG, pkg-config, pkg-config) 
393 dnl gettext
394 dnl =======
396 dnl AM_GNU_GETTEXT
398 INTLIBS=""
400 AC_CHECK_FUNC(gettext, [HAVEGETTEXT="yes"], 
401         AC_CHECK_LIB(intl, gettext, [INTLIBS="-lintl" HAVEGETTEXT="yes"],
402                          INTLIBS="" ))
404 AC_CHECK_PROG(XGETTEXT, xgettext, xgettext)
406 if test "$XGETTEXT" != ""; then 
407     if $XGETTEXT --help 2>&1 | grep illegal >/dev/null ; then
408         echo "xgettext isn't GNU version"
409         XGETTEXT=""
410     fi
413 if test "$LINGUAS" != ""; then
414     if test "$XGETTEXT" != "" -a "$HAVEGETTEXT" != ""; then
415         AC_DEFINE(I18N, 1, [Internationalization (I18N) support (set by configure)])
416         PO=""
417         echo "xgettext and gettext() exist; will build i18n support for $LINGUAS"
418     else
419         LINGUAS=""
420         PO=""
421         echo "xgettext and libintl.a don't both exist; will not build i18n support"
422     fi
423 else
424         INTLIBS=""
425         MOFILES=""
426         WPMOFILES=""
427         UTILMOFILES=""
428         PO=""
432 dnl The Tower of Babel
433 dnl ==================
435 dnl List of supported locales
436 dnl =========================
437 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"
438 supported_wprefs_locales="bg ca cs de es et fi fr hr hu it ja ko nl pt ru sk zh_CN zh_TW"
439 supported_wings_locales="bg ca cs de fr hu nl sk"
440 supported_util_locales="de es fr nl pt"
442 for lang in $LINGUAS; do
443         ok=0
444         for l in $supported_locales; do
445                 if test "$l" = "$lang"; then
446                         ok=1
447                         break
448                 fi
449         done
450         if test "$ok" = 1; then
451                 MOFILES="$MOFILES $lang.mo"
452         else
453                 echo "Locale $lang is not supported."
454         fi
455         ok=0
456         for l in $supported_wprefs_locales; do
457                 if test "$l" = "$lang"; then
458                         ok=1
459                         break
460                 fi
461         done
462         if test "$ok" = 1; then
463                 WPMOFILES="$WPMOFILES $lang.mo"
464         fi
465         ok=0
466         for l in $supported_util_locales; do
467                 if test "$l" = "$lang"; then
468                         ok=1
469                         break
470                 fi
471         done
472         if test "$ok" = 1; then
473                 UTILMOFILES="$UTILMOFILES $lang.mo"
474         fi
475         ok=0
476         for l in $supported_wings_locales; do
477                 if test "$l" = "$lang"; then
478                         ok=1
479                         break
480                 fi
481         done
482         if test "$ok" = 1; then
483                 WINGSMOFILES="$WINGSMOFILES $lang.mo"
484         fi
485 done
488 dnl Added by Oliver - Support for NLSDIR option
489 dnl ===========================================
490 AC_ARG_WITH(nlsdir, AS_HELP_STRING([--with-nlsdir=PATH], [specify where the locale stuff should go]))
492 if test "x$NLSDIR" = "x"; then
493         if test "x$with_nlsdir" != "x"; then
494                 NLSDIR=$with_nlsdir
495         else
496                 NLSDIR='$(prefix)/lib/locale'
497         fi
500 menutextdomain=
501 AC_ARG_WITH(menu-textdomain, AS_HELP_STRING([--with-menu-textdomain=DOMAIN], [specify gettext domain used for menu translations]),
502         [if test "x$withval" != "xno"; then
503          menutextdomain=$withval
504          fi])
505 AC_SUBST(menutextdomain)
507 AC_SUBST(INTLIBS)
508 AC_SUBST(NLSDIR)
509 AC_SUBST(MOFILES)
510 AC_SUBST(WPMOFILES)
511 AC_SUBST(UTILMOFILES)
512 AC_SUBST(WINGSMOFILES)
513 AC_SUBST(supported_locales)
515 dnl ===========================================
516 dnl             Stuff that uses X
517 dnl ===========================================
519 AC_PATH_XTRA
521 if test $no_x; then
522     AC_MSG_ERROR([The path for the X11 files not found!
523 Make sure you have X and it's headers and libraries (the -devel packages
524 in Linux) installed.])
527 X_LIBRARY_PATH=$x_libraries
528 XCFLAGS="$X_CFLAGS"
529 XLFLAGS="$X_LIBS"
530 XLIBS="-lX11 $X_EXTRA_LIBS"
532 lib_search_path="$lib_search_path $XLFLAGS"
533 inc_search_path="$inc_search_path $XCFLAGS"
535 AC_SUBST(X_LIBRARY_PATH)
537 dnl Decide which locale function to use, setlocale() or _Xsetlocale()
538 dnl by MANOME Tomonori 
539 dnl ===========================================
540 use_locale=yes
541 AC_ARG_ENABLE(locale, AS_HELP_STRING([--disable-locale], [disable use of X locale support]),
542               use_locale=no)
544 if test "$use_locale" = yes; then
545         AC_CHECK_LIB(X11, _Xsetlocale,
546                 AC_DEFINE(X_LOCALE, 1, [define if you want support for X window's X_LOCALE (set by configure)]),,
547                 $XLFLAGS $XLIBS)
550 dnl Check whether XInternAtoms() exist
551 dnl ==================================
552 AC_CHECK_LIB(X11, XInternAtoms, 
553              AC_DEFINE(HAVE_XINTERNATOMS, 1, [define if your X server has XInternAtoms() (set by configure)]),,
554              $XLFLAGS $XLIBS)
556 dnl Check whether XConvertCase() exist
557 dnl ==================================
558 AC_CHECK_LIB(X11, XConvertCase, 
559              AC_DEFINE(HAVE_XCONVERTCASE, 1, [define if your X server has XConvertCase() (set by configure)]),,
560              $XLFLAGS $XLIBS)
562 dnl XKB keyboard language status
563 dnl ============================
564 AC_ARG_ENABLE(modelock, AS_HELP_STRING([--enable-modelock], [XKB keyboard language status support]),
565                 AC_DEFINE(XKB_MODELOCK, 1, [whether XKB language MODELOCK should be enabled]))
567 dnl XDND Drag-nd-Drop support
568 dnl ============================
569 AC_ARG_ENABLE([xdnd],
570     [AS_HELP_STRING([--disable-xdnd], [disable Drag-nd-Drop support])],
571     [AS_CASE(["$enableval"],
572         [yes|no], [],
573         [AC_MSG_ERROR([bad value $enableval for --disable-xdnd]) ]) ],
574     [enable_xdnd=yes
575   supported_xext="$supported_xext XDnD"
576   AC_DEFINE(XDND, 1, [whether Drag-nd-Drop support should be enabled])
579 dnl XShape support
580 dnl ==============
581 AC_ARG_ENABLE([shape],
582     [AS_HELP_STRING([--disable-shape], [disable shaped window extension support])],
583     [AS_CASE(["$enableval"],
584         [yes|no], [],
585         [AC_MSG_ERROR([bad value $enableval for --enable-shape]) ]) ],
586     [enable_shape=auto])
587 WM_XEXT_CHECK_XSHAPE
589 dnl MIT-SHM support
590 dnl ===============
591 AC_ARG_ENABLE([shm],
592     [AS_HELP_STRING([--disable-shm], [disable usage of MIT-SHM extension])],
593     [AS_CASE(["$enableval"],
594         [yes|no], [],
595         [AC_MSG_ERROR([bad value $enableval for --enable-shm]) ]) ],
596     [enable_shm=auto])
597 WM_XEXT_CHECK_XSHM
599 dnl X Misceleanous Utility
600 dnl ======================
601 # the libXmu is used in WRaster
602 WM_EXT_CHECK_XMU
604 dnl XINERAMA support
605 dnl ================
606 AC_ARG_ENABLE([xinerama],
607     [AS_HELP_STRING([--enable-xinerama], [enable Xinerama extension support])],
608     [AS_CASE(["$enableval"],
609         [yes|no], [],
610         [AC_MSG_ERROR([bad value $enableval for --enable-xinerama]) ]) ],
611     [enable_xinerama=auto])
612 WM_XEXT_CHECK_XINERAMA
614 dnl RandR support
615 dnl ==============
616 AC_ARG_ENABLE([randr],
617     [AS_HELP_STRING([--enable-randr], [enable RandR extension support (NOT recommended, buggy)])],
618     [AS_CASE(["$enableval"],
619         [yes|no], [],
620         [AC_MSG_ERROR([bad value $enableval for --enable-randr]) ]) ],
621     [enable_randr=no])
622 WM_XEXT_CHECK_XRANDR
625 dnl libWINGS uses math functions, check whether usage requires linking
626 dnl against libm
628 WM_CHECK_LIBM
631 dnl libWINGS uses FcPatternDel from libfontconfig
633 AC_MSG_CHECKING([for fontconfig library])
634 FCLIBS=`$PKGCONFIG fontconfig --libs`
635 if test "x$FCLIBS" = "x" ; then
636         AC_MSG_RESULT([not found])
637 else
638         AC_MSG_RESULT([found])
640 AC_SUBST(FCLIBS)
643 dnl Xft2 antialiased font support
644 dnl =============================
646 xft=yes
647 XFTLIBS=""
649 if test "x$PKGCONFIG" != x -a "`$PKGCONFIG xft; echo $?`" = 0; then
650         XFTCONFIG="$PKGCONFIG xft"
651         pkgconfig_xft=yes
652 else
653         AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config)
656 AC_MSG_CHECKING([for the Xft2 library])
658 if test "x$XFTCONFIG" != x; then
659         XFTLIBS=`$XFTCONFIG --libs`
660         XFTFLAGS=`$XFTCONFIG --cflags`
661         AC_MSG_RESULT([found])
662 else
663         AC_MSG_RESULT([not found])
664         echo
665         echo "ERROR!!! libXft2 is not installed or could not be found."
666         echo "         Xft2 is a requirement for building Window Maker."
667         echo "         Please install it (along with fontconfig) before continuing."
668         echo
669         exit 1
672 minXFT="2.1.0"
673 goodxft="no"
676 dnl The macro below will use $XFTFLAGS (defined above) to find Xft.h
678 WM_CHECK_XFT_VERSION($minXFT, goodxft=yes, goodxft=no)
680 if test "$goodxft" = no; then
681         echo
682         echo "ERROR!!! libXft on this system is an old version."
683         echo "         Please consider upgrading to at least version ${minXFT}."
684         echo
685         exit 1
688 AC_SUBST(XFTFLAGS)
689 AC_SUBST(XFTLIBS)
691 dnl PANGO support
692 dnl =============
693 pango=no
694 AC_ARG_ENABLE(pango, AS_HELP_STRING([--enable-pango], [enable Pango text layout support]),
695                 pango=$enableval, pango=no)
697 PANGOFLAGS=
698 PANGOLIBS=
699 if test "$pango" = yes; then
700         PANGOLIBS=`$PKGCONFIG pangoxft --libs`
701         PANGOFLAGS=`$PKGCONFIG pangoxft --cflags`
702         if test "x$PANGOLIBS" = "x" ; then
703                 AC_MSG_RESULT([not found])
704         else
705                 AC_DEFINE(USE_PANGO, 1, [Define if Pango is to be used])
706                 AC_MSG_RESULT([found])
707         fi
709 inc_search_path="$inc_search_path $PANGOFLAGS"
710 AC_SUBST(PANGOLIBS)
712 dnl ==============================================
713 dnl         Graphic Format Libraries
714 dnl ==============================================
716 dnl XPM Support
717 dnl ===========
718 AC_ARG_ENABLE([xpm],
719     [AS_HELP_STRING([--disable-xpm], [disable use of XPM pixmaps through libXpm])],
720     [AS_CASE(["$enableval"],
721         [yes|no], [],
722         [AC_MSG_ERROR([bad value $enableval for --enable-xpm])] )],
723     [enable_xpm=auto])
724 WM_IMGFMT_CHECK_XPM
727 # for wmlib
728 AC_SUBST(XCFLAGS)
729 # for test
730 AC_SUBST(XLFLAGS)
731 AC_SUBST(XLIBS)
732 AC_SUBST(X_EXTRA_LIBS)
734 dnl ===============================================
735 dnl             End of stuff that uses X
736 dnl ===============================================
738 dnl EXIF Support
739 dnl ===========
740 WM_CHECK_LIBEXIF
741 AS_IF([test "x$LIBEXIF" != "x"],
742         [AC_DEFINE(HAVE_EXIF, 1, [Define if EXIF can be used])])
744 dnl PNG Support
745 dnl ===========
746 AC_ARG_ENABLE([png],
747     [AS_HELP_STRING([--disable-png], [disable PNG support through libpng])],
748     [AS_CASE(["$enableval"],
749         [yes|no], [],
750         [AC_MSG_ERROR([bad value $enableval for --enable-png])] )],
751     [enable_png=auto])
752 WM_IMGFMT_CHECK_PNG
755 dnl JPEG Support
756 dnl ============
757 AC_ARG_ENABLE([jpeg],
758     [AS_HELP_STRING([--disable-jpeg], [disable JPEG support through libjpeg])],
759     [AS_CASE(["$enableval"],
760         [yes|no], [],
761         [AC_MSG_ERROR([bad value $enableval for --enable-jpeg])] )],
762     [enable_jpeg=auto])
763 WM_IMGFMT_CHECK_JPEG
766 dnl GIF Support
767 dnl ============
768 AC_ARG_ENABLE(gif,
769     [AS_HELP_STRING([--disable-gif], [disable GIF support through libgif or libungif])],
770     [AS_CASE(["$enableval"],
771         [yes|no], [],
772         [AC_MSG_ERROR([bad value $enableval for --enable-gif])] )],
773     [enable_gif=auto])
774 WM_IMGFMT_CHECK_GIF
777 dnl TIFF Support
778 dnl ============
779 AC_ARG_ENABLE([tiff],
780     [AS_HELP_STRING([--disable-tiff], [disable use of TIFF images through libtiff])],
781     [AS_CASE(["$enableval"],
782         [yes|no], [],
783         [AC_MSG_ERROR([bad value $enableval for --enable-tiff])] )],
784     [enable_tiff=auto])
785 WM_IMGFMT_CHECK_TIFF
788 dnl WEBP Support
789 dnl ===========
790 AC_ARG_ENABLE([webp],
791     [AS_HELP_STRING([--disable-webp], [disable WEBP support through libwebp])],
792     [AS_CASE(["$enableval"],
793         [yes|no], [],
794         [AC_MSG_ERROR([bad value $enableval for --enable-webp])] )],
795     [enable_webp=auto])
796 WM_IMGFMT_CHECK_WEBP
799 dnl MAGICK Support
800 dnl ===========
801 AC_ARG_ENABLE([magick],
802     [AS_HELP_STRING([--disable-magick], [disable MAGICK support through libMagickWand])],
803     [AS_CASE(["$enableval"],
804         [yes|no], [],
805         [AC_MSG_ERROR([bad value $enableval for --enable-magick])] )],
806     [enable_magick=auto])
807 WM_IMGFMT_CHECK_MAGICK
810 dnl PPM Support
811 dnl ===========
812 # The PPM format is always enabled because we have built-in support for the format
813 # We are not using any external library like libppm
814 supported_gfx="$supported_gfx builtin-PPM"
817 # Choice of the default format for icons
818 AS_IF([test "x$enable_tiff" != "xno"],
819     [ICONEXT="tiff"],
820     [ICONEXT="xpm"])
823 LIBRARY_SEARCH_PATH="$lib_search_path"
824 HEADER_SEARCH_PATH="$inc_search_path"
826 AC_SUBST(LIBRARY_SEARCH_PATH)
827 AC_SUBST(HEADER_SEARCH_PATH)
830 AC_SUBST(GFXLIBS)
831 AC_SUBST(ICONEXT)
832 AM_CONDITIONAL([ICON_EXT_XPM],  [test "x$ICONEXT" = "xxpm"])
833 AM_CONDITIONAL([ICON_EXT_TIFF], [test "x$ICONEXT" = "xtiff"])
836 dnl ==============================================
837 dnl         End of Graphic Format Libraries
838 dnl ==============================================
842 dnl stdlib.h is checked here, because of conflict in jpeglib.h
843 AC_CHECK_HEADERS(stdlib.h)
845 # AC_PREFIX_PROGRAM(wmaker)
847 dnl Support for PIXMAPDIR option
848 dnl ============================
849 AC_ARG_WITH(pixmapdir, AS_HELP_STRING([--with-pixmapdir=PATH], [specify where pixmaps are located [DATADIR/pixmaps]]))
851 if test "x$with_pixmapdir" != "x"; then
852         pixmapdir=$with_pixmapdir
853 else
854         pixmapdir='${datadir}/pixmaps'
856 AC_SUBST(pixmapdir)
859 dnl Support for GNUSTEP_LOCAL_ROOT, for WPrefs.app
860 dnl ==============================================
862 AC_ARG_WITH(gnustepdir, AS_HELP_STRING([--with-gnustepdir=PATH], [specify the directory for GNUstep applications]))
864 if test "x`echo $with_gnustepdir | grep ^/`" != "x"; then
865     appspath=$with_gnustepdir
868 if test "x$appspath$GNUSTEP_LOCAL_ROOT" = "x"; then
869     wprefs_base_dir=${prefix}
870     wprefs_datadir="${datadir}/WPrefs"
871     wprefs_bindir="${bindir}"
872 else
873     gnustepdir=$appspath
875     if test "x$GNUSTEP_LOCAL_ROOT" != "x" ; then
876         gnustepdir=`echo "$GNUSTEP_LOCAL_ROOT" | sed -e "s|^${prefix}|prefix|"`
877         gnustepdir=`echo $gnustepdir | sed -e 's|^prefix|${prefix}|'`
878     fi
880     wprefs_base_dir=$gnustepdir/Applications
881     wprefs_datadir=$wprefs_base_dir/WPrefs.app
882     wprefs_bindir=$wprefs_base_dir/WPrefs.app
885 AC_SUBST(wprefs_datadir)
886 AC_SUBST(wprefs_bindir)
889 dnl Enable User Defined Menu thing
890 dnl ==============================
891 AC_ARG_ENABLE(usermenu, AS_HELP_STRING([--enable-usermenu], [user defined menus for applications]),
892 if test "$enableval" = yes; then
893         AC_DEFINE(USER_MENU, 1, [define if you want user defined menus for applications])
897 gl_LD_VERSION_SCRIPT
900 dnl Add the post-poned compilation options
901 dnl ======================================
902 WM_CFLAGS_GCC_OPTION_POSTPONED
905 AC_OUTPUT(Makefile po/Makefile util/Makefile util/po/Makefile test/Makefile \
906         WINGs/Makefile WINGs/WINGs/Makefile WINGs/Documentation/Makefile \
907         WINGs/Examples/Makefile WINGs/Resources/Makefile WINGs/Tests/Makefile \
908         WINGs/Extras/Makefile WINGs/po/Makefile \
909         wmlib/Makefile wrlib/Makefile wrlib/tests/Makefile \
910         src/Makefile src/wconfig.h \
911         doc/Makefile doc/sk/Makefile doc/cs/Makefile \
912         doc/ru/Makefile \
913         WindowMaker/Makefile WindowMaker/Backgrounds/Makefile \
914         WindowMaker/Defaults/Makefile WindowMaker/IconSets/Makefile \
915         WindowMaker/Icons/Makefile WindowMaker/Pixmaps/Makefile \
916         WindowMaker/Styles/Makefile WindowMaker/Themes/Makefile \
917         WPrefs.app/Makefile WPrefs.app/tiff/Makefile WPrefs.app/xpm/Makefile \
918         WPrefs.app/po/Makefile )
921 dnl Output some helpful data for compiling wraster and WINGs/WUtil apps
922 dnl ===================================================================
924 dnl echo "WFLAGS=\"$LIBPL_INC_PATH -I$prefix/include\"" > WINGs-flags
925 dnl echo "WLIBS=\"-L$exec_prefix/lib -lWINGs -lwraster $LIBPL_LIBS $GFXLIBS -lm\""\
926 dnl     | sed -e 's|\$(prefix)|'"$prefix|" >> WINGs-flags
928 dnl The #lp# and #rp# stuff below is a hack because [ and ] get lost when
929 dnl parsed by m4
931 AC_SUBST(lib_search_path)
932 AC_SUBST(inc_search_path)
935 dnl Spit out the configuration
936 dnl ==========================
938 if test "x$MOFILES" = "x"; then
939         mof=None
940 else
941         mof=`echo $MOFILES`
944 if test "x$MOFILES" = "x"; then
945         languages=None
946 else
947         languages=`echo $MOFILES | sed 's/.mo//g'`
950 echo
951 echo "Window Maker was configured as follows:"
952 echo
953 echo "Installation path prefix            : $prefix"
954 echo "Installation path for binaries      : $_bindir"
955 echo "Installation path for libraries     : $libdir"
956 echo "Installation path for WPrefs.app    : $wprefs_base_dir" | sed -e 's|\${prefix}|'"$prefix|"
957 echo "Supported X extensions:             :$supported_xext"
958 echo "Supported graphic format libraries  :$supported_gfx"
959 echo "Unsupported features                :$unsupported"
960 echo "Antialiased text support in WINGs   : $xft"
961 echo "Pango text layout support in WINGs  : $pango"
962 echo "Translated message files to install : $mof"
963 dnl echo "Supported languages beside English  : $languages"
964 if test "x$MOFILES" != "x"; then
965         echo "Installation path for translations  : $NLSDIR" | sed -e 's|\$(prefix)|'"$prefix|"
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 dnl WM_PRINT_REDCRAP_BUG_STATUS
976 AS_IF([test "x$enable_jpeg" = xno], [dnl
977     AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])
978     AS_ECHO([])
979     AS_ECHO(["JPEG support will not be included because the JPEG library is"])
980     AS_ECHO(["not installed correctly or was not found. Background images"])
981     AS_ECHO(["from themes will not display as they usually are JPEG files."])
982     AS_ECHO([])
983     AS_ECHO(["To fix, download and install the jpeg library and/or make sure you"])
984     AS_ECHO(["installed all jpeg related packages, SPECIALLY the development packages"])
985     AS_ECHO(["like jpeg-dev (if you use some prepackaged version of libjpeg)."])
986     AS_ECHO([])
987     AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])dnl
991 dnl This is for Emacs.  I'm lazy, I know... (nicolai)
992 dnl ================================================
993 dnl Local Variables:
994 dnl compile-command: "autoconf"
995 dnl End: