2 dnl Window Maker autoconf input.
4 dnl Process with: aclocal; autoconf; automake
7 dnl Shared library generation stuff taken from configure script from zlib
11 AC_INIT(src/WindowMaker.h)
13 AM_INIT_AUTOMAKE(WindowMaker, 0.20.2)
16 dnl Shared Library Versions
22 dnl configure/build bundled libraries
23 dnl ===================================
24 AC_CONFIG_SUBDIRS(libPropList)
27 AM_CONFIG_HEADER(src/config.h)
30 dnl Checks for host/os name
31 dnl =======================
35 dnl Checks for programs.
36 dnl ===================
43 AC_PROG_GCC_TRADITIONAL
46 dnl Checks for library functions.
47 dnl ============================
53 AC_CHECK_FUNCS(gethostname gettimeofday select poll strerror strncasecmp setpgid)
56 AC_PATH_PROG(CPP_PATH, cpp, notfound,
57 /lib:/usr/bin:/bin:/usr/lib:/usr/ccs/lib:$PATH)
60 dnl Tell stupid Solaris cpp that the files it will process have C++ like syntax
61 dnl RedHat 5.x is broken too, so it won't make a symlink from cpp to the
62 dnl standard locations
64 if test "$CPP_PATH" = "/usr/ccs/lib/cpp" -o "$CPP_PATH" = "notfound" ; then
65 if test "$GCC" = "yes"; then
66 CPP_PATH="gcc -E -x c"
68 if test "$CPP_PATH" = "/usr/ccs/lib/cpp"; then
69 CPP_PATH="$CPP_PATH -B"
71 echo "cpp, the C preprocessor was not found in your system."
72 echo "Create a symbolic link from it to /lib/cpp and rerun configure"
77 AC_DEFINE_UNQUOTED(CPP_PATH, "$CPP_PATH")
90 AC_CHECK_FUNC(gettext, [HAVEGETTEXT="yes"],
91 AC_CHECK_LIB(intl, gettext, [INTLIBS="-lintl" HAVEGETTEXT="yes"],
94 AC_CHECK_PROG(XGETTEXT, xgettext, xgettext)
96 if test "$XGETTEXT" != ""; then
97 if $XGETTEXT --help 2>&1 | grep illegal >/dev/null ; then
98 echo "xgettext isn't GNU version"
103 if test "$LINGUAS" != ""; then
104 if test "$XGETTEXT" != "" -a "$HAVEGETTEXT" != ""; then
107 # if test "$LINGUAS" = ""; then
108 # ling=` (cd src/po; /bin/ls *.po) `
110 # lcode=`basename $l .po`
111 # LINGUAS="$LINGUAS $lcode"
114 echo "xgettext and gettext() exist; will build i18n support for $LINGUAS"
119 echo "xgettext and libintl.a don't both exist; will not build i18n support"
129 dnl The Tower of Babel
130 dnl ==================
132 dnl List of supported locales
133 dnl -------------------------
134 supported_locales="cs de es fr gl it ja ko nl no pt ru se tr fi hr el pl ro"
135 supported_wprefs_locales="pt hr fr ko ja"
137 for lang in $LINGUAS; do
139 for l in $supported_locales; do
140 if test "$l" = "$lang"; then
145 if test "$ok" = 1; then
146 MOFILES="$MOFILES $lang.mo"
148 echo "Locale $lang is not supported."
151 for l in $supported_wprefs_locales; do
152 if test "$l" = "$lang"; then
157 if test "$ok" = 1; then
158 WPMOFILES="$WPMOFILES $lang.mo"
163 dnl Kanji Characters support
164 dnl ========================
167 [ --enable-kanji multibyte character support (kanji, Korean etc.)],,
170 if test "$enable_kanji" = yes; then
171 I18N_MB="#define I18N_MB"
174 AC_CHECK_LIB(xpg4, setlocale, [LIBS="$LIBS -lxpg4"]);;
179 I18N_MB="#undef I18N_MB"
184 dnl Added by Oliver - Support for NLSDIR option, Hi Oliver!
185 dnl ===========================================
187 [ --with-nlsdir=PATH specify where the locale stuff should go ])
189 if test "x$NLSDIR" = "x"; then
190 if test "x$with_nlsdir" != "x"; then
193 NLSDIR="/usr/lib/locale"
197 dnl Put it back once we have some real gnome support...
199 dnl AC_ARG_WITH(gnome,
200 dnl [ --enable-gnome enable support for GNOME extensions ],
201 dnl [enable_gnome=$withval], [enable_gnome=yes])
202 dnl if test "$enable_gnome" = yes; then
203 dnl GNOME="#define GNOME"
205 dnl GNOME="#undef GNOME"
216 dnl ===========================================
217 dnl Stuff that uses X
218 dnl ===========================================
226 XLIBS="$X_EXTRA_LIBS -lX11"
228 dnl Decide which locale function to use, setlocale() or _Xsetlocale()
229 dnl by MANOME Tomonori
230 dnl ===========================================
231 AC_CHECK_LIB(X11, _Xsetlocale, [X_LOCALE="-DX_LOCALE"],, $XLFLAGS $XLIBS)
239 [ --disable-shape disable shaped window extension support],
240 shape=$enableval, shape=yes)
244 if test "$shape" = yes; then
245 AC_CHECK_LIB(Xext, XShapeSelectInput, [XLIBS="-lXext $XLIBS"
246 added_xext=yes SHAPE=-DSHAPE], shape=no, $XLFLAGS $XLIBS)
256 [ --disable-shm disable usage of MIT-SHM extension],
257 shm=$enableval, shm=yes)
259 if test "$shm" = yes; then
260 AC_CHECK_LIB(Xext, XShmAttach, ok=yes, ok=no, $XLFLAGS $XLIBS)
262 if test "$ok" = yes; then
263 AC_CHECK_FUNC(shmget, ok=yes, ok=no)
266 if test "$ok" = yes; then
267 if test "$added_xext" = no; then
268 XLIBS="-lXext $XLIBS"
276 dnl ==============================================
277 dnl Graphic Format Libraries
278 dnl ==============================================
282 dnl Specify paths to look for graphic format libraries
283 dnl ==================================================
284 AC_ARG_WITH(gfx-libs,
285 [ --with-gfx-libs pass compiler flags to look for gfx libraries],
286 [GFXLIBS="$withval" GFX_LIB_PATH=$withval],
287 [GFXLIBS="" GFX_LIB_PATH=""])
289 AC_ARG_WITH(gfx-incs,
290 [ --with-gfx-incs pass compiler flags to look for gfx header files],
291 [GFXFLAGS="$withval" GFX_INC_PATH=$withval],
292 [GFXFLAGS="" GFX_INC_PATH=""])
301 [ --disable-xpm disable use of XPM pixmaps through libXpm],
302 xpm=$enableval, xpm=yes)
304 if test "$xpm" = yes; then
305 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData,
306 my_libok=yes, my_libok=no,
307 $GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS $XLIBS)
309 if test "$my_libok" = yes; then
310 my_old_cppflags=$CPPFLAGS
311 CPPFLAGS="$CPPFLAGS $GFX_INC_PATH $XCFLAGS"
312 AC_CHECK_HEADER(X11/xpm.h,
313 [GFXFLAGS="$GFXFLAGS -DUSE_XPM" GFXLIBS="$GFXLIBS -lXpm"
314 supported_gfx="XPM"], supported_gfx="XPM (builtin)")
315 CPPFLAGS=$my_old_cppflags
325 AC_SUBST(X_EXTRA_LIBS)
327 dnl ===============================================
328 dnl End of stuff that uses X
329 dnl ===============================================
334 AC_CHECK_LIB(z, gzread, zlib=yes, zlib=no, $GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS)
340 # assume libz is present...
342 #[ --disable-png disable PNG support through libpng],
343 # png=$enableval, png=yes)
346 if test "$png" = yes -a "$zlib" = yes ; then
347 AC_CHECK_LIB(png, png_get_valid, my_libok=yes, my_libok=no,
348 $GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS -lz -lm)
350 if test "$my_libok" = yes; then
351 my_old_cppflags=$CPPFLAGS
352 CPPFLAGS="$CPPFLAGS $GFX_INC_PATH"
353 AC_CHECK_HEADER(png.h,
354 [GFXLIBS="$GFXLIBS -lpng -lz" GFXFLAGS="$GFXFLAGS -DUSE_PNG"
355 supported_gfx="$supported_gfx PNG"], )
356 CPPFLAGS=$my_old_cppflags
365 [ --disable-jpeg disable JPEG support through libjpeg],
366 jpeg=$enableval, jpeg=yes)
368 if test "$jpeg" = yes; then
369 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, my_libok=yes, my_libok=no,
370 $GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS)
372 if test "$my_libok" = yes; then
373 my_old_cppflags=$CPPFLAGS
374 CPPFLAGS="$CPPFLAGS $GFX_INC_PATH"
375 AC_TRY_CPP(jpeglib.h,
376 [GFXLIBS="$GFXLIBS -ljpeg" GFXFLAGS="$GFXFLAGS -DUSE_JPEG"
377 supported_gfx="$supported_gfx JPEG"], )
378 CPPFLAGS=$my_old_cppflags
386 dnl giflib uses dangerous function naming... (namespace clashing)
390 [ --disable-gif disable GIF support through libgif or libungif],
391 gif=$enableval, gif=yes)
393 if test "$gif" = yes; then
395 AC_CHECK_LIB(ungif, DGifOpenFileName,
396 [my_libok=yes my_libname=ungif],
397 [retry=yes my_libok=no],
398 $GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS)
400 dnl libungif is the same thing as libgif for all practical purposes.
402 if test "$retry" = yes; then
403 AC_CHECK_LIB(gif, DGifOpenFileName,
404 [my_libok=yes my_libname=gif],
406 $GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS)
409 if test "$my_libok" = yes; then
410 my_old_cppflags=$CPPFLAGS
411 CPPFLAGS="$CPPFLAGS $GFX_INC_PATH"
412 AC_CHECK_HEADER(gif_lib.h,
413 [GFXLIBS="$GFXLIBS -l$my_libname" GFXFLAGS="$GFXFLAGS -DUSE_GIF"
414 supported_gfx="$supported_gfx GIF"], )
415 CPPFLAGS=$my_old_cppflags
424 [ --disable-tiff disable use of TIFF images through libtiff],
425 tif=$enableval, tif=yes)
428 # TIFF can optionally have JPEG and/or zlib support. Must find out
429 # when they are supported so that correct library flags are passed during
430 # detection and linkage
433 # By default use xpm icons if tiff is not found.
437 if test "$tif" = yes; then
439 AC_CHECK_LIB(tiff, TIFFGetVersion,
440 [my_libok=yes my_libname="-ltiff"], my_libok=no,
441 [$GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS $XLIBS $GFXLIBS -lm])
445 if test "$my_libok" = no; then
446 if test "$zlib" = "yes"; then
447 AC_CHECK_LIB(tiff, TIFFGetVersion,
448 [my_libok=yes my_libname="-ltiff -lz"], my_libok=no,
449 [$GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS $XLIBS $GFXLIBS -lz -lm])
453 if test "$my_libok" = no; then
454 AC_CHECK_LIB(tiff34, TIFFGetVersion,
455 [my_libok=yes my_libname="-ltiff34"], my_libok=no,
456 [$GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS $XLIBS $GFXLIBS -lm])
459 if test "$my_libok" = yes; then
460 my_old_cppflags=$CPPFLAGS
461 CPPFLAGS="$CPPFLAGS $GFX_INC_PATH"
462 AC_CHECK_HEADER(tiffio.h,
463 [GFXFLAGS="$GFXFLAGS -DUSE_TIFF" GFXLIBS="$my_libname $GFXLIBS"
464 ICONEXT="tiff" supported_gfx="$supported_gfx TIFF"], )
465 CPPFLAGS=$my_old_cppflags
476 dnl ==============================================
477 dnl End of Graphic Format Libraries
478 dnl ==============================================
480 dnl =====================================================
481 dnl Check for libPropList
482 dnl Always use the included libPropList, even if it is
483 dnl already installed.
484 dnl =====================================================
487 #LIBPL_LIBS="-L${top_builddir}/libPropList -lPropList"
488 #LIBPL_INC_PATH="-I${top_srcdir}/libPropList"
491 #PLPATH=`pwd`/libPropList
493 #if test -f $PLPATH/libPropList.a; then
494 # echo "using bundled libPropList, already compiled."
496 # LIBPL_LIBS="-L$PLPATH -lPropList"
497 # LIBPL_INC_PATH="-I$PLPATH"
499 # AC_CHECK_LIB(PropList, PLGetString,
500 # [LIBPL_LIBS=-lPropList LIBPL_INC_PATH="" needtobuild=no],
501 # [LIBPL_LIBS="-L$PLPATH -lPropList"
502 # LIBPL_INC_PATH="-I$PLPATH"
507 #if test "$needtobuild" = yes; then
508 # if test -f libPropList/libPropList.a; then
509 # echo "using included libPropList"
511 # echo "********** WARNING *************"
512 # echo "libPropList is not installed in your system."
513 # echo "You need to build it before building Window Maker (if you already"
514 # echo "did that, remove config.cache and rerun configure)."
515 # echo "Please read the INSTALL file for detailed instructions."
516 # echo "Press <Return> to continue configuring Window Maker or"
517 # echo "type b and <Return> to build it now."
519 # if test "$foo" = b; then
521 # echo "Building libPropList..."
523 # if test ! -d libPropList; then
524 # gzip -d -c libPropList.tar.gz | tar xf -
527 # if (cd libPropList; ./configure); then
528 # if (cd libPropList; make); then
532 # if test "$ok" = no; then
533 # echo "********** WARNING **********"
534 # echo "An error occurred while building libPropList"
535 # echo "Please build it manually."
536 # echo "Press <Return> to continue."
540 # echo "resuming Window Maker configuration..."
546 #AC_SUBST(LIBPL_LIBS)
547 #AC_SUBST(LIBPL_INC_PATH)
553 [ --enable-debug enable debugging ],, enable_debug=no)
555 if test "$enable_debug" = yes; then
557 # Efence makes things too slow. Add it by hand in the Makefiles
558 # if it is really needed.
559 # AC_CHECK_LIB(efence, malloc, LIBS="$LIBS -lefence")
564 dnl --Sound support - Dan
565 dnl =============================================
567 [ --enable-sound enable sound support ],, enable_sound=no)
568 if test "$enable_sound" = yes; then
569 SOUND="#define WMSOUND"
571 SOUND="#undef WMSOUND"
576 # AC_PREFIX_PROGRAM(wmaker)
578 if test "${prefix}" = "NONE"; then
581 if test "${exec_prefix}" = "NONE"; then
582 exec_prefix="${prefix}"
585 dnl Support for PIXMAPDIR option
586 dnl ============================
587 AC_ARG_WITH(pixmapdir,
588 [ --with-pixmapdir=PATH specify where pixmaps are located [DATADIR/pixmaps]])
590 if test "x$with_pixmapdir" != "x"; then
591 pixmapdir=$with_pixmapdir
593 pixmapdir="${datadir}/pixmaps"
599 dnl Support for GNUSTEP_LOCAL_ROOT, for WPrefs.app
600 dnl ==============================================
604 AC_ARG_WITH(appspath,
605 [ --with-appspath=PATH specify the path of the GNUstep applications directory ])
607 if test "x$appspath" = "x"; then
608 gnustepdir="${prefix}/GNUstep"
610 if test "x$GNUSTEP_LOCAL_ROOT" != "x" ; then
611 gnustepdir=`echo "$GNUSTEP_LOCAL_ROOT" | sed -e "s%${prefix}%\${prefix}%"`
614 appspath=$gnustepdir/Apps
617 wprefsdir=$appspath/WPrefs.app
622 dnl Enable single appicon per wm instance+class combo -cls
623 dnl =====================================================
624 AC_ARG_ENABLE(single-icon,
625 [ --enable-single-icon use single application icon per WM_INSTANCE+WM_CLASS
627 if test "$enableval" = yes; then
628 REDUCE_APPICONS="#define REDUCE_APPICONS"
630 REDUCE_APPICONS="#undef REDUCE_APPICONS"
632 REDUCE_APPICONS="#undef REDUCE_APPICONS"
634 AC_SUBST(REDUCE_APPICONS)
636 dnl Checks for header files.
637 dnl =======================
640 AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h sys/types.h libintl.h sys/select.h)
644 dnl Checks for typedefs, structures, and compiler characteristics.
645 dnl ==============================================================
653 dnl Some decisions....
654 dnl ==================
655 if test "$GCC" = "yes"; then
657 # for i in $CFLAGS; do
658 # if test "$i" != "-g" ; then
659 # ceflagues="$ceflagues $i"
662 # CFLAGS="$ceflagues -Wall -Wno-implicit-int -finline-functions"
663 CFLAGS="$CFLAGS -Wall -Wno-implicit-int -Wcast-align"
667 dnl Shared Library Support (unfinished)
668 dnl ===================================
671 #AC_ARG_ENABLE(shared,
672 #[ --enable-shared build libraries as shared ], enable_shared=yes,
675 if test "$enable_shared" = yes; then
676 if test "$GCC" = yes; then
678 LDSHARED='$CC -shared'
680 # find system name and corresponding cc options
681 case `(uname -sr || echo unknown) 2>/dev/null` in
683 _CFLAGS="-fast -xcg89 -KPIC -R."
689 _CFLAGS="-ansi -rpath ."
690 LDSHARED='$CC -shared';;
693 LDSHARED='$CC -dy -KPIC -G';;
697 SHAREDLIBS='libz.sl';;
700 LDSHARED='$CC -shared';;
704 AC_MSG_CHECKING([for shared library support])
708 int hello() { printf("hello\n"); }
712 # we must test in two steps (cc then ld), required at least on SunOS 4.x
713 if test "`($CC -c $_CFLAGS $test.c) 2>&1`" = "" &&
714 test "`($LDSHARED -o $test.so $test.o) 2>&1`" = ""; then
715 CFLAGS="$CFLAGS $_CFLAGS"
716 WRASTERLIB='libwraster.so.$(WRASTER_VER)'
717 WINGSLIB='libWINGs.so.$(WINGS_VER)'
718 AC_MSG_RESULT([yes, building shared])
721 WRASTERLIB='libwraster.a'
722 WINGSLIB='libWINGs.a'
723 AC_MSG_RESULT([no, building static])
725 rm -f $test.[co] $test.so
728 #AC_SUBST(WRASTER_VER)
730 #AC_SUBST(WRASTERLIB)
737 dnl Nicolai: Program tests for Documentation Section
738 dnl =================================================
740 dnl AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, ,$PATH)
741 dnl if test "x$MAKEINFO" != "x" ; then
742 dnl DOCTYPES="$DOCTYPES info_doc"
744 dnl AC_CHECK_PROG(TEX, tex, tex, ,$PATH)
745 dnl if test "x$TEX" != "x" ; then
746 dnl DOCTYPES="$DOCTYPES dvi_doc"
748 dnl AC_CHECK_PROG(DVIPS, dvips, dvips, ,$PATH)
749 dnl if test "x$DVIPS" != "x" ; then
750 dnl DOCTYPES="$DOCTYPES ps_doc"
752 dnl AC_CHECK_PROG(PERL, perl, perl, ,$PATH)
753 dnl if test "x$PERL" != "x" ; then
754 dnl DOCTYPES="$DOCTYPES html_doc"
756 dnl AC_PATH_PROG(PERL_PATH, perl, perl, ,$PATH)
757 dnl AC_CHECK_PROG(TEXI2HTML, texi2html, texi2html, ,$PATH)
759 dnl AC_SUBST(DOCTYPES)
761 AC_OUTPUT(Makefile po/Makefile util/Makefile test/Makefile wmlib/Makefile \
762 WINGs/Makefile WINGs/Resources/Makefile src/Makefile src/wconfig.h \
763 wrlib/Makefile doc/Makefile WindowMaker/Makefile \
764 WindowMaker/Defaults/Makefile WindowMaker/Styles/Makefile \
765 WindowMaker/Themes/Makefile WindowMaker/Backgrounds/Makefile \
766 WindowMaker/Pixmaps/Makefile WindowMaker/Icons/Makefile \
767 WindowMaker/IconSets/Makefile \
768 WPrefs.app/Makefile WPrefs.app/tiff/Makefile WPrefs.app/xpm/Makefile \
769 WPrefs.app/po/Makefile )
774 dnl Output some helpfull data for compiling WINGs apps
775 dnl ==================================================
778 echo "WFLAGS=\"$LIBPL_INC_PATH -I$prefix/include\"" > WINGs-flags
779 echo "WLIBS=\"-L$exec_prefix/lib -lWINGs -lwraster $LIBPL_LIBS $GFXLIBS -lm\""\
784 dnl Spit out the configuration
785 dnl ==========================
787 supported_gfx="$supported_gfx PPM (built-in)"
790 echo "Window Maker was configured as follows:"
792 echo "Installation path prefix: $prefix"
793 echo "Installation path prefix for binaries: $exec_prefix"
794 echo "Installation path for WPrefs.app: $wprefsdir"
795 echo "Graphic format libraries: $supported_gfx"
796 if test "x$MOFILES" = "x"; then
801 echo "Translated message files to install: $mof"
802 if test "x$MOFILES" != "x"; then
803 echo "Installation path of translated messages: $NLSDIR"
807 dnl This is for Emacs. I'm lazy, I know... (nicolai)
808 dnl ================================================
810 dnl compile-command: "autoconf"