1dnl Process this file with autoconf to produce a configure script.
2dnl
3AC_PREREQ(2.60)
4
5dnl should be "yes" only within the released distribution
6ISRELEASED="yes"
7if test $ISRELEASED = "no"; then
8	RELDATELONG=""
9	RELDATESHORT=""
10	RELDATENUM=""
11
12fi
13
14# Silence warning: ar: 'u' modifier ignored since 'D' is the default
15AC_SUBST(AR_FLAGS, [cr])
16
17AC_INIT([fvwm3], 1.0.4, [fvwm-workers@fvwm.org])
18AC_CONFIG_AUX_DIR(etc)
19AC_CONFIG_LIBOBJ_DIR(libs)
20AM_INIT_AUTOMAKE([foreign subdir-objects])
21AM_SILENT_RULES([yes])
22AM_CONFIG_HEADER(config.h)
23
24VERSIONINFO=m4_esyscmd([./utils/fvwm-version-str.sh])
25
26dnl date of the released version (please zero pad the day in the last 2 dates)
27dnl for example: "4 February 2003", "04 Feb 2003", "2003-02-04"
28dnl date format strings: "%e %B %Y", "%d-%b-%Y", "%Y-%m-%d"
29RELDATELONG="17 July 21"
30RELDATESHORT="17-Jul-21"
31RELDATENUM="21-07-17"
32
33# constant variable settings
34FVWMNAMELONG="F? Virtual Window Manager"
35FVWMHOMEPAGE="http://fvwm.org/"
36FVWMLIST="fvwm@fvwm.org"
37FVWMWORKERSLIST="fvwm-workers@fvwm.org"
38FVWMWORKERSLISTLONG="fvwm workers list <fvwm-workers@fvwm.org>"
39MANPAGE_PREAMBLE='.\" WARNING: This file was automatically generated.  Edit the .in file instead.'
40
41AC_SUBST(ISRELEASED)
42AH_TEMPLATE([VERSIONINFO],[Additional version information, like date])
43AC_DEFINE_UNQUOTED(VERSIONINFO, "$VERSIONINFO")
44AC_SUBST(VERSIONINFO)
45AC_SUBST(RELDATELONG)
46AC_SUBST(RELDATESHORT)
47AC_SUBST(RELDATENUM)
48AC_SUBST(FVWMNAMELONG)
49AC_SUBST(FVWMHOMEPAGE)
50AC_SUBST(FVWMLIST)
51AC_SUBST(FVWMWORKERSLIST)
52AC_SUBST(FVWMWORKERSLISTLONG)
53AC_SUBST(MANPAGE_PREAMBLE)
54
55# check for programs needed to build html docs
56AC_CHECK_PROG(SED, sed, sed, "")
57AC_SUBST(SED)
58
59# optional python:
60PYTHON=
61REQUIRED_PYTHON_VERSION=3.0
62AC_SUBST(REQUIRED_PYTHON_VERSION)
63AC_PATH_PROG([PYTHON],[python3],[:])
64AS_IF([test "$PYTHON" != ":"],
65            [AM_PYTHON_CHECK_VERSION([$PYTHON],[$REQUIRED_PYTHON_VERSION],[:],
66				     [PYTHON=":"])])
67
68# Golang
69problem_golang=""
70AC_ARG_ENABLE(golang,
71  AS_HELP_STRING([--enable-golang],[enable compilation of modules written in Go]),
72  [ if test x"$enableval" = xyes; then
73		with_golang="yes, check"
74	else
75		with_golang="no"
76		problem_golang=": Explicitly disabled"
77	fi ],
78  [ with_golang="no" ]
79)
80
81if test ! x"$with_golang" = xno; then
82	AC_CHECK_PROGS(GO, go)
83	if test -n "$GO" ; then
84	    GOVERSIONOPTION=version
85	    go_version=$($GO $GOVERSIONOPTION | sed -e 's/go version go//' | \
86		sed -e 's/ .*$//')
87	    AC_MSG_CHECKING([whether go version is >= 1.14.x ($go_version)])
88	    case "$go_version" in
89	     1.14*|1.15*|1.16*|1.17*|1.18*|1.19*)
90	      AC_MSG_RESULT([yes - version is: $go_version])
91	      with_golang="yes"
92	      GO=
93	      ;;
94	    *)
95	      AC_MSG_RESULT([no - version is: $go_version])
96	      with_golang="no"
97	      problem_golang=": version of go ($go_version) <= 1.14.x"
98	      ;;
99	    esac
100	fi
101fi
102AM_CONDITIONAL([FVWM_BUILD_GOLANG], [test x"$with_golang" = xyes])
103AC_SUBST(GO)
104
105#!!!
106PERL=""
107REQUIRED_PERL_VERSION=5.004
108AC_SUBST(REQUIRED_PERL_VERSION)
109if test x"$PERL" = x; then
110	AC_PATH_PROG(PERL, perl)
111fi
112if test ! x"$PERL" = x; then
113	AC_MSG_CHECKING([for perl $REQUIRED_PERL_VERSION or better])
114	HAVE_PERL_FOR_DOCS=1
115	if ("$PERL" -e "require $REQUIRED_PERL_VERSION;") 2>/dev/null; then
116		AC_MSG_RESULT(yes)
117	else
118		AC_MSG_RESULT(no)
119		AC_MSG_WARN([$PERL not found or too old])
120	fi
121else
122	HAVE_PERL_FOR_DOCS=0
123	AC_MSG_WARN([perl is not found, it is required for some scripts and modules])
124	AC_MSG_WARN([It is recommended to install perl $REQUIRED_PERL_VERSION or better later])
125	PERL=/usr/bin/perl
126fi
127AC_MSG_RESULT([assuming $PERL as perl location])
128AC_SUBST(PERL)
129
130# installation paths
131transform=`echo "${program_transform_name}" | "$SED" -e 's/\\$\\$/\\$/'`
132PPACKAGE=`echo "${PACKAGE}" | "$SED" -e "${transform}"`
133FVWM_MODULESUBDIR=/${PPACKAGE}/${VERSION}
134FVWM_DATASUBDIR=/${PPACKAGE}
135
136AC_ARG_ENABLE(package-subdirs,
137  AS_HELP_STRING([--disable-package-subdirs],
138    [do not create subdirs for modules and data]),
139  [if test x"$enableval" = xno; then FVWM_MODULESUBDIR=""; FVWM_DATASUBDIR="";
140  fi], [])
141
142
143FVWM_MODULEDIR='${libexecdir}'"$FVWM_MODULESUBDIR"
144FVWM_DATADIR='${datadir}'"$FVWM_DATASUBDIR"
145FVWM_DOCDIR='${datadir}'"$FVWM_DOCSUBDIR"
146FVWM_PERLLIBDIR='${datadir}'"$FVWM_DATASUBDIR/perllib"
147FVWM_CONFDIR='${sysconfdir}'dnl used _only_ to search for system.fvwm2rc
148
149AC_SUBST(FVWM_MODULEDIR)
150AC_SUBST(FVWM_DATADIR)
151AC_SUBST(FVWM_PERLLIBDIR)
152AC_SUBST(FVWM_CONFDIR)
153AC_SUBST(FVWM_DOCDIR)
154
155# Check for compatiblity for missing implementations.
156AC_REPLACE_FUNCS([ \
157    asprintf \
158])
159
160AH_TEMPLATE([FVWM_CONFIG],
161  [Name of config filenames in FVWM_USERDIR and FVWM_DATADIR])
162AC_DEFINE(FVWM_CONFIG, "config")
163
164AH_TEMPLATE([FVWM2RC],[Suffix for old (to be deprecated) config filenames])
165AC_DEFINE(FVWM2RC, ".fvwm2rc")
166
167# Various configure-time options
168
169AC_ARG_ENABLE(dmalloc,
170  AS_HELP_STRING([--enable-dmalloc],
171    [enable support for the dmalloc debugging library]),
172  [ac_cv_dmalloc="$enableval"],
173  [ac_cv_dmalloc="no"])
174
175AC_ARG_ENABLE(efence,
176  AS_HELP_STRING([--enable-efence],
177    [enable support for the efence debugging library]),
178  [ac_cv_efence="$enableval"],
179  [ac_cv_efence="no"])
180
181dnl dummy: smr_SWITCH(sm, dummy for test script, on, SESSION)
182
183# Need to know where X is, for finding some libraries (e.g. xpm)
184no_x=""
185AC_PATH_XTRA
186if test x"$no_x" = x"yes"; then
187  echo
188  echo "X11 libraries or header files could not be found.  Please make"
189  echo "sure the X11 development package is installed on your system."
190  echo "If it is definitely installed, try setting the include and library"
191  echo "paths with the --x-include and --x-libraries options of configure."
192  echo "Fvwm can not be compiled without the X11 development environment."
193  echo
194  echo "Aborting."
195  echo
196  exit 1
197fi
198
199# FIXME: default value should be derived from computed path to X
200# includes.  Actually, this should probably not appear in configure
201# at all: it is settable at runtime, and only confuses the issue to
202# have it settable here too.
203#
204AC_MSG_CHECKING(imagepath)
205val="/usr/include/X11/bitmaps:/usr/include/X11/pixmaps"
206AC_ARG_WITH(imagepath,
207  AS_HELP_STRING([--with-imagepath=PATH],
208    [colon-delimited search path for images]),
209[ case "$withval" in
210  no)
211    AC_MSG_ERROR([Can not disable image path.])
212    ;;
213  yes)
214    ;;
215  *)
216    val="$withval"
217    ;;
218  esac ])
219AH_TEMPLATE([FVWM_IMAGEPATH],[Where to search for images.])
220AC_DEFINE_UNQUOTED(FVWM_IMAGEPATH, "$val")
221
222FVWM_IMAGEPATH="$val"
223AC_SUBST(FVWM_IMAGEPATH)
224AC_MSG_RESULT($val)
225
226# Minimal checks for programs: enough to enable checking for
227# optional libraries.
228AC_PROG_CC
229AC_PROG_CPP
230
231# added -Wall for gcc, what about for others?
232if test "x$GCC" = "xyes"; then
233  CFLAGS="-Wall -Wno-implicit-int -fno-common -Wno-error=format-security $CFLAGS"
234fi
235
236# Help finding POSIX functions on some systems
237AC_ISC_POSIX
238AC_MINIX
239
240# catch -Werror and similar options when running configure
241AC_TRY_COMPILE([#include <stdio.h>],
242[int i; static j; int *p; char *c;
243  switch (*p = p = *c) { case 0: printf("%Q", c, p); }
244  *c = &i; c = p;
245  while (1 || (unsigned int)3 >= 0 || ((int)-1) == ((unsigned int)1));
246], , AC_MSG_ERROR("
247configure is not able to compile programs with warnings.  Please
248remove all offending options like -Werror from the CFLAGS and
249CPPFLAGS variables and run configure again."))
250
251# check size of some types
252ac_save_CFLAGS="$CFLAGS"
253CFLAGS="$CFLAGS $X_CFLAGS"
254AC_CHECK_SIZEOF(int)
255AC_CHECK_SIZEOF(long)
256AC_CHECK_SIZEOF(Window, , [#include <stdio.h>
257#include <X11/X.h>])
258AC_CHECK_SIZEOF(Pixel, , [#include <stdio.h>
259#include <X11/Intrinsic.h>])
260AC_CHECK_SIZEOF(void *)
261CFLAGS="$ac_save_CFLAGS"
262size_check_failed=""
263if test "$ac_cv_sizeof_void_p" -gt "$ac_cv_sizeof_long"; then
264  echo "The type void * is bigger than long."
265  size_check_failed=1
266fi
267if test "$ac_cv_sizeof_Window" -gt "$ac_cv_sizeof_long"; then
268  echo "The type Window is bigger than long."
269  size_check_failed=1
270fi
271if test "$ac_cv_sizeof_Pixel" -gt "$ac_cv_sizeof_long"; then
272  echo "The type Pixel is bigger than long."
273  size_check_failed=1
274fi
275if test x"$size_check_failed" = x1; then
276  echo "This is not supported by the module interface yet (make_new_vpacket)."
277  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)"
278  echo "Please report details of your system and this message to ${FVWMWORKERSLIST}."
279  echo
280  exit 1
281fi
282
283# 'unset' is not portable, but setting to null is not enough to avoid using
284# the cached value!  For ancient shells "rm config.cache" is a solution.
285UNSET=true
286if unset UNSET 2>/dev/null; then UNSET=unset; fi
287
288
289# ********* multibyte
290# FreeBSD has libxpg4, check this and use if found.
291AC_CANONICAL_HOST
292AC_MSG_CHECKING(platform)
293case "$host_os" in
294freebsd*)
295	AC_MSG_RESULT(FreeBSD)
296	AC_CHECK_LIB(xpg4, setlocale, [LIBS="$LIBS -lxpg4"])
297	;;
298*openbsd*)
299	AC_MSG_RESULT(OpenBSD)
300	CFLAGS="$CFLAGS -I/usr/local/include"
301	LDFLAGS="$LDFLAGS -L/usr/local/lib"
302	;;
303*)
304	;;
305esac
306
307# *** pkg-config
308# unfortunately, we need pkg-config for the detection of certain libs:
309# - version of fontconfig without fontconfig-config
310# - version of fribidi without fribidi-config
311AM_CHECK_PKG_CONFIG
312
313PKG_CHECK_MODULES([xt],[xt],
314[],
315[
316 AC_MSG_ERROR([*** libxt not found. ***])
317])
318
319problem_mandoc=""
320AC_CHECK_PROG(ASCIIDOC, asciidoctor, asciidoctor, "")
321AC_SUBST(ASCIIDOC)
322
323AC_ARG_ENABLE(mandoc,
324  AS_HELP_STRING([--enable-mandoc],
325    [enable generation of man pages]),
326  [ if test x"$enableval" = xyes; then
327		with_mandoc="yes, check"
328	else
329		with_mandoc="no"
330		problem_mandoc=": Explicitly disabled"
331	fi ],
332  [ with_mandoc="no" ]
333)
334
335if test ! x"$with_mandoc" = xno; then
336	if test x"$ASCIIDOC" = x ; then
337		with_mandoc="no"
338		problem_mandoc=": No asciidoctor found in PATH"
339	elif test x"$SED" = x ; then
340		with_mandoc="no"
341		problem_mandoc=": No sed found in PATH"
342	elif test x"$HAVE_PERL_FOR_DOCS" = x0 ; then
343		with_mandoc="no"
344		problem_mandoc=": No perl found in PATH"
345	else
346		with_mandoc="yes"
347	fi
348fi
349AM_CONDITIONAL([FVWM_BUILD_MANDOC], [test x"$with_mandoc" = xyes])
350
351# ********* session management
352# Check the availability of SM; we don't have to add any extra libraries,
353# since -lSM -lICE are in X_PRE_LIBS when they exist.
354dnl [old check] AC_CHECK_LIB(SM, SmcOpenConnection, AC_DEFINE(SESSION), ,
355dnl [old check]            [$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
356
357problem_sm=""
358
359AC_ARG_ENABLE(sm,
360  AS_HELP_STRING([--disable-sm],[disable session management support]),
361  [ if test x"$enableval" = xyes; then
362    with_sm="yes, check"
363  else
364    with_sm="no"
365    problem_sm=": Explicitly disabled"
366  fi ],
367  [ with_sm="not specified, check" ]
368)
369
370if test ! x"$with_sm" = xno; then
371  dnl Uncomment the following and comment out AC_CHECK_LIB to get --with-sm-*
372  dnl $UNSET ac_cv_lib_SM_SmcOpenConnection
373  dnl $UNSET ac_cv_header_X11_SM_SMlib_h
374  dnl smr_CHECK_LIB(sm, SM, adds session management support, SmcOpenConnection,
375  dnl   X11/SM/SMlib.h,
376  dnl   [$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS], $X_CFLAGS)
377  dnl test "$sm_LIBS" && AC_DEFINE(SESSION)
378
379  $UNSET ac_cv_lib_SM_SmcOpenConnection
380  AH_TEMPLATE([SESSION],[Enables session management functionality.])
381  AC_CHECK_LIB(SM, SmcOpenConnection, with_sm=yes; AC_DEFINE(SESSION),
382    with_sm=no; problem_sm=": Failed to detect libSM",
383    [$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
384fi
385dnl AC_SUBST(sm_LIBS)
386dnl AC_SUBST(sm_CFLAGS)
387
388
389# Checking for optional libraries
390# Default is to use them if found; can be disable using --without
391# These are put up front so that if they are requested, but
392# configure fails to find them, we fail early.
393
394
395# ********* shape extension
396dnl smr_SWITCH(shape, shape extensions, on, SHAPE)
397AC_ARG_ENABLE(shape,
398  AS_HELP_STRING([--disable-shape],[disable shaped window support]),
399  [ if test x"$enableval" = xyes; then
400    with_shape="yes, check"
401  else
402    with_shape="no"
403    problem_shape=": Explicitly disabled"
404  fi ],
405  [ with_shape="not specified, check" ]
406)
407
408AH_TEMPLATE(SHAPE,
409[   Define if you want the Shaped window extensions.
410   Shaped window extensions seem to increase the window managers RSS
411   by about 60 Kbytes. They provide for leaving a title-bar on the window
412   without a border.
413   If you don't use shaped window extension, you can either make your
414   shaped windows undecorated, or live with a border and backdrop around
415   all your shaped windows (oclock, xeyes)
416
417   If you normally use a shaped window (xeyes or oclock), you might as
418   well compile this extension in, since the memory cost is  minimal in
419   this case (The shaped window shared libs will be loaded anyway). If you
420   don't normally use a shaped window, you have to decide for yourself.
421
422   Note: if it is compiled in, run time detection is used to make sure that
423   the currently running X server supports it.])
424if test ! x"$with_shape" = xno; then
425  $UNSET ac_cv_lib_Xext_XShapeQueryExtension
426  AC_CHECK_LIB(Xext, XShapeQueryExtension,
427               with_shape=yes; AC_DEFINE(SHAPE),
428               with_shape=no;
429               problem_shape=": Failed to detect Shape extension",
430               [$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
431fi
432
433# ********* MIT Shared Memory Extension
434AC_ARG_ENABLE(shm,
435  AS_HELP_STRING([--disable-shm],[disable MIT Shared Memory Extension]),
436  [ if test x"$enableval" = xyes; then
437    with_shm="yes, check"
438  else
439    with_shm="no"
440    problem_shm=": Explicitly disabled"
441  fi ],
442  [ with_shm="not specified, check" ]
443)
444
445AH_TEMPLATE([HAVE_XSHM],[Define if  MIT Shared Memory extension is used.])
446if test ! x"$with_shm" = xno; then
447  $UNSET ac_cv_lib_Xext_XShmQueryExtension
448  AC_CHECK_LIB(Xext, XShmQueryExtension,
449               with_shm=yes; AC_DEFINE(HAVE_XSHM),
450               with_shm=no;
451               problem_shm=": Can't detect MIT Shared Memory ext.",
452               [$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
453fi
454
455# Silently look for X11/XKBlib.h
456AH_TEMPLATE([HAVE_X11_XKBLIB_H],[Define if Xkb extension is used.])
457AC_CHECK_HEADER(X11/XKBlib.h, AC_DEFINE(HAVE_X11_XKBLIB_H))
458
459# TAILQ and friends
460AH_TEMPLATE([HAVE_TAILQ],[Check if tailq is present.])
461AC_CHECK_HEADER(queue.h, AC_DEFINE(HAVE_TAILQ))
462
463# libevent
464AH_TEMPLATE([HAVE_LIBEVENT],[Define if libevent is used.])
465PKG_CHECK_MODULES([libevent], [libevent >= 2.0],
466[
467	 AC_DEFINE(HAVE_LIBEVENT)
468	libevent_LIBS=`pkg-config --libs libevent`
469],
470[
471	 AC_MSG_ERROR([*** libevent >=2 not found.  Install its header files. ***])
472])
473AC_SUBST(libevent_LIBS)
474AC_SUBST(libevent_CFLAGS)
475
476# ********* XRandR
477AH_TEMPLATE([HAVE_XRANDR],[Define if XRandR library is used.])
478PKG_CHECK_MODULES([xrandr], [xrandr >= 1.5],
479[
480	 AC_DEFINE(HAVE_XRANDR)
481         XRandR_LIBS=-lXrandr
482],
483[
484	 AC_MSG_ERROR([*** XRandR not found.  Install its header files. ***])
485])
486
487AC_SUBST(XRandR_LIBS)
488AC_SUBST(XRandR_CFLAGS)
489
490# ********* xrender
491problem_xrender=""
492AC_ARG_ENABLE(xrender,
493  AS_HELP_STRING([--disable-xrender],[disable Xrender alpha-blend rendering]),
494  [ if test x"$enableval" = xyes; then
495    with_xrender="yes, check"
496  else
497    with_xrender="no"
498    problem_xrender=": Explicitly disabled"
499  fi ],
500  [ with_xrender="not specified, check" ]
501)
502
503AH_TEMPLATE([HAVE_XRENDER],[Define if Xrender library is used.])
504if test ! x"$with_xrender" = xno; then
505  $UNSET ac_cv_lib_Xrender_XRenderComposite
506  AC_CHECK_LIB(Xrender, XRenderComposite,
507    with_xrender=yes; Xrender_LIBS=-lXrender;
508    AC_DEFINE(HAVE_XRENDER),
509    with_xrender=no; Xrender_LIBS=
510    problem_xrender=": Failed to detect libXrender",
511    [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS])
512fi
513AC_SUBST(Xrender_LIBS)
514AC_SUBST(Xrender_CFLAGS)
515
516# ********* xcursor
517AH_TEMPLATE([HAVE_XCURSOR],[Define if Xcursor library is used.])
518xcursor_CFLAGS=""
519xcursor_LIBS=""
520AC_ARG_ENABLE(xcursor,
521  AS_HELP_STRING([--disable-xcursor],
522    [disable Xcursor ARGB/animated cursor loading]),
523  [ if test x"$enableval" = xno; then
524       with_xcursor=no
525       problem_xcursor=": Explicitly disabled"
526    fi ],
527)
528if test ! x"$with_xcursor" = xno; then
529   with_xcursor=no
530   if test ! x"$with_xrender" = xno; then
531      $UNSET ac_cv_lib_Xrender_XRenderCreateCursor
532      AC_CHECK_LIB(Xrender, XRenderCreateCursor, [
533         with_xcursor=yes
534      ],[
535         problem_xcursor=": Your libXrender version is too old"
536      ],
537      [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS])
538   else
539      problem_xcursor=": Need Xrender support"
540   fi
541fi
542if test x"$with_xcursor" = xyes ; then
543      $UNSET ac_cv_lib_Xcursor_XcursorImageLoadCursor
544      AC_CHECK_LIB(Xcursor, XcursorImageLoadCursor, [
545         AC_DEFINE(HAVE_XCURSOR)
546         Xcursor_LIBS=-lXcursor
547         problem_xcursor=""
548      ],[
549         with_xcursor=no
550         problem_xcursor=": Failed to detect libXcursor"
551      ],[$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS])
552fi
553AC_SUBST(Xcursor_CFLAGS)
554AC_SUBST(Xcursor_LIBS)
555
556# ********* xft
557problem_xft=""
558
559AC_ARG_ENABLE(xft,
560  AS_HELP_STRING([--disable-xft],[disable Xft anti-aliased font rendering]),
561  [ if test x"$enableval" = xyes; then
562    with_xft="yes, check"
563  else
564    with_xft="no"
565    problem_xft=": Explicitly disabled"
566  fi ],
567  [
568    with_xft="not specified, check"
569  ]
570)
571
572freetype_CFLAGS=""
573freetype_LIBS=""
574AH_TEMPLATE([HAVE_XFT],[Define if Xft library is used.])
575AH_TEMPLATE([HAVE_XFT2],[Define if Xft 2 library is used.])
576AH_TEMPLATE([HAVE_XFT_UTF8],[Define if Xft library can handle utf8 encoding])
577if test ! x"$with_xft" = xno; then
578  AC_MSG_CHECKING([whether pkg-config could find freetype2])
579  if "${PKG_CONFIG}" --exists freetype2; then
580    AC_MSG_RESULT([yes])
581    CFLAGS_FREETYPE=`"${PKG_CONFIG}" --cflags freetype2`
582    FREETYPE_LIBS=`"${PKG_CONFIG}" --libs freetype2`
583    freetype_CFLAGS="$CFLAGS_FREETYPE"
584    freetype_LIBS="$FREETYPE_LIBS"
585
586    have_freetype=yes
587  else
588  AC_MSG_RESULT([no])
589  have_freetype=no
590  fi
591
592  AC_SUBST(freetype_CFLAGS)
593  AC_SUBST(freetype_LIBS)
594
595  # check for fontconfig for Xft 2
596  have_fontconfig=no
597  if test ! x"$have_freetype" = xno ; then
598    AM_CHECK_FC(1.0.1)
599    if test x"$no_fc" = x ; then
600      have_fontconfig=yes
601      fontconfig_CFLAGS=`$PKG_CONFIG --cflags fontconfig`
602      fontconfig_LIBS=`$PKG_CONFIG --libs fontconfig`
603      CFLAGS="$CFLAGS $fontconfig_CFLAGS"
604      LIBS="$LIBS $fontconfig_LIBS"
605    else
606      have_fontconfig=no
607      problem_xft=": Can't detect fontconfig >= 1.0.1"
608    fi
609  fi
610
611  # now check for Xft 2
612  with_xft=no
613  if test ! x"$have_fontconfig" = xno ; then
614    # Xft 2
615    AM_CHECK_XFT(2.0.0)
616    if test x"$no_xft" = x; then
617      with_xft=yes
618      problem_xft=" (version 2)"
619      AC_DEFINE(HAVE_XFT2)
620      AC_DEFINE(HAVE_XFT)
621      AC_DEFINE(HAVE_XFT_UTF8)
622      Xft_LIBS=$XFT_LIBS
623      Xft_CFLAGS=$XFT_CFLAGS
624    else
625      problem_xft=": Can't detect Xft2, detected fontconfig"
626    fi
627  fi
628
629  # if Xft2 not detected check for Xft1
630  if test ! x"$have_freetype" = xno && test ! x"$with_xft" = xyes; then
631    #Xft 1
632    $UNSET ac_cv_lib_XftConfigSubstitute
633    $UNSET ac_cv_lib_Xft_XftFontOpen
634    $UNSET ac_cv_lib_Xft_XftDrawStringUtf8
635    AC_CHECK_LIB(Xft, XftFontOpen,
636      with_xft=yes, with_xft=no,
637      [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $FT2_LIBS $Xrender_LIBS])
638    if test x"$with_xft" = xyes ; then
639      AC_CHECK_LIB(Xft, XftConfigSubstitute, is_xft1=yes, is_xft1=no,
640        [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $FT2_LIBS $Xrender_LIBS])
641      if test x"$is_xft1" = xyes; then
642        Xft_LIBS="-lXft $FT2_LIBS"
643	Xft_CFLAGS="$Xft_CFLAGS $FT2_CFLAGS"
644        problem_xft=" (version 1)"
645        AC_DEFINE(HAVE_XFT)
646      else
647        with_xft=no
648        problem_xft=": Can't detect Xft 1 or fontconfig"
649      fi
650    else
651      problem_xft=": Can't detect Xft 1 or 2 and fontconfig"
652    fi
653    if test x"$with_xft" = xyes; then
654      AC_CHECK_LIB(Xft, XftDrawStringUtf8,
655        AC_DEFINE(HAVE_XFT_UTF8),,
656        [$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $FT2_LIBS $Xrender_LIBS])
657    fi
658  fi
659
660fi
661AC_SUBST(Xft_LIBS)
662AC_SUBST(Xft_CFLAGS)
663
664# ********* xpm
665problem_xpm=": Xpm library or header not found"
666
667$UNSET ac_cv_header_X11_xpm_h
668$UNSET ac_cv_lib_Xpm_XpmReadFileToXpmImage
669smr_CHECK_LIB(xpm, Xpm, for coloured or shaped icons,
670    XpmReadFileToXpmImage, X11/xpm.h,
671    [$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS], $X_CFLAGS)
672
673if test ! x"$xpm_LIBS" = x; then
674  # Check for proper version of Xpm -- from XEmacs 21.x configure.in
675  AC_MSG_CHECKING([for Xpm 3.4g or better])
676  my_CPPFLAGS="$CPPFLAGS"
677  my_LIBS="$LIBS"
678  CPPFLAGS="$CPPFLAGS $xpm_CFLAGS $X_CFLAGS"
679  LIBS="$LIBS $xpm_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
680  AC_TRY_RUN([#include <X11/xpm.h>
681   int main(int c, char **v) {
682   return c == 1 ? 0 :
683     XpmIncludeVersion != XpmLibraryVersion() ? 1 :
684     XpmIncludeVersion < 30407 ? 2 : 0 ;}],
685    [./conftest dummy_arg; xpm_status=$?;
686     if test x"$xpm_status" = x0; then
687       with_xpm=yes
688       problem_xpm=""
689     else
690       with_xpm=no;
691       if test x"$xpm_status" = x1; then
692	 problem_xpm=": Xpm library and header versions don't match"
693       elif test x"$xpm_status" = x2x; then
694	 problem_xpm=": Xpm library version is too old"
695       else
696	 problem_xpm=": Internal xpm detection logic error"
697       fi
698     fi],
699   [with_xpm=no; problem_xpm=": Xpm test error, see config.log"],
700   [echo $ac_n "cross compiling; assumed OK... $ac_c"])
701  AC_MSG_RESULT($with_xpm)
702  CPPFLAGS="$my_CPPFLAGS"
703  LIBS="$my_LIBS"
704
705  AH_TEMPLATE([XPM],[Define if Xpm library is used.])
706  if test x"$with_xpm" = xyes; then
707    AC_DEFINE(XPM)
708    # FVWMBANNER=FvwmBanner AC_SUBST(FVWMBANNER)
709    # FVWMSCRIPT=FvwmScript AC_SUBST(FVWMSCRIPT)
710  else
711    xpm_LIBS=
712    xpm_CFLAGS=
713  fi
714fi
715AC_SUBST(xpm_LIBS)
716AC_SUBST(xpm_CFLAGS)
717
718# ********* png
719png_LIBS=""
720png_CFLAGS=""
721
722AH_TEMPLATE([HAVE_PNG], [Define PNG])
723AC_ARG_ENABLE(png,
724    AS_HELP_STRING([--disable-png],
725		   [Disables libpng support.]),
726		   [with_png="$enableval"],
727		   [with_png="yes"])
728
729if test "$with_png" = no; then
730      AC_MSG_WARN([***
731		   disabling PNG support will mean the default
732		   configuration shipped with FVWM will be without icon
733		   support.  Be sure this is what you mean to do.
734		   ***])
735else
736	AC_MSG_CHECKING([for libpng...])
737	PKG_CHECK_MODULES([png], [libpng >= 1.2],
738	[
739	 AC_DEFINE(HAVE_PNG)
740	],
741	[
742	 AC_MSG_ERROR([***
743		       libpng not found, and --disable-png not given.
744		       It is recommended to use libpng so that PNG icons can
745		       be rendered by FVWM, which the default configuration
746		       file needs, as well as other third-party programs
747		       which generate menus, for example.
748
749		       If it is critical that FVWM does not link against
750		       libpng (perhaps due to size limitations of the
751		       binary), then use --disable-png
752		       ***])
753	])
754	# ** needed by the png support
755	AC_C_BIGENDIAN
756fi
757
758AC_SUBST(png_LIBS)
759AC_SUBST(png_CFLAGS)
760
761# ********* rsvg
762rsvg_min_version=2.13.92
763AH_TEMPLATE([HAVE_RSVG], [Define if librsvg library is used.])
764
765AC_ARG_ENABLE(rsvg,
766  AS_HELP_STRING([--disable-rsvg],
767    [disable scalable vector graphics (SVG images)]),
768  [ if test x"$enableval" = xno; then
769       with_rsvg=no
770       problem_rsvg=": Explicitly disabled"
771    fi ],
772)
773if test ! x"$with_rsvg" = xno; then
774   with_rsvg=no
775   if test ! x"$PKG_CONFIG" = xno ; then
776      AC_MSG_CHECKING(for librsvg - version >= $rsvg_min_version)
777      if $PKG_CONFIG --exists librsvg-2.0 ; then
778         if $PKG_CONFIG --exists "librsvg-2.0 >= $rsvg_min_version" ; then
779            AC_MSG_RESULT(yes)
780
781   	    AC_MSG_CHECKING(for cairo svg backend)
782            if $PKG_CONFIG --exists cairo-svg ; then
783               svg_packages="librsvg-2.0 cairo-svg"
784            elif $PKG_CONFIG --exists libsvg-cairo ; then
785               svg_packages="librsvg-2.0 libsvg-cairo"
786            elif $PKG_CONFIG --exists cairo ; then
787               svg_packages="librsvg-2.0 cairo"
788            else
789               svg_packages=""
790            fi
791            if test ! x"$svg_packages" = x ; then
792               AC_MSG_RESULT(yes)
793               rsvg_CFLAGS=`$PKG_CONFIG --cflags $svg_packages`
794               rsvg_LIBS=`$PKG_CONFIG --libs $svg_packages`
795               with_rsvg=yes
796            else
797               AC_MSG_RESULT(no)
798               AC_MSG_WARN([*** cairo was not found in the pkg-config search])
799               AC_MSG_WARN([*** path. Add the directory containing cairo.pc])
800               AC_MSG_WARN([*** to the PKG_CONFIG_PATH environment variable.])
801               problem_rsvg=": Cannot detect cairo backend"
802            fi
803         else
804            AC_MSG_RESULT(no)
805            AC_MSG_WARN([*** Your librsvg version is < $rsvg_min_version])
806            problem_rsvg=": Your librsvg version is too old"
807         fi
808      else
809         AC_MSG_RESULT(no)
810         AC_MSG_WARN([*** librsvg-2.0 was not found in the pkg-config search])
811         AC_MSG_WARN([*** path. Either librsvg is not installed or you need])
812         AC_MSG_WARN([*** to add the directory containing librsvg-2.0.pc to])
813         AC_MSG_WARN([*** the PKG_CONFIG_PATH environment variable.])
814         problem_rsvg=": librsvg library or header not found"
815      fi
816   else
817      problem_rsvg=": pkg-config not found"
818   fi
819fi
820if test x"$with_rsvg" = xyes ; then
821   AC_MSG_CHECKING(whether a librsvg program compiles and runs)
822   original_CFLAGS="$CFLAGS"
823   original_LIBS="$LIBS"
824   CFLAGS="$CFLAGS $rsvg_CFLAGS"
825   LIBS="$LIBS $rsvg_LIBS"
826   AC_TRY_RUN([
827      #include <librsvg/rsvg.h>
828      #include <librsvg/rsvg-cairo.h>
829      int main() {
830         RsvgHandle *rsvg;
831         g_type_init();
832         if(!(rsvg = rsvg_handle_new())) return 1;
833         g_object_unref(G_OBJECT(rsvg));
834         return 0;
835      }
836   ], [
837      AC_MSG_RESULT(yes)
838   ], [
839      AC_MSG_RESULT(no)
840      AC_MSG_WARN([*** The librsvg test program failed to run. If your system])
841      AC_MSG_WARN([*** has shared libraries outside the normal system library])
842      AC_MSG_WARN([*** path, you need to make sure that the LD_LIBRARY_PATH])
843      AC_MSG_WARN([*** (or the like) environment variable is correctly set.])
844      with_rsvg=no
845      problem_rsvg=": Failed to run test program"
846   ], [echo $ac_n "cross compiling; assumed OK... $ac_c"])
847   CFLAGS="$original_CFLAGS"
848   LIBS="$original_LIBS"
849fi
850if test x"$with_rsvg" = xyes ; then
851   AC_DEFINE(HAVE_RSVG)
852   problem_rsvg=""
853else
854   rsvg_CFLAGS=""
855   rsvg_LIBS=""
856fi
857AC_SUBST(rsvg_CFLAGS)
858AC_SUBST(rsvg_LIBS)
859
860# ********* readline
861with_readline=no
862problem_readline=": Both termcap and ncurses disabled"
863
864smr_ARG_WITHLIB(termcap, , to accomplish readline)
865AH_TEMPLATE([HAVE_READLINE],[Define if readline is available.])
866if test ! x"$with_termcap" = xno; then
867  # Forget cached values, so user can re-run configure
868  $UNSET ac_cv_header_readline_history_h
869  $UNSET ac_cv_lib_readline_readline
870  AC_MSG_CHECKING([with termcap])
871  smr_CHECK_LIB(readline, , line editing/history, readline, readline/history.h,
872    $termcap_LIBS)
873  if test ! x"$readline_LIBS" = x; then
874    with_readline=yes
875    readline_LIBS="$readline_LIBS $termcap_LIBS"
876    AC_DEFINE(HAVE_READLINE)
877  fi
878fi
879smr_ARG_WITHLIB(ncurses, , to accomplish readline)
880if test ! x"$with_ncurses" = xno && test x"$readline_LIBS" = x; then
881  # We couldn't use readline with termcap; try with ncurses?
882  # Doesn't this seem a hacky way to do this??
883  # unset cached values from last check...
884  $UNSET ac_cv_header_readline_history_h
885  $UNSET ac_cv_lib_readline_readline
886  AC_MSG_CHECKING([with ncurses])
887  dnl We can not call smr_CHECK_LIB twice here without having the usage twice.
888  dnl old_LIBS=$LIBS
889  dnl AC_CHECK_LIB(readline, readline, , , $ncurses_LIBS)
890  dnl LIBS=$old_LIBS
891  dnl if test x"$ac_cv_lib_readline_readline" = xyes; then
892  dnl   AC_CHECK_HEADERS(readline/history.h)
893  dnl   if test x"$ac_cv_header_readline_history_h" = xyes; then
894  dnl     with_readline=yes
895  dnl     readline_LIBS="$readline_LIBS $ncurses_LIBS"
896  dnl     AC_DEFINE(HAVE_READLINE)
897  dnl   fi
898  dnl fi
899  smr_CHECK_LIB(readline, , line editing/history, readline, readline/history.h,
900    $ncurses_LIBS)
901  if test ! x"$readline_LIBS" = x; then
902    with_readline=yes
903    readline_LIBS="$readline_LIBS $ncurses_LIBS"
904    AC_DEFINE(HAVE_READLINE)
905  fi
906fi
907dnl We need to check if we have GNU readline or BSD editline
908AH_TEMPLATE([HAVE_GNU_READLINE],[Define if readline has full GNU interface])
909if test x"$with_readline" = xyes; then
910   AC_CHECK_LIB(readline, append_history, AC_DEFINE(HAVE_GNU_READLINE), [], $readline_LIBS)
911fi
912AC_SUBST(readline_LIBS)
913AC_SUBST(readline_CFLAGS)
914
915
916# Check if Xsetlocale() is available or not.
917AH_TEMPLATE([X_LOCALE],[Enables to use setlocale() provided by X])
918AC_CHECK_LIB(X11, _Xsetlocale, AC_DEFINE(X_LOCALE),, $X_LIBS -lX11)
919
920# Check if Xsetlocale() is available or not.
921AH_TEMPLATE([HAVE_XOUTPUT_METHOD],[Enable X output method])
922AC_CHECK_LIB(X11, XOpenOM, AC_DEFINE(HAVE_XOUTPUT_METHOD),, $X_LIBS -lX11)
923
924# ******** iconv
925with_iconv=no
926with_iconv_type=no
927with_lib_iconv=no
928with_sys_iconv=no
929problem_iconv=": Explicitly disabled"
930
931AC_ARG_ENABLE(iconv,
932  AS_HELP_STRING([--disable-iconv],
933    [disable support for iconv character conversion]),
934  [ac_cv_iconv="$enableval"],
935  [ac_cv_iconv="yes"])
936
937AH_TEMPLATE([USE_LIBICONV],
938  [define if we use libiconv (not needed in general: for example iconv is
939  native with recent glibc)])
940AH_TEMPLATE([HAVE_ICONV],
941  [Define if iconv (in the libc) or libiconv is available])
942if test ! x"$ac_cv_iconv" = xno; then
943  # * first check for gnu libiconv
944  $UNSET ac_cv_header_libiconv_h
945  $UNSET ac_cv_lib_libiconv_libiconv_open
946  smr_CHECK_LIB(
947  	iconv, , if not found sys iconv is used, libiconv_open, iconv.h)
948  if test ! x"$iconv_LIBS" = x; then
949     AC_DEFINE(USE_LIBICONV)
950     with_lib_iconv=yes
951  fi
952  AC_SUBST(iconv_LIBS)
953  AC_SUBST(iconv_CFLAGS)
954
955  # * check for system iconv
956
957  AC_CHECK_FUNC(iconv_open, with_sys_iconv=yes)
958
959  if test x"$with_lib_iconv" = xyes && test x"$with_sys_iconv" = xyes; then
960     AC_MSG_WARN([***  Both system iconv and libiconv found: use libiconv])
961     AC_MSG_WARN([***  Use --with-iconv-library=no to use the system iconv])
962  fi
963
964  # * libiconv found check for libcharset to get the good iconv charset
965  if test x"$with_lib_iconv" = xyes; then
966     CHECK_LIBCHARSET
967  fi
968
969  test x"$with_lib_iconv" = xyes -o x"$with_sys_iconv" = xyes &&
970	 with_iconv=yes && problem_iconv=""
971  test x"$with_lib_iconv" = xyes && with_iconv_type="yes (libiconv)"
972  test x"$with_sys_iconv" = xyes && with_iconv_type="yes (from C library)"
973
974  if test x"$with_iconv" = xno; then
975    AC_MSG_WARN([*** ])
976    AC_MSG_WARN([*** No iconv() implementation found in C library or libiconv])
977    AC_MSG_WARN([*** Please install libiconv ftp://ftp.gnu.org/pub/gnu/libiconv/])
978    AC_MSG_WARN([*** ])
979  fi
980
981  if test x"$with_iconv" = xyes; then
982     AC_DEFINE(HAVE_ICONV)
983     ICONV_SECOND_ARG
984  fi
985fi
986AH_VERBATIM([_HAVE_LIBCHARSET],
987[#ifdef USE_LIBICONV
988/* define to use locale_charset in the place of nl_langinfog if libiconv
989 * is used */
990#undef HAVE_LIBCHARSET
991#endif])
992
993
994# ******** nl_langinfo and CODESET
995AH_TEMPLATE([HAVE_CODESET],[Have nl_langinfo (CODESET)])
996AC_MSG_CHECKING([for nl_langinfo (CODESET)])
997AC_TRY_COMPILE([#include <langinfo.h>
998#include <locale.h>],
999[char *codeset = nl_langinfo(CODESET); setlocale(LC_CTYPE, "");],
1000   AC_DEFINE(HAVE_CODESET)
1001   have_codeset=yes,
1002   have_codeset=no)
1003AC_MSG_RESULT($have_codeset)
1004
1005
1006# ********* fribidi
1007AC_ARG_ENABLE(bidi,
1008  AS_HELP_STRING([--disable-bidi],[disable bi-directional text support]),
1009  [ if test x"$enableval" = xyes; then
1010    with_bidi="yes, check"
1011  else
1012    with_bidi="no"
1013  problem_bidi=": Explicitly disabled"
1014  fi ],
1015  [ with_bidi="not specified, check" ]
1016)
1017
1018fribidi_min_version=0.19.2
1019if test ! x"$with_bidi" = xno; then
1020  AC_ARG_WITH(fribidi-bindir,
1021    AS_HELP_STRING([--with-fribidi-bindir=DIR],
1022      [directory of fribidi-config if not in PATH]),
1023    FRIBIDI_BINDIR="$withval", FRIBIDI_BINDIR=".")
1024  if test ! x"$PKG_CONFIG" = xno && $PKG_CONFIG --exists "fribidi >= $fribidi_min_version"; then
1025    FRIBIDI_CONFIG="$PKG_CONFIG fribidi"
1026  else
1027    AC_PATH_PROG(FRIBIDI_CONFIG, fribidi-config,, [$FRIBIDI_BINDIR:$PATH])
1028  fi
1029
1030  if test x"$FRIBIDI_CONFIG" = x; then
1031    with_bidi=no
1032    problem_bidi=": pkgconfig fribidi:  fribidi version >= $fribidi_min_version needed."
1033  else
1034    Bidi_CFLAGS=`$FRIBIDI_CONFIG --cflags`
1035    Bidi_LIBS=`$FRIBIDI_CONFIG --libs`
1036    AC_CHECK_LIB(fribidi, fribidi_log2vis,
1037      with_bidi=yes; problem_bidi=,
1038      with_bidi=no; problem_bidi=": No good libs via $FRIBIDI_CONFIG",
1039      [$Bidi_LIBS $Bidi_CFLAGS])
1040  fi
1041fi
1042
1043if test ! x"$with_bidi" = xno; then
1044  fribidi_in_path=yes
1045  ac_save_LIBS="$LIBS"
1046  LIBS="$LIBS $Bidi_LIBS"
1047  AC_TRY_RUN([#include <stdlib.h>
1048#include <fribidi/fribidi.h>
1049int main()
1050{
1051	FriBidiChar *logical_unicode_str =
1052		(FriBidiChar *)malloc((4 + 1) * sizeof(FriBidiChar));
1053	fribidi_charset_to_unicode(
1054		fribidi_parse_charset("iso8859-8"), "test", 4,
1055		logical_unicode_str);
1056	return 0;
1057}
1058], [:], [fribidi_in_path=no])
1059  LIBS="$ac_save_LIBS"
1060  if test ! x"$fribidi_in_path" = xyes; then
1061    ac_save_CFLAGS="$CFLAGS"
1062    ac_save_LIBS="$LIBS"
1063    CFLAGS="$CFLAGS $Bidi_CFLAGS"
1064    LIBS="$LIBS $Bidi_LIBS"
1065  AC_TRY_RUN([#include <stdlib.h>
1066#include <fribidi/fribidi.h>
1067int main()
1068{
1069	FriBidiChar *logical_unicode_str =
1070		(FriBidiChar *)malloc((4 + 1) * sizeof(FriBidiChar));
1071	fribidi_charset_to_unicode(
1072		fribidi_parse_charset("iso8859-8"), "test", 4,
1073		logical_unicode_str);
1074	return 0;
1075}
1076], [:], [with_bidi=no; problem_bidi=": Bad fribidi version, see config.log"])
1077    CFLAGS="$ac_save_CFLAGS"
1078    LIBS="$ac_save_LIBS"
1079  fi
1080  if test ! x"$fribidi_in_path" = xno; then
1081    Bidi_CFLAGS=
1082    Bidi_LIBS=-lfribidi
1083  fi
1084fi
1085
1086AH_TEMPLATE([HAVE_BIDI],[Define if fribidi library is used.])
1087AH_TEMPLATE([FRIBIDI_CHARSET_SPELLING],
1088  [Support fribidi-0.10.4 and older with "CHARSET" spelling.])
1089if test x"$with_bidi" = xno; then
1090  Bidi_CFLAGS=
1091  Bidi_LIBS=
1092else
1093  AC_DEFINE(HAVE_BIDI)
1094  AC_TRY_RUN([#include <fribidi/fribidi.h>
1095    int main(int c, char **v) {
1096      return FRIBIDI_CHARSET_NOT_FOUND * 0;
1097    }
1098  ], [AC_DEFINE(FRIBIDI_CHARSET_SPELLING)])
1099fi
1100AH_VERBATIM([_FRIBIDI_CHARSET_SPELLING],
1101[#ifdef FRIBIDI_CHARSET_SPELLING
1102#  define FRIBIDI_CHAR_SET_NOT_FOUND FRIBIDI_CHARSET_NOT_FOUND
1103#endif])
1104
1105AC_SUBST(Bidi_LIBS)
1106AC_SUBST(Bidi_CFLAGS)
1107
1108
1109# ********* perllib
1110with_perllib="yes"
1111problem_perllib=""
1112FVWM_PERLLIB=perllib
1113AC_ARG_ENABLE(perllib,
1114  AS_HELP_STRING([--disable-perllib],[disable installing fvwm perl library]),
1115  [ if test x"$enableval" = xno; then
1116    with_perllib="no"
1117    problem_perllib=": Explicitly disabled"
1118    FVWM_PERLLIB=""
1119  fi ],
1120)
1121AC_SUBST(FVWM_PERLLIB)
1122
1123# ******* gettext
1124ALL_LINGUAS="ar da de fr sv_SE zh_CN ru es"
1125FVWM_DOMAIN="fvwm"
1126FVWMSCRIPT_DOMAIN="FvwmScript"
1127ALL_DOMAINS="$FVWM_DOMAIN $FVWMTASKBAR_DOMAIN $FVWMSCRIPT_DOMAIN"
1128
1129AC_SUBST(ALL_LINGUAS)
1130AC_SUBST(FVWM_DOMAIN)
1131AC_SUBST(FVWMTASKBAR_DOMAIN)
1132AC_SUBST(FVWMSCRIPT_DOMAIN)
1133AC_SUBST(ALL_DOMAINS)
1134
1135LOCALEDIR="$FVWM_DATADIR/locale"
1136with_gettext="yes"
1137problem_gettext=""
1138
1139AC_ARG_ENABLE(nls,
1140  AS_HELP_STRING([--disable-nls],[do not use Native Language Support]),
1141  [ if test x"$enableval" = xno; then
1142    with_gettext="no"
1143    problem_gettext=": Explicitly disabled"
1144  fi ],
1145)
1146
1147AH_TEMPLATE([HAVE_NLS],
1148  [Define to 1 if translation of program messages to the user's native
1149  language is requested.])
1150if test ! x"$with_gettext" = xno; then
1151  AM_GNU_FGETTEXT
1152  if test x"$USE_NLS" = "xyes"; then
1153    AC_DEFINE(HAVE_NLS, 1)
1154  else
1155    with_gettext="no"
1156    problem_gettext=": Failed to detected GNU gettext"
1157  fi
1158else
1159  USE_NLS=no
1160fi
1161
1162# libs and buil
1163AC_SUBST(intl_LIBS)
1164AC_SUBST(intl_CFLAGS)
1165AC_SUBST(USE_NLS)
1166AC_SUBST(POSUB)
1167AC_SUBST(LOCALEDIR)
1168AC_SUBST(MKINSTALLDIRS)
1169# programs for devel
1170AC_SUBST(XGETTEXT)
1171AC_SUBST(GMSGFMT)
1172AC_SUBST(MSGMERGE)
1173AC_SUBST(MSGFMT)
1174AC_SUBST(MSGUNIQ)
1175#catalogs
1176AC_SUBST(INST_LINGUAS)
1177AC_SUBST(CATALOGS)
1178AC_SUBST(POFILES)
1179AC_SUBST(GMOFILES)
1180AC_SUBST(UPDATEPOFILES)
1181AC_SUBST(DUMMYPOFILES)
1182AC_SUBST(CATOBJEXT)
1183
1184# Check for REQUIRED headers and functions before going any
1185# further.
1186
1187# The module interface uses variadic functions for message passing.
1188AC_CHECK_HEADERS(stdarg.h)
1189AC_CHECK_FUNCS(vfprintf)
1190if test x$ac_cv_header_stdarg_h = xno -o \
1191        $ac_cv_func_vfprintf = no; then
1192     AC_MSG_ERROR([stdarg.h and vfprintf required])
1193fi
1194
1195# For reaping children, fvwm needs either waitpid() or wait3()
1196# Some extra modules may need wait4() too
1197AC_CHECK_FUNCS(waitpid)
1198if test x$ac_cv_func_waitpid = xno; then
1199    AC_CHECK_FUNCS(wait3 wait4)
1200    if test x$ac_cv_func_wait3 = xno; then
1201        AC_MSG_ERROR([Either waitpid or wait3 function is required])
1202    fi
1203fi
1204
1205# C89/C99 signal handling
1206AC_CHECK_FUNCS(sigsetjmp siglongjmp)
1207
1208# Finish checking for programs.
1209AC_PROG_INSTALL
1210AC_PROG_LN_S
1211AC_PROG_MAKE_SET
1212AC_PROG_RANLIB
1213dnl lex+yacc now only needed for FvwmScript developers when syntax is changed
1214dnl AM_PROG_LEX
1215dnl AC_PROG_YACC
1216
1217# Checks for header files.
1218AC_HEADER_STDC
1219AC_HEADER_SYS_WAIT
1220AC_CHECK_HEADERS(stdlib.h fcntl.h limits.h malloc.h string.h memory.h unistd.h)
1221AC_CHECK_HEADERS(stdint.h inttypes.h)
1222AC_CHECK_HEADERS(getopt.h sys/select.h sys/systeminfo.h sys/time.h)
1223
1224# Checks for typedefs, structures, and compiler characteristics.
1225AC_C_CONST
1226AC_C_INLINE
1227AC_TYPE_OFF_T
1228AC_TYPE_PID_T
1229AC_TYPE_SIZE_T
1230AC_HEADER_TIME
1231dnl AC_STRUCT_TM
1232AC_TYPE_SIGNAL
1233AC_TYPE_INT16_T
1234AC_TYPE_UINT16_T
1235
1236# Checks for library functions.
1237AC_FUNC_STRFTIME
1238AC_FUNC_SETPGRP
1239AC_CHECK_FUNCS(gettimeofday mkfifo putenv setvbuf socket waitpid)
1240AC_CHECK_FUNCS(strdup strstr strtol memmove memcpy strchr sysconf uname div)
1241AC_CHECK_FUNCS(sigaction siginterrupt getpwuid)
1242AC_CHECK_FUNCS(setpgrp setpgid)
1243AC_CHECK_FUNCS(lstat)
1244
1245
1246
1247pds_CHECK_TYPE(sig_atomic_t, int, [#include <signal.h>], [Specify a type for sig_atomic_t if it's not available.])
1248
1249if test x$ac_cv_func_setvbuf = xyes; then
1250  AC_FUNC_SETVBUF_REVERSED
1251fi
1252
1253AC_FUNC_SELECT
1254if test ! x"$ac_cv_func_select" = xyes; then
1255  AC_MSG_ERROR([select required])
1256fi
1257
1258# check for mkstemp, see the discution on this subject on the fvwm workers
1259# list (2001-02-16 and 2001-02-24)
1260AM_SAFETY_CHECK_MKSTEMP
1261
1262# ********* IMLIB, GNOME
1263# Check the availability of gdk-imlib
1264AH_TEMPLATE([GDK_IMLIB],[Define if gdk-imlib is used])
1265AM_PATH_GDK_IMLIB(1.8.0, AC_DEFINE(GDK_IMLIB))
1266if test x"$no_imlib" = x; then
1267  with_gdkimlib=yes
1268  problem_gdkimlib=""
1269else
1270  with_gdkimlib=no
1271  problem_gdkimlib=": Failed on gdk-imlib, see config.log"
1272fi
1273
1274# Define some compatibility macros needed for config.h.
1275mg_DEFINE_IF_NOT([#include <X11/keysym.h>],
1276  [defined XK_Page_Up && defined XK_Page_Down],
1277  [COMPAT_OLD_KEYSYMDEF], [$X_CFLAGS],
1278  [Old AIX systems (3.2.5) don't define some common keysyms.])
1279AH_VERBATIM([_COMPAT_OLD_KEYSYMDEF],
1280[#ifdef COMPAT_OLD_KEYSYMDEF
1281#  define XK_Page_Up   XK_Prior
1282#  define XK_Page_Down XK_Next
1283#endif])
1284
1285# Allow building with dmalloc.  Do this last to avoid screwing up any
1286# other checks above.
1287case "$ac_cv_dmalloc" in
1288  yes) AC_CHECK_HEADERS(dmalloc.h)
1289       AC_CHECK_LIB(dmalloc, dmalloc_shutdown)
1290       CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK" ;;
1291esac
1292
1293
1294# Allow building with efence.
1295case "$ac_cv_efence" in
1296  yes) AC_CHECK_LIB(efence, malloc) ;;
1297esac
1298
1299# some explicit definitions for config.h file
1300AH_VERBATIM([_ZEND_EXPLICIT_DEFINITIONS],
1301[
1302/**
1303 * The next few defines are options that are only changed from their values
1304 * shown here on systems that _don't_ use the configure script.
1305 **/
1306
1307/* Define if the X11 ConnectionNumber is actually a file descriptor. */
1308#define HAVE_X11_FD 1
1309
1310/* Define if fork() has unix semantics.  On VMS, no child process is created
1311   until after a successful exec(). */
1312#define FORK_CREATES_CHILD 1
1313
1314/* Suffix for executable filenames; NULL if no extension needed. */
1315#define EXECUTABLE_EXTENSION NULL
1316
1317/* Define to remove the extension from executable pathnames before calling
1318   exec(). */
1319#undef REMOVE_EXECUTABLE_EXTENSION
1320
1321/* Enables the "MiniIcon" Style option to specify a small pixmap which
1322 * can be used as one of the title-bar buttons, shown in window list,
1323 * utilized by modules, etc.  Requires PIXMAP_BUTTONS to be defined
1324 * (see below). */
1325/* #undef MINI_ICONS */
1326/* NOTE: hard coded to 1 */
1327#if 1
1328#define FMiniIconsSupported 1
1329#else
1330#define FMiniIconsSupported 0
1331#endif
1332
1333#if RETSIGTYPE != void
1334#define SIGNAL_RETURN return 0
1335#else
1336#define SIGNAL_RETURN return
1337#endif
1338
1339/* Allow GCC extensions to work, if you have GCC. */
1340#ifndef __attribute__
1341/* This feature is available in gcc versions 2.5 and later. */
1342#  if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
1343#    define __attribute__(x)
1344#  endif
1345/* The __-protected variants of `format' and `printf' attributes
1346 * are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
1347#  if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
1348#    define __format__ format
1349#    define __printf__ printf
1350#  endif
1351#endif
1352
1353#ifdef HAVE_STRING_H
1354#  include <string.h>
1355#endif
1356#ifdef HAVE_STRINGS_H
1357#  include <strings.h>
1358#endif
1359#ifdef HAVE_MEMORY_H
1360#  include <memory.h>
1361#endif
1362#ifdef HAVE_STDLIB_H
1363#  include <stdlib.h>
1364#endif
1365
1366#if defined (HAVE_MALLOC_H) && !defined (__FreeBSD__) && !defined (__OpenBSD__) && !defined(__NetBSD__)
1367#  include <malloc.h>
1368#endif
1369#ifdef HAVE_FCNTL_H
1370#  include <fcntl.h>
1371#endif
1372#ifndef HAVE_STRCHR
1373#  define strchr(_s,_c)   index((_s),(_c))
1374#  define strrchr(_s,_c)  rindex((_s),(_c))
1375#endif
1376
1377#ifndef HAVE_MEMCPY
1378#  define memcpy(_d,_s,_l)  bcopy((_s),(_d),(_l))
1379#endif
1380#ifndef HAVE_MEMMOVE
1381#  define memmove(_d,_s,_l) bcopy((_s),(_d),(_l))
1382#endif
1383
1384#if HAVE_SYS_TYPES_H
1385#  include <sys/types.h>
1386#endif
1387
1388#ifndef HAVE_TAILQ
1389#	include <sys/queue.h>
1390#endif
1391
1392#if HAVE_UNISTD_H
1393#  include <unistd.h>
1394#endif
1395
1396#ifndef min
1397#  define min(a,b) (((a)<(b)) ? (a) : (b))
1398#endif
1399#ifndef max
1400#  define max(a,b) (((a)>(b)) ? (a) : (b))
1401#endif
1402#ifndef abs
1403#  define abs(a) (((a)>=0)?(a):-(a))
1404#endif
1405
1406#include "libs/defaults.h"
1407
1408#ifndef O_NOFOLLOW
1409#define O_NOFOLLOW 0
1410#endif
1411
1412#ifdef HAVE_LSTAT
1413#define DO_USE_LSTAT 1
1414#define fvwm_lstat(x,y) lstat(x,y)
1415#else
1416#define DO_USE_LSTAT 0
1417#define fvwm_lstat(x,y) -1
1418#endif
1419
1420/* A macro that touches a variable in a compiler independent way to suppress
1421 * warnings. */
1422#define SUPPRESS_UNUSED_VAR_WARNING(x) \
1423do { void *p; p = (void *)&x; (void)p; } while (0);
1424
1425#ifndef HAVE_STRLCPY
1426#   include "libs/strlcpy.h"
1427#endif
1428
1429#ifndef HAVE_ASPRINTF
1430int	asprintf(char **, const char *, ...);
1431int     vasprintf(char **, const char *, va_list);
1432#endif
1433
1434#include "libs/log.h"
1435])
1436
1437# mainly for fvwm-config
1438AC_SUBST(with_bidi)
1439AC_SUBST(with_gdkimlib)
1440AC_SUBST(with_gettext)
1441AC_SUBST(with_iconv)
1442AC_SUBST(with_perllib)
1443AC_SUBST(with_png)
1444AC_SUBST(with_rsvg)
1445AC_SUBST(with_readline)
1446AC_SUBST(with_shape)
1447AC_SUBST(with_shm)
1448AC_SUBST(with_sm)
1449AC_SUBST(with_xcursor)
1450AC_SUBST(with_xft)
1451AC_SUBST(with_xrandr)
1452AC_SUBST(with_xrender)
1453AC_SUBST(with_xpm)
1454
1455dnl with autoconf <2.60 this is needed
1456AC_SUBST(datarootdir)
1457AC_SUBST(docdir)
1458
1459AC_OUTPUT(
1460	Makefile
1461	libs/Makefile
1462	fvwm/Makefile
1463	modules/Makefile
1464dnl
1465dnl	bin/fvwm-menu-directory.1
1466dnl	bin/fvwm-menu-xlock.1
1467dnl	bin/fvwm-perllib.1
1468dnl
1469	bin/Makefile
1470	bin/FvwmCommand
1471	bin/FvwmPrompt/Makefile
1472	bin/fvwm-config
1473	bin/fvwm-perllib
1474	bin/fvwm-menu-xlock
1475	bin/fvwm-menu-directory
1476	bin/fvwm-menu-desktop
1477	bin/fvwm-convert-2.6
1478dnl
1479	utils/Makefile
1480	perllib/Makefile
1481	perllib/General/Makefile
1482	perllib/FVWM/Makefile
1483	perllib/FVWM/Module/Makefile
1484	perllib/FVWM/Tracker/Makefile
1485	perllib/FVWM/Module.pm
1486	default-config/Makefile
1487	doc/Makefile
1488	po/Makefile
1489dnl
1490	modules/FvwmAnimate/Makefile
1491	modules/FvwmAuto/Makefile
1492	modules/FvwmBacker/Makefile
1493	modules/FvwmButtons/Makefile
1494	modules/FvwmConsole/Makefile
1495	modules/FvwmEvent/Makefile
1496	modules/FvwmForm/Makefile
1497	modules/FvwmIconMan/Makefile
1498	modules/FvwmIdent/Makefile
1499	modules/FvwmMFL/Makefile
1500	modules/FvwmPager/Makefile
1501	modules/FvwmPerl/Makefile
1502	modules/FvwmPerl/FvwmPerl
1503	modules/FvwmRearrange/Makefile
1504	modules/FvwmScript/Makefile
1505	modules/FvwmScript/Scripts/Makefile
1506	modules/FvwmScript/Widgets/Makefile
1507)
1508
1509# ---------------------------------------------------------------------------
1510# Original config.status is patched to make generated scripts executable.
1511sed '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 && \
1512mv config.status-t config.status
1513chmod +x config.status
1514# ---------------------------------------------------------------------------
1515
1516# ---------------------------------------------------------------------------
1517cat >config.status-t <<EOF
1518#! /bin/sh
1519
1520# Original config.status is patched to satisfy processing *.in with 'make -j'.
1521# This bug seems to be partially fixed in autoconf-2.50 (not in all places).
1522UNIQUE_POSTFIX=\$\$
1523
1524EOF
1525sed 's/conftest/conftest\${UNIQUE_POSTFIX}/g' <config.status >>config.status-t && \
1526mv config.status-t config.status
1527chmod +x config.status
1528# ---------------------------------------------------------------------------
1529
1530eval my_bindir="`eval echo ${bindir}`"
1531eval my_mandir="`eval echo ${mandir}`"
1532eval my_moddir="`eval echo ${FVWM_MODULEDIR}`"; eval my_moddir="$my_moddir"
1533eval my_datdir="`eval echo ${FVWM_DATADIR}`"
1534eval my_docdir="`eval echo ${FVWM_DOCDIR}`"
1535eval my_plldir="`eval echo ${FVWM_PERLLIBDIR}`"
1536test x"$FVWM_PERLLIB" = x && my_plldir="(Not installed) $my_plldir"
1537eval my_localedir="`eval echo ${LOCALEDIR}`"
1538test x"$USE_NLS" = xno && my_localedir="(Not installed) $my_localdir"
1539
1540echo "
1541Fvwm3 Configuration:
1542
1543  Version:     $VERSION ($VERSIONINFO)
1544
1545  Executables: $my_bindir
1546  Man pages:   $my_mandir
1547  Modules:     $my_moddir
1548  Data files:  $my_datdir
1549  Doc files:   $my_docdir
1550  Perl lib:    $my_plldir
1551  Locale msg:  $my_localedir $INST_LINGUAS
1552
1553  With Asian bi-direct. text support? $with_bidi$problem_bidi
1554  With Gettext Native Lang support?   $with_gettext$problem_gettext
1555  With Iconv support?                 $with_iconv_type$problem_iconv
1556  With ReadLine sup. in FvwmConsole?  $with_readline$problem_readline
1557  With Shaped window support?         $with_shape$problem_shape
1558  With Shared memory for XImage?      $with_shm$problem_shm
1559  With Session Management support?    $with_sm$problem_sm
1560  With SVG image support?             $with_rsvg$problem_rsvg
1561  With Xcursor support?               $with_xcursor$problem_xcursor
1562  With Xft anti-alias font support?   $with_xft$problem_xft
1563  With XPM image support?             $with_xpm$problem_xpm
1564  With Xrender image support?         $with_xrender$problem_xrender
1565  With Golang support?                $with_golang$problem_golang
1566  Build man pages?                    $with_mandoc$problem_mandoc
1567
1568"
1569case "$ac_cv_dmalloc" in
1570  yes) echo "  DMALLOC heap debugging library enabled." ;;
1571esac
1572case "$ac_cv_efence" in
1573  yes) echo "  EFENCE debugging library enabled." ;;
1574esac
1575