WPrefs: fix possible buffer overrun (Coverity #50216)
[wmaker-crm.git] / configure.ac
blob7097e9d98a6b61fb8b2b6c9a9a79c789b142ff24
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
11 dnl
14 AC_INIT(WindowMaker, 0.95.6, , WindowMaker, http://www.windowmaker.org/)
15 AC_CONFIG_SRCDIR(src/WindowMaker.h)
16 AC_CONFIG_MACRO_DIR([m4])
17 AC_CONFIG_HEADERS(config.h)
18 AM_INIT_AUTOMAKE([1.11 silent-rules])
20 AH_BOTTOM([#include "config-paths.h"])
22 dnl libtool library versioning
23 dnl =======================
24 dnl
25 dnl current
26 dnl revision
27 dnl age
28 dnl
29 dnl 1. Start with version information of ‘0:0:0’ for each libtool library.
30 dnl 2. Update the version information only immediately before a public
31 dnl release of your software. More frequent updates are unnecessary, and
32 dnl only guarantee that the current interface number gets larger faster.
33 dnl 3. If the library source code has changed at all since the last
34 dnl update, then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
35 dnl 4. If any interfaces have been added, removed, or changed since the
36 dnl last update, increment current, and set revision to 0.
37 dnl 5. If any interfaces have been added since the last public release,
38 dnl then increment age.
39 dnl 6. If any interfaces have been removed or changed since the last
40 dnl public release, then set age to 0.
41 dnl
42 dnl libwraster
43 WRASTER_CURRENT=5
44 WRASTER_REVISION=0
45 WRASTER_AGE=0
46 WRASTER_VERSION=$WRASTER_CURRENT:$WRASTER_REVISION:$WRASTER_AGE
47 AC_SUBST(WRASTER_VERSION)
48 dnl
49 dnl libWINGs
50 WINGS_CURRENT=3
51 WINGS_REVISION=0
52 WINGS_AGE=0
53 WINGS_VERSION=$WINGS_CURRENT:$WINGS_REVISION:$WINGS_AGE
54 AC_SUBST(WINGS_VERSION)
55 dnl
56 dnl libWUtil
57 WUTIL_CURRENT=5
58 WUTIL_REVISION=0
59 WUTIL_AGE=0
60 WUTIL_VERSION=$WUTIL_CURRENT:$WUTIL_REVISION:$WUTIL_AGE
61 AC_SUBST(WUTIL_VERSION)
64 dnl Checks for host/os name
65 dnl =======================
66 dnl AC_CANONICAL_HOST -- already done by AC_PROG_LIBTOOL
68 dnl Checks for programs.
69 dnl ===================
70 AC_PROG_CC
71 WM_PROG_CC_C11
72 AC_PROG_LN_S
73 AC_PROG_GCC_TRADITIONAL
74 AC_PROG_LIBTOOL
77 dnl Debugging Options
78 dnl =================
79 AC_ARG_ENABLE(debug,
80     [AS_HELP_STRING([--enable-debug], [enable debugging options, @<:@default=no@:>@])],
81     [AS_CASE(["$enableval"],
82         [yes], [debug=yes],
83         [no],  [debug=no],
84         [AC_MSG_ERROR([bad value $enableval for --enable-debug])] )],
85     [debug=no])
86 AS_IF([test "x$debug" = "xyes"],
87     [dnl This flag should have already been detected and added, but if user
88      dnl provided an explicit CFLAGS it may not be the case
89      AS_IF([echo " $CFLAGS " | grep " -g " 2>&1 > /dev/null],
90            [@%:@ Debug symbol already activated],
91            [AX_CFLAGS_GCC_OPTION([-g])])
92      dnl
93      dnl This flag generally makes debugging nightmarish, remove it if present
94      CFLAGS="`echo "$CFLAGS" | sed -e 's/-fomit-frame-pointer *//' `"
95      dnl
96      dnl Enable internal debug code
97      CPPFLAGS="$CPPFLAGS -DDEBUG"
98 ],  [dnl
99      dnl When debug is not enabled, the user probably does not wants to keep
100      dnl assertions in the final program
101      CPPFLAGS="$CPPFLAGS -DNDEBUG"
105 AX_CFLAGS_GCC_OPTION(-Wall)
106 AX_CFLAGS_GCC_OPTION(-Wextra -Wno-sign-compare)
107 AS_IF([test "x$debug" = "xyes"],
108     [dnl When debug is enabled, we try to activate more checks from
109      dnl the compiler. They are on independant check because the
110      dnl macro checks all the options at once, but we may have cases
111      dnl where some options are not supported and we don't want to
112      dnl loose all of them.
113      dnl
114      dnl Floating-point comparison is not a good idea
115      AX_CFLAGS_GCC_OPTION([-Wfloat-equal])
116      dnl
117      dnl Try to report misuses of '&' versus '&&' and similar
118      AX_CFLAGS_GCC_OPTION([-Wlogical-op])
119      dnl
120      dnl Reports declaration of global things that are done inside
121      dnl a local environment, instead of using the appropriate
122      dnl header
123      AX_CFLAGS_GCC_OPTION([-Wnested-externs])
124      dnl
125      dnl Use of 'sizeof()' on inappropriate pointer types
126      AX_CFLAGS_GCC_OPTION([-Wpointer-arith])
127      dnl
128      dnl Having more than 1 prototype for a function makes code updates
129      dnl more difficult, so try to avoid it
130      AX_CFLAGS_GCC_OPTION([-Wredundant-decls])
131      dnl
132      dnl Proper attributes helps the compiler to produce better code
133      WM_CFLAGS_CHECK_FIRST([format attribute suggest],
134          [-Wsuggest-attribute=format  dnl new gcc syntax
135           -Wmissing-format-attribute  dnl old gcc syntax, clang
136          ])
137      WM_CFLAGS_CHECK_FIRST([no-return attribute suggest],
138          [-Wsuggest-attribute=noreturn  dnl gcc syntax
139           -Wmissing-noreturn            dnl clang syntax
140          ])
141      dnl
142      dnl The use of trampolines cause code that can crash on some
143      dnl secured OS, and in a more general way generate binary code
144      dnl that may not be optimal
145      AX_CFLAGS_GCC_OPTION([-Wtrampolines])
146      dnl
147      dnl GCC provides a couple of checks to detect incorrect macro uses
148      AX_CFLAGS_GCC_OPTION([-Wundef])
149      AX_CFLAGS_GCC_OPTION([-Wunused-macros])
150 ], [dnl
151      dnl When debug not enabled, we try to avoid some non-necessary
152      dnl messages from the compiler
153      dnl
154      dnl To support legacy X servers, we have sometime to use
155      dnl functions marked as deprecated. We do not wish our users
156      dnl to be worried about it
157      AX_CFLAGS_GCC_OPTION([-Wno-deprecated])
158      AX_CFLAGS_GCC_OPTION([-Wno-deprecated-declarations])
161 dnl Posix thread
162 dnl =================
163 AX_PTHREAD
166 dnl Tracking on what is detected for final status
167 dnl =============================================
168 unsupported=""
169 supported_xext=""
170 supported_gfx=""
173 dnl Platform-specific Makefile setup
174 dnl ================================
175 AS_CASE(["$host"],
176     [*-*-linux*|*-*-cygwin*|*-gnu*], [WM_OSDEP="linux" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"],
177     [*-*-freebsd*|*-k*bsd-gnu*],     [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -DFREEBSD"],
178     [*-*-netbsd*],                   [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DNETBSD"],
179     [*-*-openbsd*],                  [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DOPENBSD"],
180     [*-*-dragonfly*],                [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DDRAGONFLYBSD"],
181     [*-apple-darwin*],               [WM_OSDEP="darwin"],
182     [*-*-solaris*],                  [WM_OSDEP="stub"],  dnl  solaris.c when done
183     [WM_OSDEP="stub"])
184 AM_CONDITIONAL([WM_OSDEP_LINUX],   [test "x$WM_OSDEP" = "xlinux"])
185 AM_CONDITIONAL([WM_OSDEP_BSD],     [test "x$WM_OSDEP" = "xbsd"])
186 AM_CONDITIONAL([WM_OSDEP_DARWIN],  [test "x$WM_OSDEP" = "xdarwin"])
187 AM_CONDITIONAL([WM_OSDEP_GENERIC], [test "x$WM_OSDEP" = "xstub"])
190 dnl the prefix
191 dnl ==========
193 dnl move this earlier in the script... anyone know why this is handled
194 dnl in such a bizarre way?
196 test "x$prefix" = xNONE && prefix=$ac_default_prefix
197 dnl Let make expand exec_prefix.
198 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
201 _bindir=`eval echo $bindir`
202 _bindir=`eval echo $_bindir`
204 lib_search_path='-L${libdir}'
206 inc_search_path='-I${includedir}'
208 dnl ===============================================
209 dnl Specify paths to look for libraries and headers
210 dnl ===============================================
211 AC_ARG_WITH(libs-from, AS_HELP_STRING([--with-libs-from], [pass compiler flags to look for libraries]),
212         [lib_search_path="$withval $lib_search_path"])
214 AC_ARG_WITH(incs-from, AS_HELP_STRING([--with-incs-from], [pass compiler flags to look for header files]),
215         [inc_search_path="$withval $inc_search_path"])
218 dnl Boehm GC
219 dnl ========
220 AC_ARG_ENABLE([boehm-gc],
221     [AS_HELP_STRING([--enable-boehm-gc], [use Boehm GC instead of the default libc malloc() [default=no]])],
222     [AS_CASE(["$enableval"],
223         [yes], [with_boehm_gc=yes],
224         [no],  [with_boehm_gc=no],
225         [AC_MSG_ERROR([bad value $enableval for --enable-boehm-gc])] )],
226     [with_boehm_gc=no])
227 AS_IF([test "x$with_boehm_gc" = "xyes"],
228     AC_SEARCH_LIBS([GC_malloc], [gc],
229         [AC_DEFINE(USE_BOEHM_GC, 1, [Define if Boehm GC is to be used])],
230         [AC_MSG_FAILURE([--enable-boehm-gc specified but test for libgc failed])]))
233 dnl LCOV
234 dnl ====
235 AC_ARG_ENABLE([lcov],
236     [AS_HELP_STRING([--enable-lcov[=output-directory]], [enable coverage data generation using LCOV (GCC only) [default=no]])],
237     [],
238     [enable_lcov=no])
240 AS_IF([test "x$enable_lcov" != "xno"],
241     [AX_CFLAGS_GCC_OPTION(-fprofile-arcs -ftest-coverage)
242     AS_IF([test "x$enable_lcov" = "xyes"],
243         [lcov_output_directory="coverage-report"],
244         [lcov_output_directory="${enable_lcov}/coverage-report"])
245     AC_SUBST(lcov_output_directory)])
247 AM_CONDITIONAL([USE_LCOV], [test "x$enable_lcov" != "xno"])
250 dnl ============================
251 dnl Checks for library functions
252 dnl ============================
253 dnl not used anywhere
254 AC_FUNC_MEMCMP
255 AC_FUNC_VPRINTF
256 WM_FUNC_SECURE_GETENV
257 AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
258                setsid mallinfo mkstemp sysconf)
259 AC_SEARCH_LIBS([strerror], [cposix])
261 dnl nanosleep is generally available in standard libc, although not always the
262 dnl case. One known example is Solaris which needs -lrt
263 AC_SEARCH_LIBS([nanosleep], [rt], [],
264     [AC_MSG_ERROR([function 'nanosleep' not found, please report to wmaker-dev@lists.windowmaker.org])])
267 dnl Check for strlcat/strlcpy
268 dnl =========================
269 AC_ARG_WITH([libbsd],
270   [AS_HELP_STRING([--without-libbsd], [do not use libbsd for strlcat and strlcpy [default=check]])],
271   [AS_IF([test "x$with_libbsd" != "xno"],
272     [with_libbsd=bsd]
273     [with_libbsd=]
274   )],
275   [with_libbsd=bsd])
277 tmp_libs=$LIBS
278 AC_SEARCH_LIBS([strlcat],[$with_libbsd],
279   [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available])],
280   [],
281   []
283 AC_SEARCH_LIBS([strlcpy],[$with_libbsd],
284   [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcpy is available])],
285   [],
286   []
288 LIBS=$tmp_libs
290 LIBBSD=
291 AS_IF([test "x$ac_cv_search_strlcat" = "x-lbsd" -o "x$ac_cv_search_strlcpy" = "x-lbsd"],
292   [LIBBSD=-lbsd
293    AC_CHECK_HEADERS([bsd/string.h])]
295 AC_SUBST(LIBBSD)
297 dnl Check for OpenBSD kernel memory interface - kvm(3)
298 dnl ==================================================
299 AS_IF([test "x$WM_OSDEP" = "xbsd"],
300   AC_SEARCH_LIBS([kvm_openfiles], [kvm]) )
302 dnl Check for inotify
303 dnl =================
304 AC_CHECK_HEADERS(sys/inotify.h, AC_DEFINE(HAVE_INOTIFY, 1, Check for inotify))
307 dnl Check for syslog 
308 dnl =================
309 AC_CHECK_HEADERS([syslog.h], [AC_DEFINE([HAVE_SYSLOG], [1], [Check for syslog])])
312 dnl Checks for header files.
313 dnl =======================
314 AC_HEADER_SYS_WAIT
315 AC_HEADER_TIME
316 AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h libintl.h poll.h malloc.h ctype.h \
317                  string.h strings.h)
320 dnl Checks for typedefs, structures, and compiler characteristics.
321 dnl ==============================================================
322 AC_DECL_SYS_SIGLIST
323 AC_C_CONST
324 AC_C_INLINE
325 WM_C_NORETURN
326 AC_TYPE_SIZE_T
327 AC_TYPE_PID_T
328 AC_TYPE_SIGNAL
331 dnl pkg-config
332 dnl ==========
333 dnl AC_ARG_VAR(PKGCONFIG, [pkg-config command])
334 AC_CHECK_PROG(PKGCONFIG, pkg-config, pkg-config) 
336 dnl gettext
337 dnl =======
339 dnl AM_GNU_GETTEXT
341 INTLIBS=""
343 AC_CHECK_FUNC(gettext, [HAVEGETTEXT="yes"], 
344         AC_CHECK_LIB(intl, gettext, [INTLIBS="-lintl" HAVEGETTEXT="yes"],
345                          INTLIBS="" ))
347 AC_CHECK_PROG(XGETTEXT, xgettext, xgettext)
349 if test "$XGETTEXT" != ""; then 
350     if $XGETTEXT --help 2>&1 | grep illegal >/dev/null ; then
351         echo "xgettext isn't GNU version"
352         XGETTEXT=""
353     fi
356 if test "$LINGUAS" != ""; then
357     if test "$XGETTEXT" != "" -a "$HAVEGETTEXT" != ""; then
358         AC_DEFINE(I18N, 1, [Internationalization (I18N) support (set by configure)])
359         PO=""
360         echo "xgettext and gettext() exist; will build i18n support for $LINGUAS"
361     else
362         LINGUAS=""
363         PO=""
364         echo "xgettext and libintl.a don't both exist; will not build i18n support"
365     fi
366 else
367         INTLIBS=""
368         MOFILES=""
369         WPMOFILES=""
370         UTILMOFILES=""
371         PO=""
375 dnl The Tower of Babel
376 dnl ==================
378 dnl List of supported locales
379 dnl =========================
380 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"
381 supported_wprefs_locales="bg ca cs de es et fi fr hr hu it ja ko nl pt ru sk zh_CN zh_TW"
382 supported_wings_locales="bg ca cs de fr hu nl sk"
383 supported_util_locales="de es fr nl pt"
385 for lang in $LINGUAS; do
386         ok=0
387         for l in $supported_locales; do
388                 if test "$l" = "$lang"; then
389                         ok=1
390                         break
391                 fi
392         done
393         if test "$ok" = 1; then
394                 MOFILES="$MOFILES $lang.mo"
395         else
396                 echo "Locale $lang is not supported."
397         fi
398         ok=0
399         for l in $supported_wprefs_locales; do
400                 if test "$l" = "$lang"; then
401                         ok=1
402                         break
403                 fi
404         done
405         if test "$ok" = 1; then
406                 WPMOFILES="$WPMOFILES $lang.mo"
407         fi
408         ok=0
409         for l in $supported_util_locales; do
410                 if test "$l" = "$lang"; then
411                         ok=1
412                         break
413                 fi
414         done
415         if test "$ok" = 1; then
416                 UTILMOFILES="$UTILMOFILES $lang.mo"
417         fi
418         ok=0
419         for l in $supported_wings_locales; do
420                 if test "$l" = "$lang"; then
421                         ok=1
422                         break
423                 fi
424         done
425         if test "$ok" = 1; then
426                 WINGSMOFILES="$WINGSMOFILES $lang.mo"
427         fi
428 done
431 dnl Added by Oliver - Support for NLSDIR option
432 dnl ===========================================
433 AC_ARG_WITH(nlsdir, AS_HELP_STRING([--with-nlsdir=PATH], [specify where the locale stuff should go]))
435 if test "x$NLSDIR" = "x"; then
436         if test "x$with_nlsdir" != "x"; then
437                 NLSDIR=$with_nlsdir
438         else
439                 NLSDIR='$(prefix)/lib/locale'
440         fi
443 menutextdomain=
444 AC_ARG_WITH(menu-textdomain, AS_HELP_STRING([--with-menu-textdomain=DOMAIN], [specify gettext domain used for menu translations]),
445         [if test "x$withval" != "xno"; then
446          menutextdomain=$withval
447          fi])
448 AC_SUBST(menutextdomain)
450 AC_SUBST(INTLIBS)
451 AC_SUBST(NLSDIR)
452 AC_SUBST(MOFILES)
453 AC_SUBST(WPMOFILES)
454 AC_SUBST(UTILMOFILES)
455 AC_SUBST(WINGSMOFILES)
456 AC_SUBST(supported_locales)
458 dnl ===========================================
459 dnl             Stuff that uses X
460 dnl ===========================================
462 AC_PATH_XTRA
464 if test $no_x; then
465     AC_MSG_ERROR([The path for the X11 files not found!
466 Make sure you have X and it's headers and libraries (the -devel packages
467 in Linux) installed.])
470 X_LIBRARY_PATH=$x_libraries
471 XCFLAGS="$X_CFLAGS"
472 XLFLAGS="$X_LIBS"
473 XLIBS="-lX11 $X_EXTRA_LIBS"
475 lib_search_path="$lib_search_path $XLFLAGS"
476 inc_search_path="$inc_search_path $XCFLAGS"
478 AC_SUBST(X_LIBRARY_PATH)
480 dnl Decide which locale function to use, setlocale() or _Xsetlocale()
481 dnl by MANOME Tomonori 
482 dnl ===========================================
483 use_locale=yes
484 AC_ARG_ENABLE(locale, AS_HELP_STRING([--disable-locale], [disable use of X locale support]),
485               use_locale=no)
487 if test "$use_locale" = yes; then
488         AC_CHECK_LIB(X11, _Xsetlocale,
489                 AC_DEFINE(X_LOCALE, 1, [define if you want support for X window's X_LOCALE (set by configure)]),,
490                 $XLFLAGS $XLIBS)
493 dnl Check whether XInternAtoms() exist
494 dnl ==================================
495 AC_CHECK_LIB(X11, XInternAtoms, 
496              AC_DEFINE(HAVE_XINTERNATOMS, 1, [define if your X server has XInternAtoms() (set by configure)]),,
497              $XLFLAGS $XLIBS)
499 dnl Check whether XConvertCase() exist
500 dnl ==================================
501 AC_CHECK_LIB(X11, XConvertCase, 
502              AC_DEFINE(HAVE_XCONVERTCASE, 1, [define if your X server has XConvertCase() (set by configure)]),,
503              $XLFLAGS $XLIBS)
505 dnl XKB keyboard language status
506 dnl ============================
507 AC_ARG_ENABLE(modelock, AS_HELP_STRING([--enable-modelock], [XKB keyboard language status support]),
508                 AC_DEFINE(XKB_MODELOCK, 1, [whether XKB language MODELOCK should be enabled]))
510 dnl XDND Drag-nd-Drop support
511 dnl ============================
512 AC_ARG_ENABLE([xdnd],
513     [AS_HELP_STRING([--disable-xdnd], [disable Drag-nd-Drop support])],
514     [AS_CASE(["$enableval"],
515         [yes|no], [],
516         [AC_MSG_ERROR([bad value $enableval for --disable-xdnd]) ]) ],
517     [enable_xdnd=yes
518   supported_xext="$supported_xext XDnD"
519   AC_DEFINE(XDND, 1, [whether Drag-nd-Drop support should be enabled])
522 dnl XShape support
523 dnl ==============
524 AC_ARG_ENABLE([shape],
525     [AS_HELP_STRING([--disable-shape], [disable shaped window extension support])],
526     [AS_CASE(["$enableval"],
527         [yes|no], [],
528         [AC_MSG_ERROR([bad value $enableval for --enable-shape]) ]) ],
529     [enable_shape=auto])
530 WM_XEXT_CHECK_XSHAPE
532 dnl MIT-SHM support
533 dnl ===============
534 AC_ARG_ENABLE([shm],
535     [AS_HELP_STRING([--disable-shm], [disable usage of MIT-SHM extension])],
536     [AS_CASE(["$enableval"],
537         [yes|no], [],
538         [AC_MSG_ERROR([bad value $enableval for --enable-shm]) ]) ],
539     [enable_shm=auto])
540 WM_XEXT_CHECK_XSHM
542 dnl X Misceleanous Utility
543 dnl ======================
544 # the libXmu is used in WRaster
545 WM_EXT_CHECK_XMU
547 dnl XINERAMA support
548 dnl ================
549 AC_ARG_ENABLE([xinerama],
550     [AS_HELP_STRING([--enable-xinerama], [enable Xinerama extension support])],
551     [AS_CASE(["$enableval"],
552         [yes|no], [],
553         [AC_MSG_ERROR([bad value $enableval for --enable-xinerama]) ]) ],
554     [enable_xinerama=auto])
555 WM_XEXT_CHECK_XINERAMA
557 dnl RandR support
558 dnl ==============
559 AC_ARG_ENABLE([randr],
560     [AS_HELP_STRING([--enable-randr], [enable RandR extension support (NOT recommended, buggy)])],
561     [AS_CASE(["$enableval"],
562         [yes|no], [],
563         [AC_MSG_ERROR([bad value $enableval for --enable-randr]) ]) ],
564     [enable_randr=no])
565 WM_XEXT_CHECK_XRANDR
568 dnl libWINGS uses math functions, check whether usage requires linking
569 dnl against libm
571 WM_CHECK_LIBM
574 dnl libWINGS uses FcPatternDel from libfontconfig
576 AC_MSG_CHECKING([for fontconfig library])
577 FCLIBS=`$PKGCONFIG fontconfig --libs`
578 if test "x$FCLIBS" = "x" ; then
579         AC_MSG_RESULT([not found])
580 else
581         AC_MSG_RESULT([found])
583 AC_SUBST(FCLIBS)
586 dnl Xft2 antialiased font support
587 dnl =============================
589 xft=yes
590 XFTLIBS=""
592 if test "x$PKGCONFIG" != x -a "`$PKGCONFIG xft; echo $?`" = 0; then
593         XFTCONFIG="$PKGCONFIG xft"
594         pkgconfig_xft=yes
595 else
596         AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config)
599 AC_MSG_CHECKING([for the Xft2 library])
601 if test "x$XFTCONFIG" != x; then
602         XFTLIBS=`$XFTCONFIG --libs`
603         XFTFLAGS=`$XFTCONFIG --cflags`
604         AC_MSG_RESULT([found])
605 else
606         AC_MSG_RESULT([not found])
607         echo
608         echo "ERROR!!! libXft2 is not installed or could not be found."
609         echo "         Xft2 is a requirement for building Window Maker."
610         echo "         Please install it (along with fontconfig) before continuing."
611         echo
612         exit 1
615 minXFT="2.1.0"
616 goodxft="no"
619 dnl The macro below will use $XFTFLAGS (defined above) to find Xft.h
621 WM_CHECK_XFT_VERSION($minXFT, goodxft=yes, goodxft=no)
623 if test "$goodxft" = no; then
624         echo
625         echo "ERROR!!! libXft on this system is an old version."
626         echo "         Please consider upgrading to at least version ${minXFT}."
627         echo
628         exit 1
631 AC_SUBST(XFTFLAGS)
632 AC_SUBST(XFTLIBS)
634 dnl PANGO support
635 dnl =============
636 pango=no
637 AC_ARG_ENABLE(pango, AS_HELP_STRING([--enable-pango], [enable Pango text layout support]),
638                 pango=$enableval, pango=no)
640 PANGOFLAGS=
641 PANGOLIBS=
642 if test "$pango" = yes; then
643         PANGOLIBS=`$PKGCONFIG pangoxft --libs`
644         PANGOFLAGS=`$PKGCONFIG pangoxft --cflags`
645         if test "x$PANGOLIBS" = "x" ; then
646                 AC_MSG_RESULT([not found])
647         else
648                 AC_DEFINE(USE_PANGO, 1, [Define if Pango is to be used])
649                 AC_MSG_RESULT([found])
650         fi
652 inc_search_path="$inc_search_path $PANGOFLAGS"
653 AC_SUBST(PANGOLIBS)
655 dnl ==============================================
656 dnl         Graphic Format Libraries
657 dnl ==============================================
659 dnl XPM Support
660 dnl ===========
661 AC_ARG_ENABLE([xpm],
662     [AS_HELP_STRING([--disable-xpm], [disable use of XPM pixmaps through libXpm])],
663     [AS_CASE(["$enableval"],
664         [yes|no], [],
665         [AC_MSG_ERROR([bad value $enableval for --enable-xpm])] )],
666     [enable_xpm=auto])
667 WM_IMGFMT_CHECK_XPM
670 # for wmlib
671 AC_SUBST(XCFLAGS)
672 # for test
673 AC_SUBST(XLFLAGS)
674 AC_SUBST(XLIBS)
675 AC_SUBST(X_EXTRA_LIBS)
677 dnl ===============================================
678 dnl             End of stuff that uses X
679 dnl ===============================================
681 dnl EXIF Support
682 dnl ===========
683 WM_CHECK_LIBEXIF
684 AS_IF([test "x$LIBEXIF" != "x"],
685         [AC_DEFINE(HAVE_EXIF, 1, [Define if EXIF can be used])])
687 dnl PNG Support
688 dnl ===========
689 AC_ARG_ENABLE([png],
690     [AS_HELP_STRING([--disable-png], [disable PNG support through libpng])],
691     [AS_CASE(["$enableval"],
692         [yes|no], [],
693         [AC_MSG_ERROR([bad value $enableval for --enable-png])] )],
694     [enable_png=auto])
695 WM_IMGFMT_CHECK_PNG
698 dnl JPEG Support
699 dnl ============
700 AC_ARG_ENABLE([jpeg],
701     [AS_HELP_STRING([--disable-jpeg], [disable JPEG support through libjpeg])],
702     [AS_CASE(["$enableval"],
703         [yes|no], [],
704         [AC_MSG_ERROR([bad value $enableval for --enable-jpeg])] )],
705     [enable_jpeg=auto])
706 WM_IMGFMT_CHECK_JPEG
709 dnl GIF Support
710 dnl ============
711 AC_ARG_ENABLE(gif,
712     [AS_HELP_STRING([--disable-gif], [disable GIF support through libgif or libungif])],
713     [AS_CASE(["$enableval"],
714         [yes|no], [],
715         [AC_MSG_ERROR([bad value $enableval for --enable-gif])] )],
716     [enable_gif=auto])
717 WM_IMGFMT_CHECK_GIF
720 dnl TIFF Support
721 dnl ============
722 AC_ARG_ENABLE([tiff],
723     [AS_HELP_STRING([--disable-tiff], [disable use of TIFF images through libtiff])],
724     [AS_CASE(["$enableval"],
725         [yes|no], [],
726         [AC_MSG_ERROR([bad value $enableval for --enable-tiff])] )],
727     [enable_tiff=auto])
728 WM_IMGFMT_CHECK_TIFF
731 dnl WEBP Support
732 dnl ===========
733 AC_ARG_ENABLE([webp],
734     [AS_HELP_STRING([--disable-webp], [disable WEBP support through libwebp])],
735     [AS_CASE(["$enableval"],
736         [yes|no], [],
737         [AC_MSG_ERROR([bad value $enableval for --enable-webp])] )],
738     [enable_webp=auto])
739 WM_IMGFMT_CHECK_WEBP
742 dnl MAGICK Support
743 dnl ===========
744 AC_ARG_ENABLE([magick],
745     [AS_HELP_STRING([--disable-magick], [disable MAGICK support through libMagickWand])],
746     [AS_CASE(["$enableval"],
747         [yes|no], [],
748         [AC_MSG_ERROR([bad value $enableval for --enable-magick])] )],
749     [enable_magick=auto])
750 WM_IMGFMT_CHECK_MAGICK
753 dnl PPM Support
754 dnl ===========
755 # The PPM format is always enabled because we have built-in support for the format
756 # We are not using any external library like libppm
757 supported_gfx="$supported_gfx builtin-PPM"
760 # Choice of the default format for icons
761 AS_IF([test "x$enable_tiff" != "xno"],
762     [ICONEXT="tiff"],
763     [ICONEXT="xpm"])
766 LIBRARY_SEARCH_PATH="$lib_search_path"
767 HEADER_SEARCH_PATH="$inc_search_path"
769 AC_SUBST(LIBRARY_SEARCH_PATH)
770 AC_SUBST(HEADER_SEARCH_PATH)
773 AC_SUBST(GFXLIBS)
774 AC_SUBST(ICONEXT)
775 AM_CONDITIONAL([ICON_EXT_XPM],  [test "x$ICONEXT" = "xxpm"])
776 AM_CONDITIONAL([ICON_EXT_TIFF], [test "x$ICONEXT" = "xtiff"])
779 dnl ==============================================
780 dnl         End of Graphic Format Libraries
781 dnl ==============================================
785 dnl stdlib.h is checked here, because of conflict in jpeglib.h
786 AC_CHECK_HEADERS(stdlib.h)
788 # AC_PREFIX_PROGRAM(wmaker)
790 dnl Support for PIXMAPDIR option
791 dnl ============================
792 AC_ARG_WITH(pixmapdir, AS_HELP_STRING([--with-pixmapdir=PATH], [specify where pixmaps are located [DATADIR/pixmaps]]))
794 if test "x$with_pixmapdir" != "x"; then
795         pixmapdir=$with_pixmapdir
796 else
797         pixmapdir='${datadir}/pixmaps'
799 AC_SUBST(pixmapdir)
802 dnl Support for GNUSTEP_LOCAL_ROOT, for WPrefs.app
803 dnl ==============================================
805 AC_ARG_WITH(gnustepdir, AS_HELP_STRING([--with-gnustepdir=PATH], [specify the directory for GNUstep applications]))
807 if test "x`echo $with_gnustepdir | grep ^/`" != "x"; then
808     appspath=$with_gnustepdir
811 if test "x$appspath$GNUSTEP_LOCAL_ROOT" = "x"; then
812     wprefs_base_dir=${prefix}
813     wprefs_datadir="${datadir}/WPrefs"
814     wprefs_bindir="${bindir}"
815 else
816     gnustepdir=$appspath
818     if test "x$GNUSTEP_LOCAL_ROOT" != "x" ; then
819         gnustepdir=`echo "$GNUSTEP_LOCAL_ROOT" | sed -e "s|^${prefix}|prefix|"`
820         gnustepdir=`echo $gnustepdir | sed -e 's|^prefix|${prefix}|'`
821     fi
823     wprefs_base_dir=$gnustepdir/Applications
824     wprefs_datadir=$wprefs_base_dir/WPrefs.app
825     wprefs_bindir=$wprefs_base_dir/WPrefs.app
828 AC_SUBST(wprefs_datadir)
829 AC_SUBST(wprefs_bindir)
832 dnl Enable User Defined Menu thing
833 dnl ==============================
834 AC_ARG_ENABLE(usermenu, AS_HELP_STRING([--enable-usermenu], [user defined menus for applications]),
835 if test "$enableval" = yes; then
836         AC_DEFINE(USER_MENU, 1, [define if you want user defined menus for applications])
840 gl_LD_VERSION_SCRIPT
842 AC_OUTPUT(Makefile po/Makefile util/Makefile util/po/Makefile test/Makefile \
843         WINGs/Makefile WINGs/WINGs/Makefile WINGs/Documentation/Makefile \
844         WINGs/Examples/Makefile WINGs/Resources/Makefile WINGs/Tests/Makefile \
845         WINGs/Extras/Makefile WINGs/po/Makefile \
846         wmlib/Makefile wrlib/Makefile wrlib/tests/Makefile \
847         src/Makefile src/wconfig.h \
848         doc/Makefile doc/sk/Makefile doc/cs/Makefile \
849         doc/ru/Makefile \
850         WindowMaker/Makefile WindowMaker/Backgrounds/Makefile \
851         WindowMaker/Defaults/Makefile WindowMaker/IconSets/Makefile \
852         WindowMaker/Icons/Makefile WindowMaker/Pixmaps/Makefile \
853         WindowMaker/Styles/Makefile WindowMaker/Themes/Makefile \
854         WPrefs.app/Makefile WPrefs.app/tiff/Makefile WPrefs.app/xpm/Makefile \
855         WPrefs.app/po/Makefile )
858 dnl Output some helpful data for compiling wraster and WINGs/WUtil apps
859 dnl ===================================================================
861 dnl echo "WFLAGS=\"$LIBPL_INC_PATH -I$prefix/include\"" > WINGs-flags
862 dnl echo "WLIBS=\"-L$exec_prefix/lib -lWINGs -lwraster $LIBPL_LIBS $GFXLIBS -lm\""\
863 dnl     | sed -e 's|\$(prefix)|'"$prefix|" >> WINGs-flags
865 dnl The #lp# and #rp# stuff below is a hack because [ and ] get lost when
866 dnl parsed by m4
868 AC_SUBST(lib_search_path)
869 AC_SUBST(inc_search_path)
872 dnl Spit out the configuration
873 dnl ==========================
875 if test "x$MOFILES" = "x"; then
876         mof=None
877 else
878         mof=`echo $MOFILES`
881 if test "x$MOFILES" = "x"; then
882         languages=None
883 else
884         languages=`echo $MOFILES | sed 's/.mo//g'`
887 echo
888 echo "Window Maker was configured as follows:"
889 echo
890 echo "Installation path prefix            : $prefix"
891 echo "Installation path for binaries      : $_bindir"
892 echo "Installation path for libraries     : $libdir"
893 echo "Installation path for WPrefs.app    : $wprefs_base_dir" | sed -e 's|\${prefix}|'"$prefix|"
894 echo "Supported X extensions:             :$supported_xext"
895 echo "Supported graphic format libraries  :$supported_gfx"
896 echo "Unsupported features                :$unsupported"
897 echo "Antialiased text support in WINGs   : $xft"
898 echo "Pango text layout support in WINGs  : $pango"
899 echo "Translated message files to install : $mof"
900 dnl echo "Supported languages beside English  : $languages"
901 if test "x$MOFILES" != "x"; then
902         echo "Installation path for translations  : $NLSDIR" | sed -e 's|\$(prefix)|'"$prefix|"
904 AS_IF([test "x$debug" = "xyes"],
905     [AS_ECHO(["Debug enabled: CFLAGS = $CFLAGS"]) ])
906 echo
908 dnl WM_PRINT_REDCRAP_BUG_STATUS
910 AS_IF([test "x$enable_jpeg" = xno], [dnl
911     AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])
912     AS_ECHO([])
913     AS_ECHO(["JPEG support will not be included because the JPEG library is"])
914     AS_ECHO(["not installed correctly or was not found. Background images"])
915     AS_ECHO(["from themes will not display as they usually are JPEG files."])
916     AS_ECHO([])
917     AS_ECHO(["To fix, download and install the jpeg library and/or make sure you"])
918     AS_ECHO(["installed all jpeg related packages, SPECIALLY the development packages"])
919     AS_ECHO(["like jpeg-dev (if you use some prepackaged version of libjpeg)."])
920     AS_ECHO([])
921     AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])dnl
925 dnl This is for Emacs.  I'm lazy, I know... (nicolai)
926 dnl ================================================
927 dnl Local Variables:
928 dnl compile-command: "autoconf"
929 dnl End: