1dnl ============================================================================
2dnl
3dnl Window Maker autoconf input
4dnl
5AC_COPYRIGHT([Copyright (c) 2001-2015 The Window Maker Team])
6dnl
7dnl ============================================================================
8dnl
9dnl This program is free software; you can redistribute it and/or modify
10dnl it under the terms of the GNU General Public License as published by
11dnl the Free Software Foundation; either version 2 of the License, or
12dnl (at your option) any later version.
13dnl
14dnl This program is distributed in the hope that it will be useful,
15dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
16dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17dnl GNU General Public License for more details.
18dnl
19dnl You should have received a copy of the GNU General Public License along
20dnl with this program; see the file COPYING.
21dnl
22dnl ============================================================================
23dnl
24dnl Process with: ./autogen.sh
25
26
27dnl Due to a bug in Autoconf 2.68 (apparently a regression), we need at least
28dnl version 2.68b which includes this patch:
29dnl   http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commit;h=2b0d95faef68d7ed7c08b0edb9ff1c38728376fa
30dnl
31dnl Because the 2.69 was released only a few month later, let's just ask for it
32AC_PREREQ([2.69])
33
34
35dnl Configuration for Autoconf and Automake
36dnl =======================================
37AC_INIT([WindowMaker],[0.95.9],[wmaker-dev@googlegroups.com],[WindowMaker],[http://www.windowmaker.org/])
38AC_CONFIG_MACRO_DIR([m4])
39AC_CONFIG_HEADERS([config.h])
40
41dnl We need the EXTRA_xxx_DEPENDENCIES keyword in Makefiles which have been
42dnl introduced in the version 1.11.3; because the 1.12 was realeased shortly
43dnl after, we just ask for it
44AM_INIT_AUTOMAKE([1.12 silent-rules])
45
46dnl Reference file used by 'configure' to make sure the path to sources is valid
47AC_CONFIG_SRCDIR([src/WindowMaker.h])
48
49dnl Include at the end of 'config.h', this file is generated by top-level Makefile
50AH_BOTTOM([@%:@include "config-paths.h"])
51
52
53dnl libtool library versioning
54dnl ==========================
55dnl
56dnl current
57dnl revision
58dnl age
59dnl
60dnl 1. Start with version information of ‘0:0:0’ for each libtool library.
61dnl 2. Update the version information only immediately before a public
62dnl release of your software. More frequent updates are unnecessary, and
63dnl only guarantee that the current interface number gets larger faster.
64dnl 3. If the library source code has changed at all since the last
65dnl update, then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
66dnl 4. If any interfaces have been added, removed, or changed since the
67dnl last update, increment current, and set revision to 0.
68dnl 5. If any interfaces have been added since the last public release,
69dnl then increment age.
70dnl 6. If any interfaces have been removed or changed since the last
71dnl public release, then set age to 0.
72dnl
73dnl libwraster
74WRASTER_CURRENT=6
75WRASTER_REVISION=0
76WRASTER_AGE=0
77WRASTER_VERSION=$WRASTER_CURRENT:$WRASTER_REVISION:$WRASTER_AGE
78AC_SUBST(WRASTER_VERSION)
79dnl
80dnl libWINGs
81WINGS_CURRENT=4
82WINGS_REVISION=0
83WINGS_AGE=1
84WINGS_VERSION=$WINGS_CURRENT:$WINGS_REVISION:$WINGS_AGE
85AC_SUBST(WINGS_VERSION)
86dnl
87dnl libWUtil
88WUTIL_CURRENT=5
89WUTIL_REVISION=0
90WUTIL_AGE=0
91WUTIL_VERSION=$WUTIL_CURRENT:$WUTIL_REVISION:$WUTIL_AGE
92AC_SUBST(WUTIL_VERSION)
93
94
95dnl Checks for programs
96dnl ===================
97AC_PROG_CC
98WM_PROG_CC_C11
99AC_PROG_LN_S
100AC_PROG_GCC_TRADITIONAL
101LT_INIT
102
103
104dnl Debugging Options
105dnl =================
106AC_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])
113AS_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"
129])
130
131
132AX_CFLAGS_GCC_OPTION([-Wall])
133AX_CFLAGS_GCC_OPTION([-Wextra -Wno-sign-compare])
134dnl
135dnl The use of trampolines cause code that can crash on some secured OS, it is
136dnl also known to be a source of crash if not used properly, in a more general
137dnl way it tends to generate binary code that may not be optimal, and it is
138dnl not compatible with the 'nested-func-to-macro' workaround
139WM_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         ])
143dnl
144AS_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])
232])
233
234
235dnl Support for Nested Functions by the compiler
236dnl ============================================
237WM_PROG_CC_NESTEDFUNC
238
239
240dnl Posix thread
241dnl ============
242dnl they are used by util/wmiv
243AX_PTHREAD
244
245
246dnl Tracking on what is detected for final status
247dnl =============================================
248unsupported=""
249supported_core=""
250supported_xext=""
251supported_gfx=""
252
253
254dnl Platform-specific Makefile setup
255dnl ================================
256AS_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"])
265AM_CONDITIONAL([WM_OSDEP_LINUX],   [test "x$WM_OSDEP" = "xlinux"])
266AM_CONDITIONAL([WM_OSDEP_BSD],     [test "x$WM_OSDEP" = "xbsd"])
267AM_CONDITIONAL([WM_OSDEP_DARWIN],  [test "x$WM_OSDEP" = "xdarwin"])
268AM_CONDITIONAL([WM_OSDEP_GENERIC], [test "x$WM_OSDEP" = "xstub"])
269
270
271dnl the prefix
272dnl ==========
273dnl
274dnl move this earlier in the script... anyone know why this is handled
275dnl in such a bizarre way?
276
277test "x$prefix" = xNONE && prefix=$ac_default_prefix
278dnl Let make expand exec_prefix.
279test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
280
281
282_bindir=`eval echo $bindir`
283_bindir=`eval echo $_bindir`
284_libdir=`eval echo $libdir`
285_libdir=`eval echo $_libdir`
286
287lib_search_path='-L${libdir}'
288
289inc_search_path='-I${includedir}'
290
291dnl ===============================================
292dnl Specify paths to look for libraries and headers
293dnl ===============================================
294AC_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"])
296
297AC_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"])
299
300
301dnl Features Configuration
302dnl ======================
303AC_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"])
309AS_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"])
313
314
315AC_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"])
321AS_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"])
325AM_CONDITIONAL([USE_MWM_HINTS], [test "x$enable_mwm_hints" != "xno"])
326
327
328dnl Boehm GC
329dnl ========
330AC_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])
337AS_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])]))
341
342
343dnl LCOV
344dnl ====
345AC_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])
349
350AS_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)])
356
357AM_CONDITIONAL([USE_LCOV], [test "x$enable_lcov" != "xno"])
358
359
360dnl ============================
361dnl Checks for library functions
362dnl ============================
363AC_FUNC_MEMCMP
364AC_FUNC_VPRINTF
365WM_FUNC_SECURE_GETENV
366AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
367	       setsid mallinfo mkstemp sysconf)
368AC_SEARCH_LIBS([strerror], [cposix])
369
370dnl nanosleep is generally available in standard libc, although not always the
371dnl case. One known example is Solaris which needs -lrt
372AC_SEARCH_LIBS([nanosleep], [rt], [],
373    [AC_MSG_ERROR([function 'nanosleep' not found, please report to wmaker-dev@googlegroups.com])])
374
375dnl the flag 'O_NOFOLLOW' for 'open' is used in WINGs
376WM_FUNC_OPEN_NOFOLLOW
377
378
379dnl Check for strlcat/strlcpy
380dnl =========================
381AC_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])
388
389tmp_libs=$LIBS
390AC_SEARCH_LIBS([strlcat],[$with_libbsd],
391  [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available])],
392  [],
393  []
394)
395AC_SEARCH_LIBS([strlcpy],[$with_libbsd],
396  [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcpy is available])],
397  [],
398  []
399)
400LIBS=$tmp_libs
401
402LIBBSD=
403AS_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])]
406)
407AC_SUBST(LIBBSD)
408
409
410dnl Check for OpenBSD kernel memory interface - kvm(3)
411dnl ==================================================
412AS_IF([test "x$WM_OSDEP" = "xbsd"],
413  AC_SEARCH_LIBS([kvm_openfiles], [kvm]) )
414
415
416dnl Check for inotify
417dnl =================
418dnl It is used by WindowMaker to reload automatically the configuration when the
419dnl user changed it using WPref or wdwrite
420AC_CHECK_HEADERS([sys/inotify.h],
421    [AC_DEFINE([HAVE_INOTIFY], [1], [Check for inotify])])
422
423
424dnl Check for syslog
425dnl ================
426dnl It is used by WUtil to log the wwarning, werror and wfatal
427AC_CHECK_HEADERS([syslog.h], [AC_DEFINE([HAVE_SYSLOG], [1], [Check for syslog])])
428
429
430dnl Checks for header files
431dnl =======================
432AC_HEADER_SYS_WAIT
433AC_HEADER_TIME
434AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h libintl.h poll.h malloc.h ctype.h \
435		 string.h strings.h)
436
437
438dnl Checks for typedefs, structures, and compiler characteristics
439dnl =============================================================
440AC_C_CONST
441AC_C_INLINE
442WM_C_NORETURN
443AC_TYPE_SIZE_T
444AC_TYPE_PID_T
445WM_TYPE_SIGNAL
446
447
448dnl pkg-config
449dnl ==========
450PKG_PROG_PKG_CONFIG
451AS_IF([test -z "$PKG_CONFIG"],[AC_MSG_ERROR([pkg-config is required.])])
452
453
454
455dnl Internationalization
456dnl ====================
457dnl Detect the language for translations to be installed and check
458dnl that the gettext environment works
459WM_I18N_LANGUAGES
460WM_I18N_XGETTEXT
461WM_I18N_MENUTEXTDOMAIN
462
463dnl ===========================================
464dnl 		Stuff that uses X
465dnl ===========================================
466
467AC_PATH_XTRA
468
469AS_IF([test "x$no_x" = "xyes"],
470    [AC_MSG_ERROR([The path for the X11 files not found!
471Make sure you have X and it's headers and libraries (the -devel packages
472in Linux) installed.])])
473
474X_LIBRARY_PATH=$x_libraries
475XCFLAGS="$X_CFLAGS"
476XLFLAGS="$X_LIBS"
477XLIBS="-lX11 $X_EXTRA_LIBS"
478
479lib_search_path="$lib_search_path $XLFLAGS"
480inc_search_path="$inc_search_path $XCFLAGS"
481
482AC_SUBST(X_LIBRARY_PATH)
483
484
485dnl Decide which locale function to use, setlocale() or _Xsetlocale()
486dnl by MANOME Tomonori
487dnl ===========================================
488WM_I18N_XLOCALE
489
490
491
492dnl Check whether XInternAtoms() exist
493dnl ==================================
494AC_CHECK_LIB([X11], [XInternAtoms],
495    [AC_DEFINE([HAVE_XINTERNATOMS], [1],
496        [define if your X server has XInternAtoms() (set by configure)])],
497    [], [$XLFLAGS $XLIBS])
498
499
500dnl Check whether XConvertCase() exist
501dnl ==================================
502AC_CHECK_LIB([X11], [XConvertCase],
503    [AC_DEFINE([HAVE_XCONVERTCASE], [1],
504        [define if your X server has XConvertCase() (set by configure)])],
505    [], [$XLFLAGS $XLIBS])
506
507
508dnl XKB keyboard language status
509dnl ============================
510AC_ARG_ENABLE([modelock],
511    [AS_HELP_STRING([--enable-modelock], [XKB keyboard language status support])],
512    [AS_CASE([$enableval],
513        [yes|no], [],
514        [AC_MSG_ERROR([bad value '$enableval' for --enable-modelock])])],
515    [enable_modelock=no])
516AS_IF([test "x$enable_modelock" = "xyes"],
517    [AC_DEFINE([XKB_MODELOCK], [1], [whether XKB language MODELOCK should be enabled]) ])
518
519
520dnl XDND Drag-nd-Drop support
521dnl =========================
522AC_ARG_ENABLE([xdnd],
523    [AS_HELP_STRING([--disable-xdnd], [disable support for Drag-and-Drop on the dock @<:@default=enabled@:>@])],
524    [AS_CASE(["$enableval"],
525        [yes|no], [],
526        [AC_MSG_ERROR([bad value $enableval for --disable-xdnd]) ]) ],
527    [enable_xdnd=yes])
528AS_IF([test "x$enable_xdnd" = "xyes"],
529    [supported_core="$supported_core XDnD"
530     AC_DEFINE([USE_DOCK_XDND], [1], [whether Drag-and-Drop on the dock should be enabled])],
531    [unsupported="$unsupported XDnd"])
532AM_CONDITIONAL([USE_DOCK_XDND], [test "x$enable_xdnd" != "xno"])
533
534
535dnl Support for ICCCM 2.0 Window Manager replacement
536dnl ================================================
537AC_ARG_ENABLE([wmreplace],
538    [AS_HELP_STRING([--enable-wmreplace], [support for ICCCM window manager replacement])],
539    [AS_CASE([$enableval],
540        [yes|no], [],
541        [AC_MSG_ERROR([bad value '$enableval' for --enable-wmreplace])])],
542    [enable_wmreplace=no])
543AS_IF([test "x$enable_wmreplace" = "xyes"],
544    [AC_DEFINE([USE_ICCCM_WMREPLACE], [1],
545       [define to support ICCCM protocol for window manager replacement])
546     supported_xext="$supported_xext WMReplace"])
547
548
549dnl XShape support
550dnl ==============
551AC_ARG_ENABLE([shape],
552    [AS_HELP_STRING([--disable-shape], [disable shaped window extension support])],
553    [AS_CASE(["$enableval"],
554        [yes|no], [],
555        [AC_MSG_ERROR([bad value $enableval for --enable-shape]) ]) ],
556    [enable_shape=auto])
557WM_XEXT_CHECK_XSHAPE
558
559
560dnl MIT-SHM support
561dnl ===============
562AC_ARG_ENABLE([shm],
563    [AS_HELP_STRING([--disable-shm], [disable usage of MIT-SHM extension])],
564    [AS_CASE(["$enableval"],
565        [yes|no], [],
566        [AC_MSG_ERROR([bad value $enableval for --enable-shm]) ]) ],
567    [enable_shm=auto])
568WM_XEXT_CHECK_XSHM
569
570
571dnl X Misceleanous Utility
572dnl ======================
573dnl the libXmu is used in WRaster
574WM_EXT_CHECK_XMU
575
576
577dnl XINERAMA support
578dnl ================
579AC_ARG_ENABLE([xinerama],
580    [AS_HELP_STRING([--enable-xinerama], [enable Xinerama extension support])],
581    [AS_CASE(["$enableval"],
582        [yes|no], [],
583        [AC_MSG_ERROR([bad value $enableval for --enable-xinerama]) ]) ],
584    [enable_xinerama=auto])
585WM_XEXT_CHECK_XINERAMA
586
587
588dnl RandR support
589dnl =============
590AC_ARG_ENABLE([randr],
591    [AS_HELP_STRING([--enable-randr], [enable RandR extension support (NOT recommended, buggy)])],
592    [AS_CASE(["$enableval"],
593        [yes|no], [],
594        [AC_MSG_ERROR([bad value $enableval for --enable-randr]) ]) ],
595    [enable_randr=no])
596WM_XEXT_CHECK_XRANDR
597
598
599dnl Math library
600dnl ============
601dnl libWINGS uses math functions, check whether usage requires linking
602dnl against libm
603WM_CHECK_LIBM
604
605
606dnl FontConfig
607dnl ==========
608dnl libWINGS uses FcPatternDel from libfontconfig
609AC_MSG_CHECKING([for fontconfig library])
610FCLIBS=`$PKG_CONFIG fontconfig --libs`
611if test "x$FCLIBS" = "x" ; then
612        AC_MSG_RESULT([not found])
613else
614        AC_MSG_RESULT([found])
615fi
616AC_SUBST(FCLIBS)
617
618
619dnl Xft2 antialiased font support
620dnl =============================
621
622xft=yes
623XFTLIBS=""
624
625if test "x$PKG_CONFIG" != x -a "`$PKG_CONFIG xft; echo $?`" = 0; then
626        XFTCONFIG="$PKG_CONFIG xft"
627        pkgconfig_xft=yes
628else
629        AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config)
630fi
631
632AC_MSG_CHECKING([for the Xft2 library])
633
634if test "x$XFTCONFIG" != x; then
635        XFTLIBS=`$XFTCONFIG --libs`
636        XFTFLAGS=`$XFTCONFIG --cflags`
637        AC_MSG_RESULT([found])
638else
639        AC_MSG_RESULT([not found])
640        echo
641        echo "ERROR!!! libXft2 is not installed or could not be found."
642        echo "         Xft2 is a requirement for building Window Maker."
643        echo "         Please install it (along with fontconfig) before continuing."
644        echo
645        exit 1
646fi
647
648minXFT="2.1.0"
649goodxft="no"
650
651dnl
652dnl The macro below will use $XFTFLAGS (defined above) to find Xft.h
653dnl
654WM_CHECK_XFT_VERSION($minXFT, goodxft=yes, goodxft=no)
655
656if test "$goodxft" = no; then
657        echo
658        echo "ERROR!!! libXft on this system is an old version."
659        echo "         Please consider upgrading to at least version ${minXFT}."
660        echo
661        exit 1
662fi
663
664AC_SUBST(XFTFLAGS)
665AC_SUBST(XFTLIBS)
666
667dnl PANGO support
668dnl =============
669pango=no
670AC_ARG_ENABLE(pango, AS_HELP_STRING([--enable-pango], [enable Pango text layout support]),
671                pango=$enableval, pango=no)
672
673PANGOFLAGS=
674PANGOLIBS=
675if test "$pango" = yes; then
676	PANGOLIBS=`$PKG_CONFIG pangoxft --libs`
677	PANGOFLAGS=`$PKG_CONFIG pangoxft --cflags`
678	if test "x$PANGOLIBS" = "x" ; then
679	        AC_MSG_RESULT([not found])
680	else
681		AC_DEFINE(USE_PANGO, 1, [Define if Pango is to be used])
682		AC_MSG_RESULT([found])
683	fi
684fi
685inc_search_path="$inc_search_path $PANGOFLAGS"
686AC_SUBST(PANGOLIBS)
687
688dnl ==============================================
689dnl         Graphic Format Libraries
690dnl ==============================================
691
692dnl XPM Support
693dnl ===========
694AC_ARG_ENABLE([xpm],
695    [AS_HELP_STRING([--disable-xpm], [disable use of XPM pixmaps through libXpm])],
696    [AS_CASE(["$enableval"],
697        [yes|no], [],
698        [AC_MSG_ERROR([bad value $enableval for --enable-xpm])] )],
699    [enable_xpm=auto])
700WM_IMGFMT_CHECK_XPM
701
702
703# for wmlib
704AC_SUBST(XCFLAGS)
705# for test
706AC_SUBST(XLFLAGS)
707AC_SUBST(XLIBS)
708AC_SUBST(X_EXTRA_LIBS)
709
710dnl ===============================================
711dnl 		End of stuff that uses X
712dnl ===============================================
713
714dnl EXIF Support
715dnl ============
716WM_CHECK_LIBEXIF
717AS_IF([test "x$LIBEXIF" != "x"],
718        [AC_DEFINE(HAVE_EXIF, 1, [Define if EXIF can be used])])
719
720
721dnl PNG Support
722dnl ===========
723AC_ARG_ENABLE([png],
724    [AS_HELP_STRING([--disable-png], [disable PNG support through libpng])],
725    [AS_CASE(["$enableval"],
726        [yes|no], [],
727        [AC_MSG_ERROR([bad value $enableval for --enable-png])] )],
728    [enable_png=auto])
729WM_IMGFMT_CHECK_PNG
730
731
732dnl JPEG Support
733dnl ============
734AC_ARG_ENABLE([jpeg],
735    [AS_HELP_STRING([--disable-jpeg], [disable JPEG support through libjpeg])],
736    [AS_CASE(["$enableval"],
737        [yes|no], [],
738        [AC_MSG_ERROR([bad value $enableval for --enable-jpeg])] )],
739    [enable_jpeg=auto])
740WM_IMGFMT_CHECK_JPEG
741
742
743dnl GIF Support
744dnl ============
745AC_ARG_ENABLE(gif,
746    [AS_HELP_STRING([--disable-gif], [disable GIF support through libgif or libungif])],
747    [AS_CASE(["$enableval"],
748        [yes|no], [],
749        [AC_MSG_ERROR([bad value $enableval for --enable-gif])] )],
750    [enable_gif=auto])
751WM_IMGFMT_CHECK_GIF
752
753
754dnl TIFF Support
755dnl ============
756AC_ARG_ENABLE([tiff],
757    [AS_HELP_STRING([--disable-tiff], [disable use of TIFF images through libtiff])],
758    [AS_CASE(["$enableval"],
759        [yes|no], [],
760        [AC_MSG_ERROR([bad value $enableval for --enable-tiff])] )],
761    [enable_tiff=auto])
762WM_IMGFMT_CHECK_TIFF
763
764
765dnl WEBP Support
766dnl ============
767AC_ARG_ENABLE([webp],
768    [AS_HELP_STRING([--disable-webp], [disable WEBP support through libwebp])],
769    [AS_CASE(["$enableval"],
770        [yes|no], [],
771        [AC_MSG_ERROR([bad value $enableval for --enable-webp])] )],
772    [enable_webp=auto])
773WM_IMGFMT_CHECK_WEBP
774
775
776dnl MagicK Support
777dnl ==============
778AC_ARG_ENABLE([magick],
779    [AS_HELP_STRING([--disable-magick], [disable MAGICK support through libMagickWand])],
780    [AS_CASE(["$enableval"],
781        [yes|no], [],
782        [AC_MSG_ERROR([bad value $enableval for --enable-magick])] )],
783    [enable_magick=auto])
784WM_IMGFMT_CHECK_MAGICK
785
786
787dnl PPM Support
788dnl ===========
789# The PPM format is always enabled because we have built-in support for the format
790# We are not using any external library like libppm
791supported_gfx="$supported_gfx builtin-PPM"
792
793
794# Choice of the default format for icons
795AS_IF([test "x$enable_tiff" != "xno"],
796    [ICONEXT="tiff"],
797    [ICONEXT="xpm"])
798
799
800LIBRARY_SEARCH_PATH="$lib_search_path"
801HEADER_SEARCH_PATH="$inc_search_path"
802
803AC_SUBST(LIBRARY_SEARCH_PATH)
804AC_SUBST(HEADER_SEARCH_PATH)
805
806
807AC_SUBST(GFXLIBS)
808AC_SUBST(ICONEXT)
809AM_CONDITIONAL([ICON_EXT_XPM],  [test "x$ICONEXT" = "xxpm"])
810AM_CONDITIONAL([ICON_EXT_TIFF], [test "x$ICONEXT" = "xtiff"])
811
812
813dnl ==============================================
814dnl         End of Graphic Format Libraries
815dnl ==============================================
816
817
818dnl
819dnl stdlib.h is checked here, because of conflict in jpeglib.h
820AC_CHECK_HEADERS(stdlib.h)
821
822
823dnl Support for PIXMAPDIR option
824dnl ============================
825AC_ARG_WITH([pixmapdir],
826    [AS_HELP_STRING([--with-pixmapdir=PATH], [specify where pixmaps are located [DATADIR/pixmaps]])],
827    [AS_CASE([$withval],
828        [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-pixmapdir, expected a path]) ],
829        [/*],  [], dnl Absolute path, ok
830        [\$*], [], dnl Assumes it starts with a reference to $prefix or a similar variable, ok
831        [AC_MSG_ERROR([bad path '$withval' for pixmapdir, expecting an absolute path])])],
832    [with_pixmapdir=""])
833
834AS_IF([test "x$with_pixmapdir" != "x"],
835    [pixmapdir="$with_pixmapdir"],
836    [pixmapdir='${datadir}/pixmaps'])
837AC_SUBST([pixmapdir])dnl
838
839
840dnl Support for GNUSTEP_LOCAL_ROOT, for WPrefs.app
841dnl ==============================================
842AC_ARG_WITH([gnustepdir],
843    [AS_HELP_STRING([--with-gnustepdir=PATH], [specify the directory for GNUstep applications])],
844    [AS_CASE([$withval],
845        [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-gnustepdir, expected a path]) ],
846        [/*],  [], dnl Absolute path, ok
847        [\$*], [], dnl Assumes it starts with a reference to $prefix or a similar variable, ok
848        [AC_MSG_ERROR([bad path '$withval' for gnustepdir, expecting an absolute path])])],
849    [dnl If no command-line option was given, we use $GNUSTEP_LOCAL_ROOT if it was set
850     with_gnustepdir="$GNUSTEP_LOCAL_ROOT"])
851
852AS_IF([test "x$with_gnustepdir" = "x"],
853    [dnl No path specified, use default
854     wprefs_base_dir=${prefix}
855     wprefs_datadir="${datadir}/WPrefs"
856     wprefs_bindir="${bindir}"],
857    [dnl User specified base path
858     wprefs_base_dir="$with_gnustepdir/Applications"
859     wprefs_datadir="$wprefs_base_dir/WPrefs.app"
860     wprefs_bindir="$wprefs_base_dir/WPrefs.app"])
861AC_SUBST([wprefs_datadir])dnl
862AC_SUBST([wprefs_bindir])dnl
863
864dnl Support for DEFSDATADIR option
865dnl ============================
866AC_ARG_WITH([defsdatadir],
867    [AS_HELP_STRING([--with-defsdatadir=PATH], [specify where global defaults are located [SYSCONFDIR/WindowMaker]])],
868    [AS_CASE([$withval],
869        [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-defsdatadir, expected a path]) ],
870        [/*],  [], dnl Absolute path, ok
871        [\$*], [], dnl Assumes it starts with a reference to $prefix or a similar variable, ok
872        [AC_MSG_ERROR([bad path '$withval' for defsdatadir, expecting an absolute path])])],
873    [with_defsdatadir=""])
874
875AS_IF([test "x$with_defsdatadir" != "x"],
876    [defsdatadir="$with_defsdatadir"],
877    [defsdatadir='${sysconfdir}/WindowMaker'])
878AC_SUBST([defsdatadir])dnl
879
880dnl Enable User Defined Menu thing
881dnl ==============================
882AC_ARG_ENABLE([usermenu],
883    [AS_HELP_STRING([--enable-usermenu], [user defined menus for applications])],
884    [AS_CASE([$enableval],
885        [yes|no], [],
886        [AC_MSG_ERROR([bad value '$enableval' for --enable-usermenu])])],
887    [enable_usermenu=no])
888AS_IF([test "x$enable_usermenu" = "xyes"],
889    [AC_DEFINE([USER_MENU], [1],
890        [define if you want user defined menus for applications])])
891
892
893dnl Support for removing non-public symbols from a library
894dnl ======================================================
895gl_LD_VERSION_SCRIPT
896
897
898dnl Add the post-poned compilation options
899dnl ======================================
900WM_CFLAGS_GCC_OPTION_POSTPONED
901
902
903AC_SUBST(lib_search_path)
904AC_SUBST(inc_search_path)
905
906
907dnl Spit out the configuration
908dnl ==========================
909AC_CONFIG_FILES(
910    Makefile
911
912    dnl WRaster Library
913    wrlib/Makefile
914    wrlib/tests/Makefile
915
916    dnl WINGs toolkit
917    WINGs/Makefile WINGs/WINGs/Makefile WINGs/po/Makefile
918    WINGs/Documentation/Makefile WINGs/Resources/Makefile WINGs/Extras/Makefile
919    WINGs/Examples/Makefile WINGs/Tests/Makefile
920
921    dnl Window Maker's core
922    src/Makefile src/wconfig.h po/Makefile
923    doc/Makefile doc/build/Makefile
924    doc/sk/Makefile doc/cs/Makefile doc/ru/Makefile
925    WindowMaker/Makefile WindowMaker/Backgrounds/Makefile
926    WindowMaker/Defaults/Makefile WindowMaker/IconSets/Makefile
927    WindowMaker/Icons/Makefile WindowMaker/Pixmaps/Makefile
928    WindowMaker/Styles/Makefile WindowMaker/Themes/Makefile
929
930    dnl Preference GUI
931    WPrefs.app/Makefile WPrefs.app/po/Makefile
932    WPrefs.app/tiff/Makefile WPrefs.app/xpm/Makefile
933
934    dnl Command-line utilities
935    util/Makefile util/po/Makefile
936
937    dnl Misceleanous stuff
938    wmlib/Makefile
939    test/Makefile
940)
941
942AC_OUTPUT
943
944
945dnl Provide a summary of the config
946dnl ===============================
947echo
948echo "Window Maker was configured as follows:"
949echo
950echo "Installation path prefix            : $prefix"
951echo "Installation path for binaries      : $_bindir"
952echo "Installation path for libraries     : $_libdir"
953echo "Installation path for WPrefs.app    : $wprefs_base_dir" | sed -e 's|\${prefix}|'"$prefix|"
954echo "Supported core features:            :$supported_core"
955echo "Supported X extensions:             :$supported_xext"
956echo "Supported graphic format libraries  :$supported_gfx"
957echo "Unsupported features                :$unsupported"
958echo "Antialiased text support in WINGs   : $xft"
959echo "Pango text layout support in WINGs  : $pango"
960echo "Translated languages to support     :$supported_locales"
961AS_IF([test "x$debug" = "xyes"],
962    [AS_ECHO(["Debug enabled: CFLAGS = $CFLAGS"]) ])
963echo
964
965AS_IF([test "x$wm_cv_prog_cc_nestedfunc" != "xyes"],
966    [AC_MSG_WARN([[Your compiler does not support Nested Function, work-around enabled]])])
967
968AS_IF([test "x$supported_locales" = "x"],
969    [AC_MSG_WARN([[No language from \$LINGUAS are supported]])])
970
971AS_IF([test "x$enable_jpeg" = xno], [dnl
972    AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])
973    AS_ECHO([])
974    AS_ECHO(["JPEG support will not be included because the JPEG library is"])
975    AS_ECHO(["not installed correctly or was not found. Background images"])
976    AS_ECHO(["from themes will not display as they usually are JPEG files."])
977    AS_ECHO([])
978    AS_ECHO(["To fix, download and install the jpeg library and/or make sure you"])
979    AS_ECHO(["installed all jpeg related packages, SPECIALLY the development packages"])
980    AS_ECHO(["like jpeg-dev (if you use some prepackaged version of libjpeg)."])
981    AS_ECHO([])
982    AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])dnl
983])
984
985
986dnl This is for Emacs.  I'm lazy, I know... (nicolai)
987dnl ================================================
988dnl Local Variables:
989dnl compile-command: "autoconf"
990dnl End:
991