* fix buffer overrun with >78 character window name in bindings.
[fvwm.git] / configure.ac
blob2747d20de89adafe12e05eb70d48ccfdba0711b0
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 AC_PREREQ(2.53)
4 AC_INIT(fvwm/fvwm.c)
6 dnl should be "yes" only within the released distribution
7 ISRELEASED=no
8 version=2.5.22
9 VERSIONINFO=""
11 dnl date of the released version (please zero pad the day in the last 2 dates)
12 dnl for example: "4 February 2003", "04 Feb 2003", "2003-02-04"
13 dnl date format strings: "%e %B %Y", "%d-%b-%Y", "%Y-%m-%d"
14 RELDATELONG="20 January 2006"
15 RELDATESHORT="20-Jan-2007"
16 RELDATENUM="2007-01-20"
18 # constant variable settings
19 FVWMNAMEUCASE="FVWM"
20 FVWMNAMELONG="F? Virtual Window Manager"
21 FVWMHOMEPAGE="http://fvwm.org/"
22 FVWMFTP="ftp.fvwm.org"
23 FVWMFTPDIR="/pub/ftp"
24 FVWMALTFTP="metalab.unc.edu"
25 FVWMALTFTPDIR="/pub/Linux/X11/window-managers/"
26 FVWMLIST="fvwm@fvwm.org"
27 FVWMWORKERSLIST="fvwm-workers@fvwm.org"
28 FVWMWORKERSLISTLONG="fvwm workers list <fvwm-workers@fvwm.org>"
29 MANPAGE_PREAMBLE='.\" WARNING: This file was automatically generated.  Edit the .in file instead.'
31 if test x"$ISRELEASED" != xyes; then
32         VERSIONINFO=" (from cvs)"
33         RELDATELONG="(not released yet)"
34         RELDATESHORT="(not released yet)"
35         RELDATENUM="(not released yet)"
36 #       # migo: unfortunately this nice idea can not work, it is not updated.
37 #       # I will think more about this, maybe autoconf-2.50+ has a solution.
38 #       if test -d CVS/ -a -f CVS/Entries && \
39 #               date +%Y-%m-%d -d 'Wed Sep  4 12:36:50 2002' >/dev/null 2>&1
40 #       then
41 #               # this is not the exact date, but better than the current date
42 #               for file in CVS/Entries */CVS/Entries; do
43 #                       changelog_date="`cat $file | grep /ChangeLog/ \
44 #                               | cut -d/ -f4`"
45 #                       test x"$changelog_date" != x && \
46 #                       date +%Y-%m-%d -d "$changelog_date" >>changelog_dates
47 #               done
48 #               changelog_date=`cat changelog_dates | sort -r -u | head -1`
49 #               VERSIONINFO=" (from cvs $changelog_date)"
50 #               rm -f changelog_dates
51 #       fi
54 AC_SUBST(ISRELEASED)
55 AH_TEMPLATE([VERSIONINFO],[Additional version information, like date])
56 AC_DEFINE_UNQUOTED(VERSIONINFO, "$VERSIONINFO")
57 AC_SUBST(VERSIONINFO)
58 AC_SUBST(RELDATELONG)
59 AC_SUBST(RELDATESHORT)
60 AC_SUBST(RELDATENUM)
61 AC_SUBST(FVWMNAMEUCASE)
62 AC_SUBST(FVWMNAMELONG)
63 AC_SUBST(FVWMHOMEPAGE)
64 AC_SUBST(FVWMFTP)
65 AC_SUBST(FVWMFTPDIR)
66 AC_SUBST(FVWMALTFTP)
67 AC_SUBST(FVWMALTFTPDIR)
68 AC_SUBST(FVWMLIST)
69 AC_SUBST(FVWMWORKERSLIST)
70 AC_SUBST(FVWMWORKERSLISTLONG)
71 AC_SUBST(MANPAGE_PREAMBLE)
73 AM_INIT_AUTOMAKE(fvwm, ${version})
74 AM_CONFIG_HEADER(config.h)
76 # installation paths
77 FVWM_MODULESUBDIR=/${PACKAGE}/${VERSION}
78 FVWM_DATASUBDIR=/${PACKAGE}
80 AC_ARG_ENABLE(package-subdirs,
81   [  --disable-package-subdirs  do not create subdirs for modules and data],
82   [if test x"$enableval" = xno; then FVWM_MODULESUBDIR=""; FVWM_DATASUBDIR="";
83   fi], [])
85 FVWM_MODULEDIR='${libexecdir}'"$FVWM_MODULESUBDIR"
86 FVWM_DATADIR='${datadir}'"$FVWM_DATASUBDIR"
87 FVWM_PERLLIBDIR='${datadir}'"$FVWM_DATASUBDIR/perllib"
88 FVWM_CONFDIR='${sysconfdir}'dnl used _only_ to search for system.fvwm2rc
90 AC_SUBST(FVWM_MODULEDIR)
91 AC_SUBST(FVWM_DATADIR)
92 AC_SUBST(FVWM_PERLLIBDIR)
93 AC_SUBST(FVWM_CONFDIR)
95 AH_TEMPLATE([FVWM_CONFIG],
96   [Name of config filenames in FVWM_USERDIR and FVWM_DATADIR])
97 AC_DEFINE(FVWM_CONFIG, "config")
99 AH_TEMPLATE([FVWM2RC],[Suffix for old (to be deprecated) config filenames])
100 AC_DEFINE(FVWM2RC, ".fvwm2rc")
102 # Various configure-time options
104 AC_ARG_ENABLE(dmalloc,
105   [  --enable-dmalloc        enable support for the dmalloc debugging library],
106   [ac_cv_dmalloc="$enableval"],
107   [ac_cv_dmalloc="no"])
109 AC_ARG_ENABLE(efence,
110   [  --enable-efence         enable support for the efence debugging library],
111   [ac_cv_efence="$enableval"],
112   [ac_cv_efence="no"])
114 smr_SWITCH(command-log, command logging, off, FVWM_COMMAND_LOG,, [Produces a log of all executed commands and their times on stderr.])
115 AH_VERBATIM([_FVWM_COMMAND_LOG],
116 [#ifdef FVWM_COMMAND_LOG
117 #   define FVWM_DEBUG_TIME 1
118 #endif])
120 smr_SWITCH(debug-msgs, debugging messages, off, FVWM_DEBUG_MSGS,, [if you would like to see lots of debug messages from fvwm, for debugging
121    purposes, uncomment the next line])
122 AH_VERBATIM([_FVWM_DEBUG_MSGS],
123 [#ifdef FVWM_DEBUG_MSGS
124 #   define DBUG(x,y) fvwm_msg(DBG,x,y)
125 #else
126 #   define DBUG(x,y) /* no messages */
127 #endif])
129 dnl dummy: smr_SWITCH(sm, dummy for test script, on, SESSION)
131 # Need to know where X is, for finding some libraries (e.g. xpm)
132 no_x=""
133 AC_PATH_XTRA
134 if test x"$no_x" = x"yes"; then
135   echo
136   echo "X11 libraries or header files could not be found.  Please make"
137   echo "sure the X11 development package is installed on your system."
138   echo "If it is definitely installed, try setting the include and library"
139   echo "paths with the --x-include and --x-libraries options of configure."
140   echo "Fvwm can not be compiled without the X11 development environment."
141   echo
142   echo "Aborting."
143   echo
144   exit 1
147 # FIXME: default value should be derived from computed path to X
148 # includes.  Actually, this should probably not appear in configure
149 # at all: it is settable at runtime, and only confuses the issue to
150 # have it settable here too.
152 AC_MSG_CHECKING(imagepath)
153 val="/usr/include/X11/bitmaps:/usr/include/X11/pixmaps"
154 AC_ARG_WITH(imagepath,
155 [  --with-imagepath=PATH   colon-delimited search path for images],
156 [ case "$withval" in
157   no)
158     AC_MSG_ERROR([Can not disable image path.])
159     ;;
160   yes)
161     ;;
162   *)
163     val="$withval"
164     ;;
165   esac ])
166 AH_TEMPLATE([FVWM_IMAGEPATH],[Where to search for images.])
167 AC_DEFINE_UNQUOTED(FVWM_IMAGEPATH, "$val")
169 FVWM_IMAGEPATH="$val"
170 AC_SUBST(FVWM_IMAGEPATH)
171 AC_MSG_RESULT($val)
173 # Minimal checks for programs: enough to enable checking for
174 # optional libraries.
175 AC_PROG_CC
176 AC_PROG_CPP
178 # added -Wall for gcc, what about for others?
179 if test "x$GCC" = "xyes"; then
180   CFLAGS="-Wall -Wno-implicit-int $CFLAGS"
183 # Help finding POSIX functions on some systems
184 AC_ISC_POSIX
185 AC_MINIX
187 # catch -Werror and similar options when running configure
188 AC_TRY_COMPILE([#include <stdio.h>],
189 [int i; static j; int *p; char *c;
190   switch (*p = p = *c) { case 0: printf("%Q", c, p); }
191   *c = &i; c = p;
192   while (1 || (unsigned int)3 >= 0 || ((int)-1) == ((unsigned int)1));
193   return;], , AC_MSG_ERROR("
194 configure is not able to compile programs with warnings.  Please
195 remove all offending options like -Werror from the CFLAGS and
196 CPPFLAGS variables and run configure again."))
198 # check size of some types
199 ac_save_CFLAGS="$CFLAGS"
200 CFLAGS="$CFLAGS $X_CFLAGS"
201 AC_CHECK_SIZEOF(int)
202 AC_CHECK_SIZEOF(long)
203 AC_CHECK_SIZEOF(Window, , [#include <stdio.h>
204 #include <X11/X.h>])
205 AC_CHECK_SIZEOF(Pixel, , [#include <stdio.h>
206 #include <X11/Intrinsic.h>])
207 AC_CHECK_SIZEOF(void *)
208 CFLAGS="$ac_save_CFLAGS"
209 size_check_failed=""
210 if test "$ac_cv_sizeof_void_p" -gt "$ac_cv_sizeof_long"; then
211   echo "The type void * is bigger than long."
212   size_check_failed=1
214 if test "$ac_cv_sizeof_Window" -gt "$ac_cv_sizeof_long"; then
215   echo "The type Window is bigger than long."
216   size_check_failed=1
218 if test "$ac_cv_sizeof_Pixel" -gt "$ac_cv_sizeof_long"; then
219   echo "The type Pixel is bigger than long."
220   size_check_failed=1
222 if test x"$size_check_failed" = x1; then
223   echo "This is not supported by the module interface yet (make_new_vpacket)."
224   echo "Detected type sizes are: int($ac_cv_sizeof_int), long($ac_cv_sizeof_long), void*($ac_cv_sizeof_void_p), Window($ac_cv_sizeof_Window), Pixel($ac_cv_sizeof_Pixel)"
225   echo "Please report details of your system and this message to ${FVWMWORKERSLIST}."
226   echo
227   exit 1
230 # 'unset' is not portable, but setting to null is not enough to avoid using
231 # the cached value!  For ancient shells "rm config.cache" is a solution.
232 UNSET=true
233 if unset UNSET 2>/dev/null; then UNSET=unset; fi
236 # ********* multibyte
237 # FreeBSD has libxpg4, check this and use if found.
238 AC_CANONICAL_HOST
239 case $host_os in
240 freebsd*)
241         AC_CHECK_LIB(xpg4, setlocale, [LIBS="$LIBS -lxpg4"]);;
243         ;;
244 esac
246 # *** pkg-config
247 # unfortunately, we need pkg-config for the detection of certain libs:
248 # - certain version of fontconfig (without fontconfig-config
249 AM_CHECK_PKG_CONFIG
251 # ********* session management
252 # Check the availability of SM; we don't have to add any extra libraries,
253 # since -lSM -lICE are in X_PRE_LIBS when they exist.
254 dnl [old check] AC_CHECK_LIB(SM, SmcOpenConnection, AC_DEFINE(SESSION), ,
255 dnl [old check]            [$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
257 problem_sm=""
259 AC_ARG_ENABLE(sm,
260   [  --disable-sm            disable session management support],
261   [ if test x"$enableval" = xyes; then
262     with_sm="yes, check"
263   else
264     with_sm="no"
265     problem_sm=": Explicitly disabled"
266   fi ],
267   [ with_sm="not specified, check" ]
270 if test x"$with_sm" != xno; then
271   dnl Uncomment the following and comment out AC_CHECK_LIB to get --with-sm-*
272   dnl $UNSET ac_cv_lib_SM_SmcOpenConnection
273   dnl $UNSET ac_cv_header_X11_SM_SMlib_h
274   dnl smr_CHECK_LIB(sm, SM, adds session management support, SmcOpenConnection,
275   dnl   X11/SM/SMlib.h,
276   dnl   [$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS], $X_CFLAGS)
277   dnl test "$sm_LIBS" && AC_DEFINE(SESSION)
279   $UNSET ac_cv_lib_SM_SmcOpenConnection
280   AH_TEMPLATE([SESSION],[Enables session management functionality.])
281   AC_CHECK_LIB(SM, SmcOpenConnection, with_sm=yes; AC_DEFINE(SESSION),
282     with_sm=no; problem_sm=": Failed to detect libSM",
283     [$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
285 dnl AC_SUBST(sm_LIBS)
286 dnl AC_SUBST(sm_CFLAGS)
289 # Checking for optional libraries
290 # Default is to use them if found; can be disable using --without
291 # These are put up front so that if they are requested, but
292 # configure fails to find them, we fail early.
295 # ********* shape extension
296 dnl smr_SWITCH(shape, shape extensions, on, SHAPE)
297 AC_ARG_ENABLE(shape,
298   [  --disable-shape         disable shaped window support],
299   [ if test x"$enableval" = xyes; then
300     with_shape="yes, check"
301   else
302     with_shape="no"
303     problem_shape=": Explicitly disabled"
304   fi ],
305   [ with_shape="not specified, check" ]
308 AH_TEMPLATE(SHAPE,
309 [   Define if you want the Shaped window extensions.
310    Shaped window extensions seem to increase the window managers RSS
311    by about 60 Kbytes. They provide for leaving a title-bar on the window
312    without a border.
313    If you don't use shaped window extension, you can either make your
314    shaped windows undecorated, or live with a border and backdrop around
315    all your shaped windows (oclock, xeyes)
317    If you normally use a shaped window (xeyes or oclock), you might as
318    well compile this extension in, since the memory cost is  minimal in
319    this case (The shaped window shared libs will be loaded anyway). If you
320    don't normally use a shaped window, you have to decide for yourself.
322    Note: if it is compiled in, run time detection is used to make sure that
323    the currently running X server supports it.])
324 if test x"$with_shape" != xno; then
325   $UNSET ac_cv_lib_Xext_XShapeQueryExtension
326   AC_CHECK_LIB(Xext, XShapeQueryExtension,
327                with_shape=yes; AC_DEFINE(SHAPE),
328                with_shape=no;
329                problem_shape=": Failed to detect Shape extension",
330                [$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
333 # ********* MIT Shared Memory Extension
334 AC_ARG_ENABLE(shm,
335   [  --disable-shm           disable MIT Shared Memory Extension],
336   [ if test x"$enableval" = xyes; then
337     with_shm="yes, check"
338   else
339     with_shm="no"
340     problem_shm=": Explicitly disabled"
341   fi ],
342   [ with_shm="not specified, check" ]
345 AH_TEMPLATE([HAVE_XSHM],[Define if  MIT Shared Memory extension is used.])
346 if test x"$with_shm" != xno; then
347   $UNSET ac_cv_lib_Xext_XShmQueryExtension
348   AC_CHECK_LIB(Xext, XShmQueryExtension,
349                with_shm=yes; AC_DEFINE(HAVE_XSHM),
350                with_shm=no;
351                problem_shm=": Can't detect MIT Shared Memory ext.",
352                [$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
355 # ********* xinerama
356 problem_xinerama=""
358 AC_ARG_ENABLE(xinerama,
359   [  --disable-xinerama      disable Xinerama multi screen support],
360   [ if test x"$enableval" = xyes; then
361     with_xinerama="yes, check"
362   else
363     with_xinerama="no"
364     problem_xinerama=": Explicitly disabled"
365   fi ],
366   [ with_xinerama="not specified, check" ]
369 AH_TEMPLATE([HAVE_XINERAMA],[Define if Xinerama library is used.])
370 AH_TEMPLATE([HAVE_SOLARIS_XINERAMA],
371   [Define if Solaris' Xinerama calls are being used.
372   (Solaris 7 11/99 and later)])
373 AH_TEMPLATE([HAVE_SOLARIS_XINERAMA_H],
374   [Define if Solaris' X11/extensions/xinerama.h header is provided.
375   (Solaris 9 and later)])
376 if test x"$with_xinerama" != xno; then
377   $UNSET ac_cv_lib_Xinerama_XineramaIsActive
378   _check_solaris_xinerama=no
379   AC_CHECK_LIB(Xinerama, XineramaIsActive,
380     with_xinerama=yes; Xinerama_LIBS=-lXinerama; AC_DEFINE(HAVE_XINERAMA),
381     _check_solaris_xinerama=yes,
382     [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS])
383   if test x"$_check_solaris_xinerama" = xyes; then
384     AC_CHECK_LIB(Xext, XineramaGetState,
385       [ AC_DEFINE(HAVE_XINERAMA) AC_DEFINE(HAVE_SOLARIS_XINERAMA)
386       with_xinerama=yes; Xinerama_LIBS=-lXext
387       my_CPPFLAGS="$CPPFLAGS"; CPPFLAGS="$X_CPPFLAGS $CPPFLAGS"
388       my_hdr="X11/extensions/xinerama.h"
389       AC_CHECK_HEADER($my_hdr, AC_DEFINE(HAVE_SOLARIS_XINERAMA_H)
390         problem_xinerama=" (Using Solaris Xinerama calls)",
391         problem_xinerama=" (Using Solaris 9 prototypes for missing header)")
392       CPPFLAGS="$my_CPPFLAGS"],
393     with_xinerama=no; Xinerama_LIBS=
394     problem_xinerama=": Failed to detect libXinerama",
395     [$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
396   fi
397   $UNSET _check_solaris_xinerama
399 AC_SUBST(Xinerama_LIBS)
400 AC_SUBST(Xinerama_CFLAGS)
402 # ********* xinerama-emulation
403 smr_SWITCH(
404   xinerama-emulation,
405   [Xinerama emulation on one screen (useful only for developers)], off,
406   USE_XINERAMA_EMULATION,,
407   [Define if Xinerama should be emulated on a single screen.])
408 if test x"$enable_xinerama_emulation" = xyes; then
409   with_xinerama_emulation=yes
410 else
411   with_xinerama_emulation=no
414 # ********* xrender
415 problem_xrender=""
416 AC_ARG_ENABLE(xrender,
417   [  --disable-xrender       disable Xrender alpha-blend rendering ],
418   [ if test x"$enableval" = xyes; then
419     with_xrender="yes, check"
420   else
421     with_xrender="no"
422     problem_xrender=": Explicitly disabled"
423   fi ],
424   [ with_xrender="not specified, check" ]
427 AH_TEMPLATE([HAVE_XRENDER],[Define if Xrender library is used.])
428 if test x"$with_xrender" != xno; then
429   $UNSET ac_cv_lib_Xrender_XRenderComposite
430   AC_CHECK_LIB(Xrender, XRenderComposite,
431     with_xrender=yes; Xrender_LIBS=-lXrender;
432     AC_DEFINE(HAVE_XRENDER),
433     with_xrender=no; Xrender_LIBS=
434     problem_xrender=": Failed to detect libXrender",
435     [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS])
437 AC_SUBST(Xrender_LIBS)
438 AC_SUBST(Xrender_CFLAGS)
440 # ********* xft
441 problem_xft=""
443 AC_ARG_ENABLE(xft,
444   [  --disable-xft           disable Xft anti-aliased font rendering],
445   [ if test x"$enableval" = xyes; then
446     with_xft="yes, check"
447   else
448     with_xft="no"
449     problem_xft=": Explicitly disabled"
450   fi ],
451   [
452     with_xft="not specified, check"
453   ]
456 AH_TEMPLATE([HAVE_XFT],[Define if Xft library is used.])
457 AH_TEMPLATE([HAVE_XFT2],[Define if Xft 2 library is used.])
458 AH_TEMPLATE([HAVE_XFT_UTF8],[Define if Xft library can handle utf8 encoding])
459 if test x"$with_xft" != xno; then
461   # first check for freetype2
462   have_freetype=no
463   AM_CHECK_FT2(6.1.0)
464   if test x"$no_ft" = x; then
465     have_freetype=yes
466   else
467     have_freetype=no
468     problem_xft=": Can't detect freetype2 >= 6.1.0/2.0.6"
469   fi
471   # check for fontconfig for Xft 2
472   have_fontconfig=no
473   if test x"$have_freetype" != xno ; then
474     AM_CHECK_FC(1.0.1)
475     if test x"$no_fc" = x ; then
476       have_fontconfig=yes
477     else
478       have_fontconfig=no
479       problem_xft=": Can't detect fontconfig >= 1.0.1"
480     fi
481   fi
483   # now check for Xft 2
484   with_xft=no
485   if test x"$have_fontconfig" != xno ; then
486     # Xft 2
487     AM_CHECK_XFT(2.0.0)
488     if test x"$no_xft" = x; then
489       with_xft=yes
490       problem_xft=" (version 2)"
491       AC_DEFINE(HAVE_XFT2)
492       AC_DEFINE(HAVE_XFT)
493       AC_DEFINE(HAVE_XFT_UTF8)
494       Xft_LIBS=$XFT_LIBS
495       Xft_CFLAGS=$XFT_CFLAGS
496     else
497       problem_xft=": Can't detect Xft2, detected fontconfig"
498     fi
499   fi
501   # if Xft2 not detected check for Xft1
502   if test x"$have_freetype" != xno -a x"$with_xft" != xyes; then
503     #Xft 1
504     $UNSET ac_cv_lib_XftConfigSubstitute
505     $UNSET ac_cv_lib_Xft_XftFontOpen
506     $UNSET ac_cv_lib_Xft_XftDrawStringUtf8
507     AC_CHECK_LIB(Xft, XftFontOpen,
508       with_xft=yes, with_xft=no,
509       [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $FT2_LIBS $Xrender_LIBS])
510     if test x"$with_xft" = xyes ; then
511       AC_CHECK_LIB(Xft, XftConfigSubstitute, is_xft1=yes, is_xft1=no,
512         [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $FT2_LIBS $Xrender_LIBS])
513       if test x"$is_xft1" = xyes; then
514         Xft_LIBS="-lXft $FT2_LIBS"
515         Xft_CFLAGS="$Xft_CFLAGS $FT2_CFLAGS"
516         problem_xft=" (version 1)"
517         AC_DEFINE(HAVE_XFT)
518       else
519         with_xft=no
520         problem_xft=": Can't detect Xft 1 or fontconfig"
521       fi
522     else
523       problem_xft=": Can't detect Xft 1 or 2 and fontconfig"
524     fi
525     if test x"$with_xft" = xyes; then
526       AC_CHECK_LIB(Xft, XftDrawStringUtf8,
527         AC_DEFINE(HAVE_XFT_UTF8),,
528         [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $FT2_LIBS $Xrender_LIBS])
529     fi
530   fi
533 AC_SUBST(Xft_LIBS)
534 AC_SUBST(Xft_CFLAGS)
536 # ********* xpm
537 problem_xpm=": Xpm library or header not found"
539 $UNSET ac_cv_header_X11_xpm_h
540 $UNSET ac_cv_lib_Xpm_XpmReadFileToXpmImage
541 smr_CHECK_LIB(xpm, Xpm, for coloured or shaped icons,
542     XpmReadFileToXpmImage, X11/xpm.h,
543     [$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS], $X_CFLAGS)
545 if test x"$xpm_LIBS" != x; then
546   # Check for proper version of Xpm -- from XEmacs 21.x configure.in
547   AC_MSG_CHECKING([for Xpm 3.4g or better])
548   my_CPPFLAGS="$CPPFLAGS"
549   my_LIBS="$LIBS"
550   CPPFLAGS="$CPPFLAGS $xpm_CFLAGS $X_CFLAGS"
551   LIBS="$LIBS $xpm_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
552   AC_TRY_RUN([#include <X11/xpm.h>
553    int main(int c, char **v) {
554    return c == 1 ? 0 :
555      XpmIncludeVersion != XpmLibraryVersion() ? 1 :
556      XpmIncludeVersion < 30407 ? 2 : 0 ;}],
557     [./conftest dummy_arg; xpm_status=$?;
558      if test x"$xpm_status" = x0; then
559        with_xpm=yes
560        problem_xpm=""
561      else
562        with_xpm=no;
563        if test x"$xpm_status" = x1; then
564          problem_xpm=": Xpm library and header versions don't match"
565        elif test x"$xpm_status" = x2x; then
566          problem_xpm=": Xpm library version is too old"
567        else
568          problem_xpm=": Internal xpm detection logic error"
569        fi
570      fi],
571    [with_xpm=no; problem_xpm=": Xpm test error, see config.log"])
572   AC_MSG_RESULT($with_xpm)
573   CPPFLAGS="$my_CPPFLAGS"
574   LIBS="$my_LIBS"
576   AH_TEMPLATE([XPM],[Define if Xpm library is used.])
577   if test x"$with_xpm" = xyes; then
578     AC_DEFINE(XPM)
579     # FVWMBANNER=FvwmBanner AC_SUBST(FVWMBANNER)
580     # XPMROOT=xpmroot AC_SUBST(XPMROOT)
581     # FVWMSCRIPT=FvwmScript AC_SUBST(FVWMSCRIPT)
582   else
583     xpm_LIBS=
584     xpm_CFLAGS=
585   fi
587 AC_SUBST(xpm_LIBS)
588 AC_SUBST(xpm_CFLAGS)
590 # ********* png
591 problem_png=": png library or header not found"
593 $UNSET ac_cv_header_png_h
594 $UNSET ac_cv_lib_png_png_read_info
595 smr_CHECK_LIB(png, png, for coloured or shaped icons,
596     png_read_info, png.h, -lz -lm,)
598 if test x"$png_LIBS" != x; then
599   # Check for proper version of png
600   AC_MSG_CHECKING([for libpng 1.0.4a or better])
601   my_CPPFLAGS="$CPPFLAGS"
602   my_LIBS="$LIBS"
603   CPPFLAGS="$CPPFLAGS $png_CFLAGS"
604   LIBS="$LIBS $png_LIBS -lz -lm"
605   AC_TRY_RUN([#include <png.h>
606    int main(int c, char **v) {
607    return c == 1 ? 0 : (PNG_LIBPNG_VER < 10005) ? 2 : 0 ;}],
608     [./conftest dummy_arg; png_status=$?;
609      if test x"$png_status" = x0; then
610        with_png=yes;
611      else
612        with_png=no;
613        if test x"$png_status" = x2; then
614          problem_png=": png library version is too old"
615        else
616          problem_png=": Internal png detection logic error"
617        fi
618      fi],
619    [with_png="no"; problem_png=": png test error, see config.log"])
620   AC_MSG_RESULT($with_png)
621   CPPFLAGS="$my_CPPFLAGS"
622   LIBS="$my_LIBS"
625 AH_TEMPLATE([HAVE_PNG],[Define if ppm library is used.])
626 if test x"$with_png" = xyes; then
627   AC_DEFINE(HAVE_PNG)
628   png_LIBS="$png_LIBS -lz"
629   problem_png=""
630 else
631   with_png=no
633 AC_SUBST(png_LIBS)
634 AC_SUBST(png_CFLAGS)
636 # ** needed by the png support
637 AC_C_BIGENDIAN
639 # ********* rsvg
640 rsvg_min_version=2.13.91
641 AH_TEMPLATE([HAVE_RSVG], [Define if librsvg library is used.])
643 AC_ARG_ENABLE(rsvg,
644   [  --disable-rsvg          disable scalable vector graphics (SVG images)],
645   [ if test x"$enableval" = xno; then
646        with_rsvg=no
647        problem_rsvg=": Explicitly disabled"
648     fi ],
650 if test x"$with_rsvg" != xno; then
651    with_rsvg=no
652    if test x"$PKG_CONFIG" != xno ; then
653       AC_MSG_CHECKING(for librsvg - version >= $rsvg_min_version)
654       if $PKG_CONFIG --exists librsvg-2.0 ; then
655          if $PKG_CONFIG --exists "librsvg-2.0 >= $rsvg_min_version" ; then
656             AC_MSG_RESULT(yes)
658             AC_MSG_CHECKING(for cairo svg backend)
659             if $PKG_CONFIG --exists cairo-svg ; then
660                svg_packages="librsvg-2.0 cairo-svg"
661             elif $PKG_CONFIG --exists libsvg-cairo ; then
662                svg_packages="librsvg-2.0 libsvg-cairo"
663             elif $PKG_CONFIG --exists cairo ; then
664                svg_packages="librsvg-2.0 cairo"
665             else
666                svg_packages=""
667             fi
668             if test x"$svg_packages" != x ; then
669                AC_MSG_RESULT(yes)
670                rsvg_CFLAGS=`$PKG_CONFIG --cflags $svg_packages`
671                rsvg_LIBS=`$PKG_CONFIG --libs $svg_packages`
672                with_rsvg=yes
673             else
674                AC_MSG_RESULT(no)
675                AC_MSG_WARN([*** cairo was not found in the pkg-config search])
676                AC_MSG_WARN([*** path. Add the directory containing cairo.pc])
677                AC_MSG_WARN([*** to the PKG_CONFIG_PATH environment variable.])
678                problem_rsvg=": Cannot detect cairo backend"
679             fi
680          else
681             AC_MSG_RESULT(no)
682             AC_MSG_WARN([*** Your librsvg version is < $rsvg_min_version])
683             problem_rsvg=": Your librsvg version is too old"
684          fi
685       else
686          AC_MSG_RESULT(no)
687          AC_MSG_WARN([*** librsvg-2.0 was not found in the pkg-config search])
688          AC_MSG_WARN([*** path. Either librsvg is not installed or you need])
689          AC_MSG_WARN([*** to add the directory containing librsvg-2.0.pc to])
690          AC_MSG_WARN([*** the PKG_CONFIG_PATH environment variable.])
691          problem_rsvg=": librsvg library or header not found"
692       fi
693    else
694       problem_rsvg=": pkg-config not found"
695    fi
697 if test x"$with_rsvg" = xyes ; then
698    AC_MSG_CHECKING(whether a librsvg program compiles and runs)
699    original_CFLAGS="$CFLAGS"
700    original_LIBS="$LIBS"
701    CFLAGS="$CFLAGS $rsvg_CFLAGS"
702    LIBS="$LIBS $rsvg_LIBS"
703    AC_TRY_RUN([
704       #include <librsvg/rsvg.h>
705       #include <librsvg/rsvg-cairo.h>
706       int main() {
707          RsvgHandle *rsvg;
708          g_type_init();
709          if(!(rsvg = rsvg_handle_new())) return 1;
710          g_object_unref(G_OBJECT(rsvg));
711          return 0;
712       }
713    ], [
714       AC_MSG_RESULT(yes)
715    ], [
716       AC_MSG_RESULT(no)
717       AC_MSG_WARN([*** The librsvg test program failed to run. If your system])
718       AC_MSG_WARN([*** has shared libraries outside the normal system library])
719       AC_MSG_WARN([*** path, you need to make sure that the LD_LIBRARY_PATH])
720       AC_MSG_WARN([*** (or the like) environment variable is correctly set.])
721       with_rsvg=no
722       problem_rsvg=": Failed to run test program"
723    ], [echo $ac_n "cross compiling; assumed OK... $ac_c"])
724    CFLAGS="$original_CFLAGS"
725    LIBS="$original_LIBS"
727 if test x"$with_rsvg" = xyes ; then
728    AC_DEFINE(HAVE_RSVG)
729    problem_rsvg=""
730 else
731    rsvg_CFLAGS=""
732    rsvg_LIBS=""
734 AC_SUBST(rsvg_CFLAGS)
735 AC_SUBST(rsvg_LIBS)
737 # ********* rplay
738 $UNSET ac_cv_header_rplay_h
739 $UNSET ac_cv_lib_rplay_rplay_create
740 # Add in X_EXTRA_LIBS here to get things like connect().
741 smr_CHECK_LIB(rplay, , adds audio capability, rplay_create, rplay.h,
742               $X_EXTRA_LIBS)
743 AH_TEMPLATE([HAVE_RPLAY],[Define if rplay library is used.])
744 test x"$rplay_LIBS" != x && AC_DEFINE(HAVE_RPLAY)
745 AC_SUBST(rplay_LIBS)
746 AC_SUBST(rplay_CFLAGS)
749 # ********* stroke
750 $UNSET ac_cv_header_stroke_h
751 $UNSET ac_cv_lib_stroke_stroke_init
752 dnl Add in X_LIBS for MOUSE_DROPPINGS?
753 dnl As of 23/Mar/2000 the only libstroke RPM has /usr/X11R6/include/stroke.h
754 AH_TEMPLATE([HAVE_STROKE],[Define if stroke library is used.])
755 smr_CHECK_LIB(stroke, , mouse strokes recognition,
756         stroke_init, stroke.h,
757         [$X_LIBS -lX11], $X_CFLAGS -I/usr/X11R6/include)
758 test x"$stroke_LIBS" != x &&
759 AC_DEFINE(HAVE_STROKE)
760 AH_VERBATIM([_HAVE_STROKE],
761 [#ifdef HAVE_STROKE
762 #    define STROKE_ARG(x) x,
763 #    define STROKE_CODE(x) x
764 #else
765 #    define STROKE_ARG(x)
766 #    define STROKE_CODE(x)
767 #endif])
768 AC_SUBST(stroke_LIBS)
769 AC_SUBST(stroke_CFLAGS)
772 # ********* readline
773 with_readline=no
774 problem_readline=": Both termcap and ncurses disabled"
776 smr_ARG_WITHLIB(termcap, , to accomplish readline)
777 AH_TEMPLATE([HAVE_READLINE],[Define if readline is available.])
778 if test x"$with_termcap" != xno; then
779   # Forget cached values, so user can re-run configure
780   $UNSET ac_cv_header_readline_history_h
781   $UNSET ac_cv_lib_readline_readline
782   AC_MSG_CHECKING([with termcap])
783   smr_CHECK_LIB(readline, , line editing/history, readline, readline/history.h,
784     $termcap_LIBS)
785   if test x"$readline_LIBS" != x; then
786     with_readline=yes
787     readline_LIBS="$readline_LIBS $termcap_LIBS"
788     AC_DEFINE(HAVE_READLINE)
789   fi
791 smr_ARG_WITHLIB(ncurses, , to accomplish readline)
792 if test x"$with_ncurses" != xno -a ! "$readline_LIBS"; then
793   # We couldn't use readline with termcap; try with ncurses?
794   # Doesn't this seem a hacky way to do this??
795   # unset cached values from last check...
796   $UNSET ac_cv_header_readline_history_h
797   $UNSET ac_cv_lib_readline_readline
798   AC_MSG_CHECKING([with ncurses])
799   dnl We can not call smr_CHECK_LIB twice here without having the usage twice.
800   dnl old_LIBS=$LIBS
801   dnl AC_CHECK_LIB(readline, readline, , , $ncurses_LIBS)
802   dnl LIBS=$old_LIBS
803   dnl if test x"$ac_cv_lib_readline_readline" = xyes; then
804   dnl   AC_CHECK_HEADERS(readline/history.h)
805   dnl   if test x"$ac_cv_header_readline_history_h" = xyes; then
806   dnl     with_readline=yes
807   dnl     readline_LIBS="$readline_LIBS $ncurses_LIBS"
808   dnl     AC_DEFINE(HAVE_READLINE)
809   dnl   fi
810   dnl fi
811   smr_CHECK_LIB(readline, , line editing/history, readline, readline/history.h,
812     $ncurses_LIBS)
813   if test x"$readline_LIBS" != x; then
814     with_readline=yes
815     readline_LIBS="$readline_LIBS $ncurses_LIBS"
816     AC_DEFINE(HAVE_READLINE)
817   fi
819 AC_SUBST(readline_LIBS)
820 AC_SUBST(readline_CFLAGS)
823 # Check if Xsetlocale() is available or not.
824 AH_TEMPLATE([X_LOCALE],[Enables to use setlocale() provided by X])
825 AC_CHECK_LIB(X11, _Xsetlocale, AC_DEFINE(X_LOCALE),, $X_LIBS -lX11)
827 # Check if Xsetlocale() is available or not.
828 AH_TEMPLATE([HAVE_XOUTPUT_METHOD],[Enable X output method])
829 AC_CHECK_LIB(X11, XOpenOM, AC_DEFINE(HAVE_XOUTPUT_METHOD),, $X_LIBS -lX11)
831 # ******** iconv
832 with_iconv=no
833 with_iconv_type=no
834 with_lib_iconv=no
835 with_sys_iconv=no
836 problem_iconv=": Explicitly disabled"
838 AC_ARG_ENABLE(iconv,
839   [  --disable-iconv         disable support for iconv character conversion],
840   [ac_cv_iconv="$enableval"],
841   [ac_cv_iconv="yes"])
843 AH_TEMPLATE([USE_LIBICONV],
844   [define if we use libiconv (not needed in general: for example iconv is
845   native with recent glibc)])
846 AH_TEMPLATE([HAVE_ICONV],
847   [Define if iconv (in the libc) or libiconv is available])
848 if test x"$ac_cv_iconv" != xno; then
849   # * first check for gnu libiconv
850   $UNSET ac_cv_header_libiconv_h
851   $UNSET ac_cv_lib_libiconv_libiconv_open
852   smr_CHECK_LIB(
853         iconv, , if not found sys iconv is used, libiconv_open, iconv.h)
854   if test x"$iconv_LIBS" != x; then
855      AC_DEFINE(USE_LIBICONV)
856      with_lib_iconv=yes
857   fi
858   AC_SUBST(iconv_LIBS)
859   AC_SUBST(iconv_CFLAGS)
861   # * check for system iconv
863   AC_CHECK_FUNC(iconv_open, with_sys_iconv=yes)
865   if test x"$with_lib_iconv" = xyes -a x"$with_sys_iconv" = xyes; then
866      AC_MSG_WARN([***  Both system iconv and libiconv found: use libiconv])
867      AC_MSG_WARN([***  Use --with-iconv-library=no to use the system iconv])
868   fi
870   # * libiconv found check for libcharset to get the good iconv charset
871   if test x"$with_lib_iconv" = xyes; then
872      CHECK_LIBCHARSET
873   fi
875   test x"$with_lib_iconv" = xyes -o x"$with_sys_iconv" = xyes &&
876          with_iconv=yes && problem_iconv=""
877   test x"$with_lib_iconv" = xyes && with_iconv_type="yes (libiconv)"
878   test x"$with_sys_iconv" = xyes && with_iconv_type="yes (from C library)"
880   if test x"$with_iconv" = xno; then
881     AC_MSG_WARN([*** ])
882     AC_MSG_WARN([*** No iconv() implementation found in C library or libiconv])
883     AC_MSG_WARN([*** Please install libiconv ftp://ftp.gnu.org/pub/gnu/libiconv/])
884     AC_MSG_WARN([*** ])
885   fi
887   if test x"$with_iconv" = xyes; then
888      AC_DEFINE(HAVE_ICONV)
889      ICONV_SECOND_ARG
890   fi
892 AH_VERBATIM([_HAVE_LIBCHARSET],
893 [#ifdef USE_LIBICONV
894 /* define to use locale_charset in the place of nl_langinfog if libiconv
895  * is used */
896 #undef HAVE_LIBCHARSET
897 #endif])
900 # ******** nl_langinfo and CODESET
901 AH_TEMPLATE([HAVE_CODESET],[Have nl_langinfo (CODESET)])
902 AC_MSG_CHECKING([for nl_langinfo (CODESET)])
903 AC_TRY_COMPILE([#include <langinfo.h>
904 #include <locale.h>],
905 [char *codeset = nl_langinfo(CODESET); setlocale(LC_CTYPE, "");],
906    AC_DEFINE(HAVE_CODESET)
907    have_codeset=yes,
908    have_codeset=no)
909 AC_MSG_RESULT($have_codeset)
912 # ********* fribidi
913 AC_ARG_ENABLE(bidi,
914         [  --disable-bidi          disable bi-directional text support],
915         [ if test x"$enableval" = xyes; then
916                 with_bidi="yes, check"
917         else
918                 with_bidi="no"
919                 problem_bidi=": Explicitly disabled"
920         fi ],
921         [ with_bidi="not specified, check" ]
924 if test x"$with_bidi" != xno; then
925         AC_ARG_WITH(fribidi-bindir,
926                 [  --with-fribidi-bindir=DIR  directory of fribidi-config if not in PATH],
927                 FRIBIDI_BINDIR="$withval", FRIBIDI_BINDIR=".")
928         AC_PATH_PROG(FRIBIDI_CONFIG, fribidi-config,, [$FRIBIDI_BINDIR:$PATH])
930         if test x"$FRIBIDI_CONFIG" = x; then
931                 with_bidi=no
932                 problem_bidi=": No fribidi-config found in PATH"
933         else
934                 Bidi_CFLAGS=`$FRIBIDI_CONFIG --cflags`
935                 Bidi_LIBS=`$FRIBIDI_CONFIG --libs`
936                 AC_CHECK_LIB(fribidi, fribidi_log2vis,
937                         with_bidi=yes; problem_bidi=,
938                         with_bidi=no; problem_bidi=": No good libs via fribidi-config",
939                         [$Bidi_LIBS $Bidi_CFLAGS])
940         fi
943 if test x"$with_bidi" != xno; then
944         fribidi_in_path=yes
945         ac_save_LIBS="$LIBS"
946         LIBS="$LIBS $Bidi_LIBS"
947         AC_TRY_RUN([#include <stdlib.h>
948 #include <fribidi/fribidi.h>
949 int main()
951         FriBidiChar *logical_unicode_str =
952                 (FriBidiChar *)malloc((4 + 1) * sizeof(FriBidiChar));
953         fribidi_charset_to_unicode(
954                 fribidi_parse_charset("iso8859-8"), "test", 4,
955                 logical_unicode_str);
956         return 0;
958 ], [:], [fribidi_in_path=no])
959         LIBS="$ac_save_LIBS"
960         if test x"$fribidi_in_path" != xyes; then
961                 ac_save_CFLAGS="$CFLAGS"
962                 ac_save_LIBS="$LIBS"
963                 CFLAGS="$CFLAGS $Bidi_CFLAGS"
964                 LIBS="$LIBS $Bidi_LIBS"
965         AC_TRY_RUN([#include <stdlib.h>
966 #include <fribidi/fribidi.h>
967 int main()
969         FriBidiChar *logical_unicode_str =
970                 (FriBidiChar *)malloc((4 + 1) * sizeof(FriBidiChar));
971         fribidi_charset_to_unicode(
972                 fribidi_parse_charset("iso8859-8"), "test", 4,
973                 logical_unicode_str);
974         return 0;
976 ], [:], [with_bidi=no; problem_bidi=": Bad fribidi version, see config.log"])
977                 CFLAGS="$ac_save_CFLAGS"
978                 LIBS="$ac_save_LIBS"
979         fi
980         if test x"$fribidi_in_path" != xno; then
981                 Bidi_CFLAGS=
982                 Bidi_LIBS=-lfribidi
983         fi
986 AH_TEMPLATE([HAVE_BIDI],[Define if fribidi library is used.])
987 AH_TEMPLATE([FRIBIDI_CHARSET_SPELLING],
988   [Support fribidi-0.10.4 and older with "CHARSET" spelling.])
989 if test x"$with_bidi" = xno; then
990         Bidi_CFLAGS=
991         Bidi_LIBS=
992 else
993         AC_DEFINE(HAVE_BIDI)
994         AC_TRY_RUN([#include <fribidi/fribidi.h>
995                 int main(int c, char **v) {
996                         return FRIBIDI_CHARSET_NOT_FOUND * 0;
997                 }
998         ], [AC_DEFINE(FRIBIDI_CHARSET_SPELLING)])
1000 AH_VERBATIM([_FRIBIDI_CHARSET_SPELLING],
1001 [#ifdef FRIBIDI_CHARSET_SPELLING
1002 #  define FRIBIDI_CHAR_SET_NOT_FOUND FRIBIDI_CHARSET_NOT_FOUND
1003 #endif])
1005 AC_SUBST(Bidi_LIBS)
1006 AC_SUBST(Bidi_CFLAGS)
1009 # ********* perllib
1010 with_perllib="yes"
1011 problem_perllib=""
1012 FVWM_PERLLIB=perllib
1013 AC_ARG_ENABLE(perllib,
1014         [  --disable-perllib       disable installing FVWM perl library],
1015         [ if test x"$enableval" = xno; then
1016                 with_perllib="no"
1017                 problem_perllib=": Explicitly disabled"
1018                 FVWM_PERLLIB=""
1019         fi ],
1021 AC_SUBST(FVWM_PERLLIB)
1023 # ******* gettext
1024 ALL_LINGUAS="ar de fr sv_SE zh_CN"
1025 FVWM_DOMAIN="fvwm"
1026 FVWMTASKBAR_DOMAIN="FvwmTaskBar"
1027 FVWMSCRIPT_DOMAIN="FvwmScript"
1028 ALL_DOMAINS="$FVWM_DOMAIN $FVWMTASKBAR_DOMAIN $FVWMSCRIPT_DOMAIN"
1030 AC_SUBST(ALL_LINGUAS)
1031 AC_SUBST(FVWM_DOMAIN)
1032 AC_SUBST(FVWMTASKBAR_DOMAIN)
1033 AC_SUBST(FVWMSCRIPT_DOMAIN)
1034 AC_SUBST(ALL_DOMAINS)
1036 LOCALEDIR='${datadir}'"/locale"
1037 with_gettext="yes"
1038 problem_gettext=""
1040 AC_ARG_ENABLE(nls,
1041         [  --disable-nls           do not use Native Language Support],
1042         [ if test x"$enableval" = xno; then
1043                 with_gettext="no"
1044                 problem_gettext=": Explicitly disabled"
1045         fi ],
1048 AH_TEMPLATE([HAVE_NLS],
1049   [Define to 1 if translation of program messages to the user's native
1050   language is requested.])
1051 if test x"$with_gettext" != xno; then
1052   AM_GNU_FGETTEXT
1053   if test x"$USE_NLS" = "xyes"; then
1054     AC_DEFINE(HAVE_NLS, 1)
1055   else
1056     with_gettext="no"
1057     problem_gettext=": Failed to detected GNU gettext"
1058   fi
1059 else
1060   USE_NLS=no
1063 # libs and buil
1064 AC_SUBST(intl_LIBS)
1065 AC_SUBST(intl_CFLAGS)
1066 AC_SUBST(USE_NLS)
1067 AC_SUBST(POSUB)
1068 AC_SUBST(LOCALEDIR)
1069 AC_SUBST(MKINSTALLDIRS)
1070 # programs for devel
1071 AC_SUBST(XGETTEXT)
1072 AC_SUBST(GMSGFMT)
1073 AC_SUBST(MSGMERGE)
1074 AC_SUBST(MSGFMT)
1075 AC_SUBST(MSGUNIQ)
1076 #catalogs
1077 AC_SUBST(INST_LINGUAS)
1078 AC_SUBST(CATALOGS)
1079 AC_SUBST(POFILES)
1080 AC_SUBST(GMOFILES)
1081 AC_SUBST(UPDATEPOFILES)
1082 AC_SUBST(DUMMYPOFILES)
1083 AC_SUBST(CATOBJEXT)
1085 # Check for REQUIRED headers and functions before going any
1086 # further.
1088 # The module interface uses variadic functions for message passing.
1089 AC_CHECK_HEADERS(stdarg.h)
1090 AC_CHECK_FUNCS(vfprintf)
1091 if test x$ac_cv_header_stdarg_h = xno -o \
1092         $ac_cv_func_vfprintf = no; then
1093      AC_MSG_ERROR([stdarg.h and vfprintf required])
1096 # For reaping children, fvwm needs either waitpid() or wait3()
1097 # Some extra modules may need wait4() too
1098 AC_CHECK_FUNCS(waitpid)
1099 if test x$ac_cv_func_waitpid = xno; then
1100     AC_CHECK_FUNCS(wait3 wait4)
1101     if test x$ac_cv_func_wait3 = xno; then
1102         AC_MSG_ERROR([Either waitpid or wait3 function is required])
1103     fi
1106 # C89/C99 signal handling
1107 AC_CHECK_FUNCS(sigsetjmp siglongjmp)
1109 # Look harder for a C preprocessor for FvwmCpp
1110 AC_PATH_PROG(FVWM_CPP, cpp, no, $PATH:/lib:/usr/lib:/usr/ccs/lib)
1111 if test x"$FVWM_CPP" = xno; then
1112   FVWM_CPP=
1113   AC_MSG_WARN([cannot locate a C preprocessor: run FvwmCpp with -cppprog])
1115 dnl FIXME: make sure the cpp we found actually works...
1117 # Finish checking for programs.
1118 AC_PROG_INSTALL
1119 AC_PROG_LN_S
1120 AC_PROG_MAKE_SET
1121 AC_PROG_RANLIB
1122 dnl lex+yacc now only needed for FvwmScript developers when syntax is changed
1123 dnl AM_PROG_LEX
1124 dnl AC_PROG_YACC
1126 REQUIRED_PERL_VERSION=5.004
1127 AC_SUBST(REQUIRED_PERL_VERSION)
1129 if test x"$PERL" = x; then
1130         AC_PATH_PROG(PERL, perl)
1132 if test x"$PERL" != x; then
1133         AC_MSG_CHECKING([for perl $REQUIRED_PERL_VERSION or better])
1134         if ("$PERL" -e "require $REQUIRED_PERL_VERSION;") 2>/dev/null; then
1135                 AC_MSG_RESULT(yes)
1136         else
1137                 AC_MSG_RESULT(no)
1138                 AC_MSG_WARN([$PERL not found or too old])
1139         fi
1140 else
1141         AC_MSG_WARN([perl is not found, it is required for some scripts and modules])
1142         AC_MSG_WARN([It is recommended to install perl $REQUIRED_PERL_VERSION or better later])
1143         PERL=/usr/bin/perl
1145 AC_MSG_RESULT([assuming $PERL as perl location])
1146 AC_SUBST(PERL)
1148 # Checks for header files.
1149 AC_HEADER_STDC
1150 AC_HEADER_SYS_WAIT
1151 AC_CHECK_HEADERS(stdlib.h fcntl.h limits.h malloc.h string.h memory.h unistd.h)
1152 AC_CHECK_HEADERS(getopt.h sys/select.h sys/systeminfo.h sys/time.h)
1154 # Checks for typedefs, structures, and compiler characteristics.
1155 AC_C_CONST
1156 AC_C_INLINE
1157 AC_TYPE_OFF_T
1158 AC_TYPE_PID_T
1159 AC_TYPE_SIZE_T
1160 AC_HEADER_TIME
1161 dnl AC_STRUCT_TM
1162 AC_TYPE_SIGNAL
1164 # Checks for library functions.
1165 AC_FUNC_ALLOCA
1166 AC_FUNC_STRFTIME
1167 AC_FUNC_SETPGRP
1168 AC_CHECK_FUNCS(gettimeofday mkfifo putenv setvbuf socket waitpid)
1169 AC_CHECK_FUNCS(strdup strstr strtol memmove memcpy strchr sysconf uname div)
1170 AC_CHECK_FUNCS(sigaction siginterrupt getpwuid)
1171 AC_CHECK_FUNCS(setpgrp setpgid)
1172 AC_CHECK_FUNCS(lstat)
1176 pds_CHECK_TYPE(sig_atomic_t, int, [#include <signal.h>], [Specify a type for sig_atomic_t if it's not available.])
1178 if test x$ac_cv_func_setvbuf = xyes; then
1179   AC_FUNC_SETVBUF_REVERSED
1182 AC_FUNC_SELECT
1183 if test x$ac_cv_func_select != xyes; then
1184   AC_MSG_ERROR([select required])
1187 # Check for standard functions that we have replacements for.
1188 AC_REPLACE_FUNCS(gethostname strcasecmp strncasecmp strdup strerror usleep atexit)
1189 dnl dv: this is harmful with autoconf 2.53 and is done automatically anyway
1190 dnl AC_SUBST(LIBOBJS)
1192 # check for mkstemp, see the discution on this subject on the fvwm workers
1193 # list (2001-02-16 and 2001-02-24)
1194 AM_SAFETY_CHECK_MKSTEMP
1196 # If we do not have atexit(), then check for on_exit()
1197 if test x$ac_cv_func_atexit = xno; then
1198   AC_CHECK_FUNCS(on_exit)
1201 # Check for unsetenv function
1202 AC_CHECK_FUNCS(unsetenv)
1205 # ********* GTK, IMLIB, GNOME
1206 # Check the availability of gtk
1207 FVWMGTK=""
1208 MANFVWMGTK=""
1209 AC_ARG_ENABLE(
1210         gtk,
1211         [  --disable-gtk           do not build modules using gtk library],
1212         enable_gtktest="$enableval", enable_gtktest=yes)
1213 if test x"$enable_gtktest" = xyes; then
1214         AM_PATH_GTK(1.1.0,[
1215                 FVWMGTK="FvwmGtk$EXEEXT" AC_SUBST(FVWMGTK)
1216                 MANFVWMGTK=FvwmGtk.1 AC_SUBST(MANFVWMGTK)
1217         ],)
1218         if test x"$no_gtk" = x; then
1219                 with_gtk=yes
1220                 problem_gtk=""
1221         else
1222                 with_gtk=no
1223                 problem_gtk=": Failed to detect GTK, see config.log"
1224         fi
1225 else
1226         with_gtk=no
1227         problem_gtk=": Explicitly disabled"
1229 AC_SUBST(FVWMGTK)
1230 AC_SUBST(MANFVWMGTK)
1232 # Check the availability of gdk-imlib
1233 AH_TEMPLATE([GDK_IMLIB],[Define if gdk-imlib is used])
1234 AM_PATH_GDK_IMLIB(1.8.0, AC_DEFINE(GDK_IMLIB))
1235 if test x"$no_imlib" = x; then
1236   with_gdkimlib=yes
1237   problem_gdkimlib=""
1238 else
1239   with_gdkimlib=no
1240   problem_gdkimlib=": Failed on gdk-imlib, see config.log"
1243 GNOME_INIT_HOOK
1245 # Unfortunately we have 2 gnome supports: WM hints and gnome libs.
1246 # The $with_gnomehints below refers to the first, not GNOME_INIT_HOOK.
1247 if test x"$enable_gnome_hints" != xno; then
1248   with_gnomehints=yes
1249   problem_gnomehints=""
1250 else
1251   with_gnomehints=no
1252   problem_gnomehints=": Explicitly disabled"
1255 # Define some compatibility macros needed for config.h.
1256 mg_DEFINE_IF_NOT([#include <X11/keysym.h>],
1257   [defined XK_Page_Up && defined XK_Page_Down],
1258   [COMPAT_OLD_KEYSYMDEF], [$X_CFLAGS],
1259   [Old AIX systems (3.2.5) don't define some common keysyms.])
1260 AH_VERBATIM([_COMPAT_OLD_KEYSYMDEF],
1261 [#ifdef COMPAT_OLD_KEYSYMDEF
1262 #  define XK_Page_Up   XK_Prior
1263 #  define XK_Page_Down XK_Next
1264 #endif])
1266 if test x"$with_stroke" = xyes; then
1267   mg_DEFINE_IF_NOT([#include <stroke.h>],
1268     [defined STROKE_MAX_SEQUENCE],
1269     [COMPAT_OLD_LIBSTROKE], [$stroke_CFLAGS],
1270     [Old libstroke <= 0.4 does not use STROKE_ prefix for constants.])
1272 AH_VERBATIM([_COMPAT_OLD_LIBSTROKE],
1273 [#ifdef COMPAT_OLD_LIBSTROKE
1274 /* currently we only use one constant */
1275 #  define STROKE_MAX_SEQUENCE MAX_SEQUENCE
1276 #endif])
1279 # Allow building with dmalloc.  Do this last to avoid screwing up any
1280 # other checks above.
1281 case "$ac_cv_dmalloc" in
1282   yes) AC_CHECK_HEADERS(dmalloc.h)
1283        AC_CHECK_LIB(dmalloc, dmalloc_shutdown)
1284        CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK" ;;
1285 esac
1288 # Allow building with efence.
1289 case "$ac_cv_efence" in
1290   yes) AC_CHECK_LIB(efence, malloc) ;;
1291 esac
1293 # some explicit definitions for config.h file
1294 AH_VERBATIM([_ZEND_EXPLICIT_DEFINITIONS],
1297  * The next few defines are options that are only changed from their values
1298  * shown here on systems that _don't_ use the configure script.
1299  **/
1301 /* Enable tests for missing too many XEvents.  Usually you want this. */
1302 #define WORRY_ABOUT_MISSED_XEVENTS 1
1304 /* Define if the X11 ConnectionNumber is actually a file descriptor. */
1305 #define HAVE_X11_FD 1
1307 /* Define if fork() has unix semantics.  On VMS, no child process is created
1308    until after a successful exec(). */
1309 #define FORK_CREATES_CHILD 1
1311 /* Suffix for executable filenames; NULL if no extension needed. */
1312 #define EXECUTABLE_EXTENSION NULL
1314 /* Define to remove the extension from executable pathnames before calling
1315    exec(). */
1316 #undef REMOVE_EXECUTABLE_EXTENSION
1318 /* Enables the "MiniIcon" Style option to specify a small pixmap which
1319  * can be used as one of the title-bar buttons, shown in window list,
1320  * utilized by modules, etc.  Requires PIXMAP_BUTTONS to be defined
1321  * (see below). */
1322 /* #undef MINI_ICONS */
1323 /* NOTE: hard coded to 1 */
1324 #if 1
1325 #define FMiniIconsSupported 1
1326 #else
1327 #define FMiniIconsSupported 0
1328 #endif
1330 /* Enables tagged general decoration styles which can be assigned to
1331  * windows using the UseDecor Style option, or dynamically updated
1332  * with ChangeDecor.  To create and destroy "decor" definitions, see
1333  * the man page entries for AddToDecor and DestroyDecor.  There is a
1334  * slight memory penalty for each additionally defined decor. */
1335 /* #undef USEDECOR */
1336 /* NOTE: hard coded to 1 */
1337 #define USEDECOR 1
1339 #if RETSIGTYPE != void
1340 #define SIGNAL_RETURN return 0
1341 #else
1342 #define SIGNAL_RETURN return
1343 #endif
1345 /* Allow GCC extensions to work, if you have GCC. */
1346 #ifndef __attribute__
1347 /* This feature is available in gcc versions 2.5 and later. */
1348 #  if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
1349 #    define __attribute__(x)
1350 #  endif
1351 /* The __-protected variants of `format' and `printf' attributes
1352  * are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
1353 #  if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
1354 #    define __format__ format
1355 #    define __printf__ printf
1356 #  endif
1357 #endif
1359 #if HAVE_ALLOCA_H
1360 #  include <alloca.h>
1361 #else
1362 #  ifdef _AIX
1363        #pragma alloca
1364 #  else
1365 #    ifndef alloca /* predefined by HP cc +Olibcalls */
1366          char *alloca ();
1367 #    endif
1368 #  endif
1369 #endif
1371 #ifdef HAVE_STRING_H
1372 #  include <string.h>
1373 #endif
1374 #ifdef HAVE_STRINGS_H
1375 #  include <strings.h>
1376 #endif
1377 #ifdef HAVE_MEMORY_H
1378 #  include <memory.h>
1379 #endif
1380 #ifdef HAVE_STDLIB_H
1381 #  include <stdlib.h>
1382 #endif
1383 #ifdef HAVE_MALLOC_H
1384 #  include <malloc.h>
1385 #endif
1386 #ifdef HAVE_FCNTL_H
1387 #  include <fcntl.h>
1388 #endif
1389 #ifndef HAVE_STRCHR
1390 #  define strchr(_s,_c)   index((_s),(_c))
1391 #  define strrchr(_s,_c)  rindex((_s),(_c))
1392 #endif
1394 #ifndef HAVE_MEMCPY
1395 #  define memcpy(_d,_s,_l)  bcopy((_s),(_d),(_l))
1396 #endif
1397 #ifndef HAVE_MEMMOVE
1398 #  define memmove(_d,_s,_l) bcopy((_s),(_d),(_l))
1399 #endif
1401 #if HAVE_SYS_TYPES_H
1402 #  include <sys/types.h>
1403 #endif
1405 #if HAVE_UNISTD_H
1406 #  include <unistd.h>
1407 #endif
1409 #ifndef min
1410 #  define min(a,b) (((a)<(b)) ? (a) : (b))
1411 #endif
1412 #ifndef max
1413 #  define max(a,b) (((a)>(b)) ? (a) : (b))
1414 #endif
1415 #ifndef abs
1416 #  define abs(a) (((a)>=0)?(a):-(a))
1417 #endif
1419 #include "libs/defaults.h"
1421 #ifndef FEVENT_C
1422 #include <X11/Xlib.h>
1423 #include "libs/FEvent.h"
1424 #endif
1426 #ifndef O_NOFOLLOW
1427 #define O_NOFOLLOW 0
1428 #endif
1430 #ifdef HAVE_LSTAT
1431 #define DO_USE_LSTAT 1
1432 #define fvwm_lstat(x,y) lstat(x,y)
1433 #else
1434 #define DO_USE_LSTAT 0
1435 #define fvwm_lstat(x,y) -1
1436 #endif
1440 # mainly for fvwm-config
1441 AC_SUBST(with_bidi)
1442 AC_SUBST(with_gtk)
1443 AC_SUBST(with_gdkimlib)
1444 AC_SUBST(with_gettext)
1445 AC_SUBST(with_gnomelibs)
1446 AC_SUBST(with_iconv)
1447 AC_SUBST(with_perllib)
1448 AC_SUBST(with_png)
1449 AC_SUBST(with_rsvg)
1450 AC_SUBST(with_readline)
1451 AC_SUBST(with_rplay)
1452 AC_SUBST(with_shape)
1453 AC_SUBST(with_shm)
1454 AC_SUBST(with_sm)
1455 AC_SUBST(with_stroke)
1456 AC_SUBST(with_xft)
1457 AC_SUBST(with_xinerama)
1458 AC_SUBST(with_xrender)
1459 AC_SUBST(with_xpm)
1461 dnl with autoconf <2.60 this is needed
1462 AC_SUBST(datarootdir)
1464 LOCAL_BUGADDR=${FVWM_BUGADDR-${USER-${LOGNAME-`whoami`}}}
1465 AC_SUBST(LOCAL_BUGADDR)
1467 AC_OUTPUT(
1468         Makefile
1469         libs/Makefile
1470         fvwm/Makefile
1471         modules/Makefile
1473         bin/fvwm-bug.1
1474         bin/fvwm-config.1
1475         bin/fvwm-convert-2.2.1
1476         bin/fvwm-convert-2.4.1
1477         bin/fvwm-convert-2.6.1
1478         bin/fvwm-menu-desktop.1
1479 dnl     bin/fvwm-menu-directory.1
1480 dnl     bin/fvwm-menu-headlines.1
1481 dnl     bin/fvwm-menu-xlock.1
1482 dnl     bin/fvwm-perllib.1
1483         bin/fvwm-root.1
1484         fvwm/fvwm.1
1485         modules/FvwmAnimate/FvwmAnimate.1
1486         modules/FvwmAuto/FvwmAuto.1
1487         modules/FvwmBacker/FvwmBacker.1
1488         modules/FvwmBanner/FvwmBanner.1
1489         modules/FvwmButtons/FvwmButtons.1
1490         modules/FvwmCommand/FvwmCommand.1
1491         modules/FvwmConsole/FvwmConsole.1
1492         modules/FvwmConsole/FvwmConsoleC.pl.1
1493         modules/FvwmCpp/FvwmCpp.1
1494 dnl     modules/FvwmDebug/FvwmDebug.1
1495 dnl     modules/FvwmDebug/FvwmGtkDebug.1
1496 dnl     modules/FvwmDebug/FvwmOldDebug.1
1497         modules/FvwmDragWell/FvwmDragWell.1
1498         modules/FvwmEvent/FvwmEvent.1
1499         modules/FvwmForm/FvwmForm.1
1500         modules/FvwmGtk/FvwmGtk.1
1501         modules/FvwmIconBox/FvwmIconBox.1
1502         modules/FvwmIconMan/FvwmIconMan.1
1503         modules/FvwmIdent/FvwmIdent.1
1504         modules/FvwmM4/FvwmM4.1
1505         modules/FvwmPager/FvwmPager.1
1506 dnl     modules/FvwmPerl/FvwmPerl.1
1507         modules/FvwmProxy/FvwmProxy.1
1508         modules/FvwmRearrange/FvwmRearrange.1
1509         modules/FvwmSave/FvwmSave.1
1510         modules/FvwmSaveDesk/FvwmSaveDesk.1
1511         modules/FvwmScript/FvwmScript.1
1512         modules/FvwmScroll/FvwmScroll.1
1513         modules/FvwmTaskBar/FvwmTaskBar.1
1514         modules/FvwmTheme/FvwmTheme.1
1515         modules/FvwmWharf/FvwmWharf.1
1516         modules/FvwmWinList/FvwmWinList.1
1517 dnl     modules/FvwmWindowMenu/FvwmWindowMenu.1
1519         bin/Makefile
1520         bin/fvwm-config
1521         bin/fvwm-bug
1522         bin/fvwm-perllib
1523         bin/fvwm-menu-xlock
1524         bin/fvwm-menu-directory
1525         bin/fvwm-menu-desktop
1526         bin/fvwm-menu-headlines
1527         bin/fvwm-convert-2.4
1528         bin/fvwm-convert-2.6
1530         utils/Makefile
1531         perllib/Makefile
1532         perllib/General/Makefile
1533         perllib/FVWM/Makefile
1534         perllib/FVWM/Module/Makefile
1535         perllib/FVWM/Tracker/Makefile
1536         perllib/FVWM/Module.pm
1537         rpm/Makefile
1538         rpm/fvwm.spec
1539         debian/Makefile
1540         debian/control
1541         docs/fvwm.lsm
1542         docs/Makefile
1543         sample.fvwmrc/Makefile
1544         tests/Makefile
1545         tests/hints/Makefile
1546         po/Makefile
1548         modules/FvwmAnimate/Makefile
1549         modules/FvwmAuto/Makefile
1550         modules/FvwmBacker/Makefile
1551         modules/FvwmBanner/Makefile
1552         modules/FvwmButtons/Makefile
1553         modules/FvwmCommand/Makefile
1554         modules/FvwmCommand/scripts/Makefile
1555         modules/FvwmConsole/Makefile
1556         modules/FvwmConsole/FvwmConsoleC.pl
1557         modules/FvwmCpp/Makefile
1558         modules/FvwmDebug/Makefile
1559         modules/FvwmDebug/FvwmDebug
1560         modules/FvwmDebug/FvwmGtkDebug
1561         modules/FvwmDragWell/Makefile
1562         modules/FvwmEvent/Makefile
1563         modules/FvwmForm/Makefile
1564         modules/FvwmIconBox/Makefile
1565         modules/FvwmIconMan/Makefile
1566         modules/FvwmIdent/Makefile
1567         modules/FvwmM4/Makefile
1568         modules/FvwmPager/Makefile
1569         modules/FvwmPerl/Makefile
1570         modules/FvwmPerl/FvwmPerl
1571         modules/FvwmProxy/Makefile
1572         modules/FvwmRearrange/Makefile
1573         modules/FvwmSave/Makefile
1574         modules/FvwmSaveDesk/Makefile
1575         modules/FvwmScript/Makefile
1576         modules/FvwmScript/Scripts/Makefile
1577         modules/FvwmScript/Widgets/Makefile
1578         modules/FvwmScroll/Makefile
1579         modules/FvwmTabs/Makefile
1580         modules/FvwmTabs/FvwmTabs
1581         modules/FvwmTaskBar/Makefile
1582         modules/FvwmTheme/Makefile
1583         modules/FvwmWharf/Makefile
1584         modules/FvwmWinList/Makefile
1585         modules/FvwmWindowMenu/Makefile
1586         modules/FvwmWindowMenu/FvwmWindowMenu
1587         modules/FvwmGtk/Makefile
1590 # ---------------------------------------------------------------------------
1591 # Original config.status is patched to make generated scripts executable.
1592 sed 's/> $ac_file/> $ac_file; test x"`head -1 $ac_file | cut -c1-2`" = x"#!" \&\& chmod a+rx $ac_file/' <config.status >config.status-t && \
1593 mv config.status-t config.status
1594 chmod +x config.status
1595 # ---------------------------------------------------------------------------
1597 # ---------------------------------------------------------------------------
1598 cat >config.status-t <<EOF
1599 #! /bin/sh
1601 # Original config.status is patched to satisfy processing *.in with 'make -j'.
1602 # This bug seems to be partially fixed in autoconf-2.50 (not in all places).
1603 UNIQUE_POSTFIX=\$\$
1606 sed 's/conftest/conftest\${UNIQUE_POSTFIX}/g' <config.status >>config.status-t && \
1607 mv config.status-t config.status
1608 chmod +x config.status
1609 # ---------------------------------------------------------------------------
1611 eval my_bindir="`eval echo ${bindir}`"
1612 eval my_mandir="`eval echo ${mandir}`"
1613 eval my_moddir="`eval echo ${FVWM_MODULEDIR}`"; eval my_moddir="$my_moddir"
1614 eval my_datdir="`eval echo ${FVWM_DATADIR}`"
1615 eval my_plldir="`eval echo ${FVWM_PERLLIBDIR}`"
1616 test x"$FVWM_PERLLIB" = x && my_plldir="(Not installed) $my_plldir"
1617 eval my_localedir="`eval echo ${LOCALEDIR}`"
1618 test x"$USE_NLS" = xno && my_localedir="(Not installed) $my_localdir"
1620 case "$with_gtk" in
1621   yes) fvwmgtk_msg="
1622   With GDK image support in FvwmGtk?  $with_gdkimlib$problem_gdkimlib
1623   With GNOME libs support in FvwmGtk? $with_gnomelibs$problem_gnomelibs" ;;
1624   no) fvwmgtk_msg="" ;;
1625 esac
1627 echo "
1628 FVWM Configuration:
1630   Version:     $VERSION$VERSIONINFO
1632   Executables: $my_bindir
1633   Man pages:   $my_mandir
1634   Modules:     $my_moddir
1635   Data files:  $my_datdir
1636   Perl lib:    $my_plldir
1637   Locale msg:  $my_localedir $INST_LINGUAS
1639   With Asian bi-direct. text support? $with_bidi$problem_bidi
1640   With Gettext Native Lang support?   $with_gettext$problem_gettext
1641   With GTK+ required for FvwmGtk?     $with_gtk$problem_gtk$fvwmgtk_msg
1642   With Iconv support?                 $with_iconv_type$problem_iconv
1643   With Mouse strokes (gestures)?      $with_stroke$problem_stroke
1644   With PNG image support?             $with_png$problem_png
1645   With ReadLine sup. in FvwmConsole?  $with_readline$problem_readline
1646   With RPlay support in FvwmEvent?    $with_rplay$problem_rplay
1647   With Shaped window support?         $with_shape$problem_shape
1648   With Shared memory for XImage?      $with_shm$problem_shm
1649   With Session Management support?    $with_sm$problem_sm
1650   With SVG image support?             $with_rsvg$problem_rsvg
1651   With Xinerama multi-head support?   $with_xinerama$problem_xinerama
1652   With Xft anti-alias font support?   $with_xft$problem_xft
1653   With XPM image support?             $with_xpm$problem_xpm
1654   With Xrender image support?         $with_xrender$problem_xrender
1656 See INSTALL.fvwm for the description of what this may mean."
1658 case "$with_xinerama_emulation" in
1659   yes) echo "  Xinerama emulation enabled." ;;
1660 esac
1661 case "$ac_cv_dmalloc" in
1662   yes) echo "  DMALLOC heap debugging library enabled." ;;
1663 esac
1664 case "$ac_cv_efence" in
1665   yes) echo "  EFENCE debugging library enabled." ;;
1666 esac