Add Cygwin to GCFB() (it is just like linux)
[wmaker-crm.git] / configure.ac
bloba9619bcd2a1f48800f3010ffff63d93f5da6bd8e
1 dnl
2 dnl Window Maker autoconf input.
3 dnl
4 dnl Process with:
5 dnl               aclocal
6 dnl               autoheader
7 dnl               autoconf
8 dnl               libtoolize --force --automake
9 dnl               automake -a --gnu --include-deps
10 dnl
11 dnl
14 AC_INIT(src/WindowMaker.h)
18 AM_INIT_AUTOMAKE(WindowMaker, 0.94.0-crm)
20 AC_PROG_LIBTOOL
22 AM_CONFIG_HEADER(src/config.h)
25 dnl Checks for host/os name
26 dnl =======================
27 dnl AC_CANONICAL_HOST -- already done by AC_PROG_LIBTOOL
30 dnl Checks for programs.
31 dnl ===================
32 AC_ISC_POSIX
33 AC_PROG_CC
34 dnl AC_PROG_MAKE_SET -- already done by AM_INIT_AUTOMAKE
35 #AC_PROG_RANLIB
36 dnl AC_PROG_INSTALL -- already done by AM_INIT_AUTOMAKE
37 AC_PROG_LN_S
38 AC_PROG_GCC_TRADITIONAL
40 dnl Platform-specific Makefile setup
41 dnl ================================
43 case "${host}" in
44         *-*-cygwin*)
45         *-*-linux*)
46                 WM_OSDEP="linux"
47         ;;
48         *-*-freebsd*)
49                 WM_OSDEP="bsd"
50                 CFLAGS="$CFLAGS -DFREEBSD"
51         ;;
52         *-*-netbsd*)
53                 WM_OSDEP="bsd"
54                 CFLAGS="$CFLAGS -DNETBSD"
55         ;;
56         *-*-openbsd*)
57                 WM_OSDEP="bsd"
58         CFLAGS="$CFLAGS -DOPENBSD"
59         ;;
60         *-*-dragonfly*)
61                 WM_OSDEP="bsd"
62                 CFLAGS="$CFLAGS -DDRAGONFLYBSD"
63         ;;
64         *-apple-darwin*)
65                 WM_OSDEP="darwin"
66         ;;
67         *-*-solaris*)
68                 WM_OSDEP="stub"         # solaris.c when done
69         ;;
70         *)
71                 WM_OSDEP="stub"
72                 CFLAGS="-DSTUB_HINT=\\\"${host}\\\""
73         ;;
74 esac
75 AC_SUBST(WM_OSDEP)
78 dnl the prefix
79 dnl ==========
80 dnl
81 dnl move this earlier in the script... anyone know why this is handled
82 dnl in such a bizarre way?
84 test "x$prefix" = xNONE && prefix=$ac_default_prefix
85 dnl Let make expand exec_prefix.
86 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
89 _bindir=`eval echo $bindir`
90 _bindir=`eval echo $_bindir`
92 _libdir=`eval echo $libdir`
93 _libdir=`eval echo $_libdir`
94 lib_search_path="-L$_libdir"
96 inc_search_path=`eval echo $includedir`
97 inc_search_path="-I`eval echo $inc_search_path`"
99 dnl
100 dnl Specify paths to look for libraries and headers
101 dnl ===============================================
102 AC_ARG_WITH(libs-from,
103 [  --with-libs-from        pass compiler flags to look for libraries],
104         [lib_search_path="$withval $lib_search_path"])
106 AC_ARG_WITH(incs-from,
107 [  --with-incs-from        pass compiler flags to look for header files],
108         [inc_search_path="$withval $inc_search_path"])
112 dnl Checks for library functions.
113 dnl ============================
114 dnl not used anywhere
115 dnl AC_FUNC_MEMCMP  
116 AC_FUNC_VPRINTF
117 AC_CHECK_FUNCS(gethostname select poll strerror strcasecmp strncasecmp \
118                setsid atexit mallinfo mkstemp snprintf vsnprintf asprintf \
119                vasprintf)
121 dnl ripped from samba
122 dnl 
123 AC_CACHE_CHECK([for C99 vsnprintf],_cv_HAVE_C99_VSNPRINTF,[
124 AC_TRY_RUN([
125 #include <sys/types.h>
126 #include <stdarg.h>
127 void foo(const char *format, ...) { 
128        va_list ap;
129        int len;
130        char buf[5];
132        va_start(ap, format);
133        len = vsnprintf(0, 0, format, ap);
134        va_end(ap);
135        if (len != 5) exit(1);
137        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
139        exit(0);
141 main() { foo("hello"); }
143 _cv_HAVE_C99_VSNPRINTF=yes,_cv_HAVE_C99_VSNPRINTF=no,_cv_HAVE_C99_VSNPRINTF=cross)])
144 if test x"$_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
145     AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [define if you have vsnprintf with C99 semantics (set by configure)])
148 dnl Check for inotify
149 dnl =================
150 AC_CHECK_HEADERS(sys/inotify.h, AC_DEFINE(HAVE_INOTIFY, 1, Check for inotify))
152 dnl Check CPP
153 dnl =========
154 if test "x$CPP_PATH" = x; then
155     AC_PATH_PROG(CPP_PATH, cpp, notfound, 
156                 $PATH:/lib:/usr/bin:/bin:/usr/lib:/usr/ccs/lib)
160 dnl Tell stupid Solaris cpp that the files it will process have C++ like syntax
161 dnl RedHat 5.x is broken too, so it won't make a symlink from cpp to the
162 dnl standard locations
164 if test "$CPP_PATH" = "/usr/ccs/lib/cpp" -o "$CPP_PATH" = "notfound" ; then
165     if test "$GCC" = "yes"; then
166         CPP_PATH="gcc -E -x c"
167     else 
168         if test "$CPP_PATH" = "/usr/ccs/lib/cpp"; then
169             CPP_PATH="$CPP_PATH -B"
170         else
171             echo "cpp, the C preprocessor was not found in your system."
172             echo "Create a symbolic link from it to /lib/cpp and rerun configure"
173             exit
174         fi
175     fi
177 AC_DEFINE_UNQUOTED(CPP_PATH, "$CPP_PATH", [define to the path to cpp])
181 dnl Checks for header files.
182 dnl =======================
183 AC_HEADER_SYS_WAIT
184 AC_HEADER_TIME
185 AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h sys/types.h \
186                  libintl.h sys/select.h poll.h malloc.h ctype.h string.h \
187                  strings.h)
191 dnl Checks for typedefs, structures, and compiler characteristics.
192 dnl ==============================================================
193 AC_DECL_SYS_SIGLIST
194 AC_C_CONST
195 #AC_TYPE_SIZE_T
196 #AC_TYPE_PID_T
197 AC_TYPE_SIGNAL
201 dnl Compiler/architecture specific optimizations
202 dnl ============================================
205 dnl GCC/as with MMX support
206 dnl -----------------------
208 # until we fix it, leave it disabled
209 asm_support=no
210 mmx_support=no
212 check_for_mmx_support=yes
213 AC_ARG_ENABLE(mmx,
214    [  --disable-mmx          disable compilation of MMX inline assembly ],
215    [if test x$enableval != xyes; then
216     check_for_mmx_support=no
217     fi])
219 if test "$ac_cv_prog_gcc" = yes -a "$check_for_mmx_support" = yes; then
220 case $host_cpu in
221 *i?86*)
223     # gcc-3.3 or newer complains about some of our stuff without this
224     NOSTRICTALIASING="-fno-strict-aliasing"
226     AC_CACHE_CHECK(whether gcc supports x86 inline asm,
227                    ac_cv_c_inline_asm,
228                    [AC_TRY_LINK(,[{int x; asm volatile("movl %%eax, %%ebx\n\t pushal\n\t popal"::
229                           "m" (x),"m" (x),"m" (x),"m" (x),"m" (x),"m" (x),
230                           "m" (x),"m" (x),"m" (x),"m" (x),"m" (x),"m" (x));}],
231                    ac_cv_c_inline_asm=yes,
232                    ac_cv_c_inline_asm=no)])
234     if test "x$ac_cv_c_inline_asm" = xyes; then
235        AC_DEFINE(ASM_X86, 1, [define if processor is x86 (normally detected by configure)])
236        asm_support=yes
238        AC_CACHE_CHECK(whether gcc supports MMX(tm) inline asm,
239                       ac_cv_c_inline_mmx,
240                       [AC_TRY_LINK(,[asm ("movq %mm0, %mm1");],
241                       ac_cv_c_inline_mmx=yes,
242                       ac_cv_c_inline_mmx=no)])
244        if test "x$ac_cv_c_inline_mmx" = xyes; then
245           AC_DEFINE(ASM_X86_MMX, 1, [define if processor is x86 with MMX(tm) support (normally autodetected by configure)])
246           mmx_support=yes
247        fi
248     fi
249     ;;
250 esac
252 AC_SUBST(NOSTRICTALIASING)
255 dnl pkg-config
256 dnl ----------
257 dnl AC_ARG_VAR(PKGCONFIG, [pkg-config command])
258 AC_CHECK_PROG(PKGCONFIG, pkg-config, pkg-config) 
261 dnl gettext
262 dnl -------
265 dnl AM_GNU_GETTEXT
269 INTLIBS=""
271 AC_CHECK_FUNC(gettext, [HAVEGETTEXT="yes"], 
272         AC_CHECK_LIB(intl, gettext, [INTLIBS="-lintl" HAVEGETTEXT="yes"],
273                          INTLIBS="" ))
275 AC_CHECK_PROG(XGETTEXT, xgettext, xgettext)
277 if test "$XGETTEXT" != ""; then 
278     if $XGETTEXT --help 2>&1 | grep illegal >/dev/null ; then
279         echo "xgettext isn't GNU version"
280         XGETTEXT=""
281     fi
284 if test "$LINGUAS" != ""; then
285     if test "$XGETTEXT" != "" -a "$HAVEGETTEXT" != ""; then
286         AC_DEFINE(I18N, 1, [Internationalization (I18N) support (set by configure)])
287         PO=""
288         echo "xgettext and gettext() exist; will build i18n support for $LINGUAS"
289     else
290         LINGUAS=""
291         PO=""
292         echo "xgettext and libintl.a don't both exist; will not build i18n support"
293     fi
294 else
295         INTLIBS=""
296         MOFILES=""
297         WPMOFILES=""
298         UTILMOFILES=""
299         PO=""
303 dnl The Tower of Babel
304 dnl ==================
306 dnl List of supported locales
307 dnl -------------------------
308 supported_locales="be bg bs ca cs da de el es et fi fr gl hr hu hy it ja ko ms nl no pl pt ro ru sk sv tr zh_CN zh_TW"
309 supported_wprefs_locales="bg ca cs de es et fi fr hr hu it ja ko pt ru sk zh_CN zh_TW"
310 supported_wings_locales="bg ca cs de fr sk"
311 supported_util_locales="de"
313 for lang in $LINGUAS; do
314         ok=0
315         for l in $supported_locales; do
316                 if test "$l" = "$lang"; then
317                         ok=1
318                         break
319                 fi
320         done
321         if test "$ok" = 1; then
322                 MOFILES="$MOFILES $lang.mo"
323         else
324                 echo "Locale $lang is not supported."
325         fi
326         ok=0
327         for l in $supported_wprefs_locales; do
328                 if test "$l" = "$lang"; then
329                         ok=1
330                         break
331                 fi
332         done
333         if test "$ok" = 1; then
334                 WPMOFILES="$WPMOFILES $lang.mo"
335         fi
336         ok=0
337         for l in $supported_util_locales; do
338                 if test "$l" = "$lang"; then
339                         ok=1
340                         break
341                 fi
342         done
343         if test "$ok" = 1; then
344                 UTILMOFILES="$UTILMOFILES $lang.mo"
345         fi
346         ok=0
347         for l in $supported_wings_locales; do
348                 if test "$l" = "$lang"; then
349                         ok=1
350                         break
351                 fi
352         done
353         if test "$ok" = 1; then
354                 WINGSMOFILES="$WINGSMOFILES $lang.mo"
355         fi
356 done
359 dnl Added by Oliver - Support for NLSDIR option,   Hi Oliver!
360 dnl ===========================================
361 AC_ARG_WITH(nlsdir, 
362         [  --with-nlsdir=PATH      specify where the locale stuff should go ])
365 if test "x$NLSDIR" = "x"; then
366         if test "x$with_nlsdir" != "x"; then
367                 NLSDIR=$with_nlsdir
368         else
369                 NLSDIR='$(prefix)/lib/locale'
370         fi
375 AC_SUBST(INTLIBS)
376 AC_SUBST(NLSDIR)
377 AC_SUBST(MOFILES)
378 AC_SUBST(WPMOFILES)
379 AC_SUBST(UTILMOFILES)
380 AC_SUBST(WINGSMOFILES)
381 AC_SUBST(supported_locales)
385 dnl Support for various hint things
386 dnl ===============================
389 dnl Beautify compilation messages
390 dnl ---------------------------------------------
391 AC_ARG_ENABLE(verbose-compile, AS_HELP_STRING([--disable-verbose-compile],
392                                [Streamline compilation messages (default off)]),
393   [
394         QUIET='@echo "     CC" $@;'
395         QUIET_AR='@echo "     AR" $@;'
396         LIBTOOL_ARG="--silent"
397         MAKEFLAGS="-s"
398         AC_SUBST(QUIET)
399         AC_SUBST(QUIET_AR)
400         AC_SUBST(LIBTOOL_ARG)
401         AC_SUBST(MAKEFLAGS)
405 dnl ===========================================
406 dnl             Stuff that uses X
407 dnl ===========================================
409 AC_PATH_XTRA
411 if test $no_x; then
412     AC_MSG_ERROR([The path for the X11 files not found!
413 Make sure you have X and it's headers and libraries (the -devel packages
414 in Linux) installed.])
417 X_LIBRARY_PATH=$x_libraries
419 XCFLAGS="$X_CFLAGS"
421 XLFLAGS="$X_LIBS"
423 XLIBS="-lX11 -lXmu $X_EXTRA_LIBS"
426 lib_search_path="$lib_search_path $XLFLAGS"
427 inc_search_path="$inc_search_path $XCFLAGS"
430 AC_SUBST(X_LIBRARY_PATH)
434 dnl Decide which locale function to use, setlocale() or _Xsetlocale()
435 dnl by MANOME Tomonori 
436 dnl ===========================================
437 use_locale=yes
438 AC_ARG_ENABLE(locale, 
439 [  --disable-locale        disable use of X locale support],
440                 use_locale=no)
442 if test "$use_locale" = yes; then
443         AC_CHECK_LIB(X11, _Xsetlocale,
444                 AC_DEFINE(X_LOCALE, 1, [define if you want support for X window's X_LOCALE (set by configure)]),,
445                 $XLFLAGS $XLIBS)
449 dnl Check whether XInternAtoms() exist
450 dnl ==================================
451 AC_CHECK_LIB(X11, XInternAtoms, 
452              AC_DEFINE(HAVE_XINTERNATOMS, 1, [define if your X server has XInternAtoms() (set by configure)]),,
453              $XLFLAGS $XLIBS)
455 dnl Check whether XConvertCase() exist
456 dnl ==================================
457 AC_CHECK_LIB(X11, XConvertCase, 
458              AC_DEFINE(HAVE_XCONVERTCASE, 1, [define if your X server has XConvertCase() (set by configure)]),,
459              $XLFLAGS $XLIBS)
462 dnl XKB keyboard language status
463 dnl ============================
464 AC_ARG_ENABLE(modelock,
465 [  --enable-modelock       XKB keyboard language status support],
466                 AC_DEFINE(XKB_MODELOCK, 1, [whether XKB language MODELOCK should be enabled]))
470 dnl Shape support
471 dnl =============
472 shape=yes
473 AC_ARG_ENABLE(shape, 
474 [  --disable-shape         disable shaped window extension support],
475                 shape=$enableval, shape=yes)
477 added_xext=no
479 if test "$shape" = yes; then
480         AC_CHECK_LIB(Xext, XShapeSelectInput, [XLIBS="-lXext $XLIBS"
481                 added_xext=yes
482                 AC_DEFINE(SHAPE, 1, [define if you want support for shaped windows (set by configure)])], 
483                 shape=no, $XLFLAGS $XLIBS)
487 dnl Xft2 antialiased font support
488 dnl =============================
490 xft=yes
491 XFTLIBS=""
493 if test "x$PKGCONFIG" != x -a "`$PKGCONFIG xft; echo $?`" = 0; then
494         XFTCONFIG="$PKGCONFIG xft"
495         pkgconfig_xft=yes
496 else
497         AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config)
500 AC_MSG_CHECKING([for the Xft2 library])
502 if test "x$XFTCONFIG" != x; then
503         XFTLIBS=`$XFTCONFIG --libs`
504         XFTFLAGS=`$XFTCONFIG --cflags`
505         AC_MSG_RESULT([found])
506 else
507         AC_MSG_RESULT([not found])
508         echo
509         echo "ERROR!!! libXft2 is not installed or could not be found."
510         echo "         Xft2 is a requirement for building Window Maker."
511         echo "         Please install it (along with fontconfig) before continuing."
512         echo
513         exit 1
516 minXFT="2.1.0"
517 goodxft="no"
520 dnl The macro below will use $XFTFLAGS (defined above) to find Xft.h
522 WM_CHECK_XFT_VERSION($minXFT, goodxft=yes, goodxft=no)
524 if test "$goodxft" = no; then
525         echo
526         echo "ERROR!!! libXft on this system is an old version."
527         echo "         Please consider upgrading to at least version ${minXFT}."
528         echo
529         exit 1
532 AC_SUBST(XFTFLAGS)
533 AC_SUBST(XFTLIBS)
536 dnl XINERAMA support
537 dnl ================
538 xinerama=no
539 AC_ARG_ENABLE(xinerama,
540 [  --enable-xinerama       enable Xinerama extension support],
541                 xinerama=$enableval, xinerama=no)
543 if test "$xinerama" = yes; then
544         AC_CHECK_LIB(Xinerama, XineramaQueryScreens, 
545                 [XLIBS="-lXinerama $XLIBS"
546                 xfxine=yes],
547                 xfxine=no, $XLFLAGS $XLIBS)
549         AC_CHECK_LIB(Xext, XineramaGetInfo,
550                 [sunxine=yes
551                 ], sunxine=no, $XLFLAGS $XLIBS)
553         if test "$xfxine" = yes; then
554                 xine=1
555         fi
557         if test "$sunxine" = yes; then
558             xine=1
559             AC_DEFINE(SOLARIS_XINERAMA, 1, 
560                 [define if you want support for the XINERAMA extension and are in Solaris (set by configure)])
561         fi
563         if test "$xine" = 1; then
564             AC_DEFINE(XINERAMA, 1, 
565                 [define if you want support for the XINERAMA extension (set by configure)])
566         fi
571 dnl MIT-SHM support
572 dnl ===============
573 shm=yes
574 AC_ARG_ENABLE(shm,
575 [  --disable-shm           disable usage of MIT-SHM extension],
576                 shm=$enableval, shm=yes)
578 if test "$shm" = yes; then
579         AC_CHECK_LIB(Xext, XShmAttach, ok=yes, ok=no, $XLFLAGS $XLIBS)
581         if test "$ok" = yes; then
582         AC_CHECK_FUNC(shmget, ok=yes, ok=no)
583         fi
585         if test "$ok" = yes; then
586                 if test "$added_xext" = no; then
587                         XLIBS="-lXext $XLIBS"
588                 fi
589                 AC_DEFINE(XSHM, 1, [define if X's shared memory extension is available (set by configure)])
590         fi
594 dnl R6 Style Session Management Support
595 dnl ===================================
599 #AC_DEFINE(R6SM)
600 #AC_SUBST(XSMPLIBS)
604 dnl ==============================================
605 dnl         Graphic Format Libraries
606 dnl ==============================================
612 dnl XPM Support
613 dnl ===========
614 xpm=yes
615 AC_ARG_ENABLE(xpm, 
616 [  --disable-xpm           disable use of XPM pixmaps through libXpm],
617         xpm=$enableval, xpm=yes)
619 if test "$xpm" = yes; then
620     WM_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [$XLFLAGS $XLIBS])
622     if test "x$ac_cv_lib_Xpm_XpmCreatePixmapFromData" = xyes; then
623         WM_CHECK_HEADER(X11/xpm.h)
624         if test "x$ac_cv_header_X11_xpm_h" = xyes; then
625                 GFXLIBS="$GFXLIBS -lXpm"
626                 supported_gfx="XPM"
627                 AC_DEFINE(USE_XPM, 1, [define if XPM libraries are available (set by configure)])
628         else
629                 supported_gfx="builtin-XPM"
630         fi
631     fi
634 AC_SUBST(XLFLAGS)
635 AC_SUBST(XLIBS)
636 AC_SUBST(X_EXTRA_LIBS)
638 dnl ===============================================
639 dnl             End of stuff that uses X
640 dnl ===============================================
644 dnl PNG Support
645 dnl ===========
646 png=yes
647 AC_ARG_ENABLE(png, 
648 [  --disable-png           disable PNG support through libpng],
649         png=$enableval, png=yes, png=no)
652 if test "$png" = yes ; then
653     WM_CHECK_LIB(png, png_get_valid, [-lz -lm])
655     if test "x$ac_cv_lib_png_png_get_valid" = xyes; then
656         WM_CHECK_HEADER(png.h)
657         if test "x$ac_cv_header_png_h" = xyes; then
658             GFXLIBS="$GFXLIBS -lpng -lz" 
659             supported_gfx="$supported_gfx PNG"
660             AC_DEFINE(USE_PNG, 1, [define if PNG libraries are available (set by configure)])
661         fi
662     fi
666 dnl JPEG Support
667 dnl ============
668 jpeg=yes
669 ljpeg=""
670 AC_ARG_ENABLE(jpeg,
671 [  --disable-jpeg          disable JPEG support through libjpeg],
672         jpeg=$enableval, jpeg=yes, jpeg=no)
674 if test "$jpeg" = yes; then
675     WM_CHECK_LIB(jpeg, jpeg_destroy_compress)
677     if test "x$ac_cv_lib_jpeg_jpeg_destroy_compress" = xyes; then
679         ljpeg="-ljpeg"
681         WM_CHECK_HEADER(jpeglib.h)
682         if test "x$ac_cv_header_jpeglib_h" = xyes; then
683             GFXLIBS="$GFXLIBS -ljpeg"
684             supported_gfx="$supported_gfx JPEG"
685             AC_DEFINE(USE_JPEG, 1, [define if JPEG libraries are available (set by configure)])
686         fi
687     fi
691 dnl GIF Support
692 dnl ============
693 gif=yes
694 AC_ARG_ENABLE(gif,
695 [  --disable-gif           disable GIF support through libgif or libungif],
696         gif=$enableval, gif=yes, gif=no)
698 if test "$gif" = yes; then
699     my_libname=""
700     WM_CHECK_LIB(ungif, DGifOpenFileName, [$XLFLAGS $XLIBS])
701     if test "x$ac_cv_lib_ungif_DGifOpenFileName" = xyes; then
702         my_libname=-lungif
703     fi
705 dnl libungif is the same thing as libgif for all practical purposes.
707     if test "x$my_libname" = x; then
708         WM_CHECK_LIB(gif, DGifOpenFileName, [$XLFLAGS $XLIBS])
709         if test "x$ac_cv_lib_gif_DGifOpenFileName" = xyes; then
710             my_libname=-lgif
711         fi
712     fi
714     if test "$my_libname" != x; then
715         WM_CHECK_HEADER(gif_lib.h)
716         if test "x$ac_cv_header_gif_lib_h" = xyes; then
717             GFXLIBS="$GFXLIBS $my_libname"
718             supported_gfx="$supported_gfx GIF"
719             AC_DEFINE(USE_GIF, 1, [define if GIF libraries are available (set by configure)])
720         fi
721     fi
726 dnl TIFF Support
727 dnl ============
728 AC_ARG_ENABLE(tiff, 
729 [  --disable-tiff          disable use of TIFF images through libtiff],
730         tif=$enableval, tif=yes, tif=no)
733 # TIFF can optionally have JPEG and/or zlib support. Must find out
734 # when they are supported so that correct library flags are passed during
735 # detection and linkage
738 # By default use xpm icons if tiff is not found.
739 ICONEXT="xpm"
742 if test "$tif" = yes; then
743     my_libname=""
744     WM_CHECK_LIB(tiff, TIFFGetVersion, [-lm])
745     if test "x$ac_cv_lib_tiff_TIFFGetVersion" = xyes; then
746         my_libname="-ltiff"
747     fi
749 dnl Retry with zlib
751     unset ac_cv_lib_tiff_TIFFGetVersion
752     if test "x$my_libname" = x; then
753         WM_CHECK_LIB(tiff, TIFFGetVersion, [$ljpeg -lz -lm])
754         if test "x$ac_cv_lib_tiff_TIFFGetVersion" = xyes; then
755             my_libname="-ltiff -lz"
756         fi
757     fi
759     if test "x$my_libname" = x; then
760         WM_CHECK_LIB(tiff34, TIFFGetVersion, [$ljpeg -lm])
761         if test "x$ac_cv_lib_tiff34_TIFFGetVersion" = xyes; then
762             my_libname="-ltiff34"
763         fi
764     fi
767     if test "x$my_libname" != x; then
768         WM_CHECK_HEADER(tiffio.h)
769         if test "x$ac_cv_header_tiffio_h" = xyes; then
770             GFXLIBS="$my_libname $GFXLIBS"
771             ICONEXT="tiff"
772             supported_gfx="$supported_gfx TIFF"
773             AC_DEFINE(USE_TIFF, 1, [define if TIFF libraries are available (set by configure)])     
774         fi
775     fi
778 LIBRARY_SEARCH_PATH="$lib_search_path"
779 HEADER_SEARCH_PATH="$inc_search_path"
781 AC_SUBST(LIBRARY_SEARCH_PATH)
782 AC_SUBST(HEADER_SEARCH_PATH)
785 AC_SUBST(GFXLIBS)
786 AC_SUBST(ICONEXT)
789 dnl ==============================================
790 dnl         End of Graphic Format Libraries
791 dnl ==============================================
795 dnl stdlib.h is checked here, because of conflict in jpeglib.h
796 AC_CHECK_HEADERS(stdlib.h)
798 # AC_PREFIX_PROGRAM(wmaker)
800 dnl Support for PIXMAPDIR option
801 dnl ============================
802 AC_ARG_WITH(pixmapdir,
803 [  --with-pixmapdir=PATH   specify where pixmaps are located [DATADIR/pixmaps]])
805 if test "x$with_pixmapdir" != "x"; then
806         pixmapdir=$with_pixmapdir
807 else
808         pixmapdir=`eval echo ${datadir}/pixmaps`
811 AC_DEFINE_UNQUOTED(PIXMAPDIR, "$pixmapdir", [define an extra path for pixmaps (set by configure)])
813 pkgdatadir=`eval echo $datadir`
814 AC_DEFINE_UNQUOTED(PKGDATADIR, "$pkgdatadir/WindowMaker", [where shared data is stored (defined by configure)])
816 _sysconfdir=`eval echo $sysconfdir`
817 AC_DEFINE_UNQUOTED(SYSCONFDIR, "$_sysconfdir", [where the configuration is stored (defined by configure)])
820 dnl Support for GNUSTEP_LOCAL_ROOT, for WPrefs.app
821 dnl ==============================================
823 AC_ARG_WITH(appspath,
824 [  --with-gnustepdir=PATH  specify the directory for GNUstep applications])
826 if test "x`echo $with_gnustepdir | grep ^/`" != "x"; then
827     appspath=$with_gnustepdir
830 if test "x$appspath$GNUSTEP_LOCAL_ROOT" = "x"; then
831     wprefs_base_dir=${prefix}
832     wprefs_datadir="${datadir}/WPrefs"
833     wprefs_bindir="${bindir}"
834 else
835     gnustepdir=$appspath
837     if test "x$GNUSTEP_LOCAL_ROOT" != "x" ; then
838         gnustepdir=`echo "$GNUSTEP_LOCAL_ROOT" | sed -e "s|^${prefix}|prefix|"`
839         gnustepdir=`echo $gnustepdir | sed -e 's|^prefix|${prefix}|'`
840     fi
842     wprefs_base_dir=$gnustepdir/Applications
843     wprefs_datadir=$wprefs_base_dir/WPrefs.app
844     wprefs_bindir=$wprefs_base_dir/WPrefs.app
847 AC_SUBST(wprefs_datadir)
848 AC_SUBST(wprefs_bindir)
851 dnl Enable User Defined Menu thing
852 dnl ==================================
853 AC_ARG_ENABLE(usermenu,
854 [  --enable-usermenu       user defined menus for applications
856 if test "$enableval" = yes; then
857         AC_DEFINE(USER_MENU, 1, [define if you want user defined menus for applications])
862 AC_OUTPUT(Makefile po/Makefile util/Makefile util/po/Makefile \
863         WINGs/Makefile WINGs/WINGs/Makefile WINGs/Documentation/Makefile \
864         WINGs/Examples/Makefile WINGs/Resources/Makefile WINGs/Tests/Makefile \
865         WINGs/Extras/Makefile WINGs/po/Makefile \
866         wrlib/Makefile wrlib/tests/Makefile \
867         src/Makefile src/wconfig.h \
868         doc/Makefile doc/sk/Makefile \
869         WindowMaker/Makefile WindowMaker/Backgrounds/Makefile \
870         WindowMaker/Defaults/Makefile WindowMaker/IconSets/Makefile \
871         WindowMaker/Icons/Makefile WindowMaker/Pixmaps/Makefile \
872         WindowMaker/Styles/Makefile WindowMaker/Themes/Makefile \
873         WPrefs.app/Makefile WPrefs.app/tiff/Makefile WPrefs.app/xpm/Makefile \
874         WPrefs.app/po/Makefile \
875         contrib/Makefile contrib/WindowMaker.spec )
880 dnl Output some helpful data for compiling wraster and WINGs/WUtil apps
881 dnl ===================================================================
884 dnl echo "WFLAGS=\"$LIBPL_INC_PATH -I$prefix/include\"" > WINGs-flags
885 dnl echo "WLIBS=\"-L$exec_prefix/lib -lWINGs -lwraster $LIBPL_LIBS $GFXLIBS -lm\""\
886 dnl     | sed -e 's|\$(prefix)|'"$prefix|" >> WINGs-flags
888 dnl The #lp# and #rp# stuff below is a hack because [ and ] get lost when
889 dnl parsed by m4
891 cat <<EOF >get-wraster-flags
892 #!/bin/sh
894 WCFLAGS="$inc_search_path"
895 WLFLAGS="$lib_search_path"
896 WLIBS="-lwraster $GFXLIBS $XLIBS -lm"
898 usage="Usage: get-wraster-flags #lp#--cflags#rp# #lp#--ldflags#rp# #lp#--libs#rp#"
900 if test \$# -eq 0; then
901       echo "\${usage}" 1>&2
902       exit 1
905 while test \$# -gt 0; do
906   case \$1 in
907     --cflags)
908         echo \$WCFLAGS
909         ;;
910     --ldflags|--lflags)
911         echo \$WLFLAGS
912         ;;
913     --libs)
914         echo \$WLIBS
915         ;;
916     *)
917         echo "\${usage}" 1>&2
918         exit 1
919         ;;
920   esac
921   shift
922 done
927 cat <<EOF > wrlib/wrlib.pc
928 Name: wrlib
929 Description: Image manipulation and conversion library
930 Version: $VERSION
931 Libs: $lib_search_path -lwraster $GFXLIBS $XLIBS -lm
932 Cflags: $inc_search_path
935 cat <<EOF >get-wings-flags
936 #!/bin/sh
938 WCFLAGS="$inc_search_path"
939 WLFLAGS="$lib_search_path"
940 WLIBS="-lWINGs -lWUtil -lwraster $GFXLIBS $XFTLIBS $XLIBS -lm $INTLIBS"
942 usage="Usage: get-wings-flags #lp#--cflags#rp# #lp#--ldflags#rp# #lp#--libs#rp#"
944 if test \$# -eq 0; then
945       echo "\${usage}" 1>&2
946       exit 1
949 while test \$# -gt 0; do
950   case \$1 in
951     --cflags)
952         echo \$WCFLAGS
953         ;;
954     --ldflags|--lflags)
955         echo \$WLFLAGS
956         ;;
957     --libs)
958         echo \$WLIBS
959         ;;
960     *)
961         echo "\${usage}" 1>&2
962         exit 1
963         ;;
964   esac
965   shift
966 done
971 cat <<EOF > WINGs/WINGs.pc
972 Name: WINGs
973 Description: Small widget set with the NeXTStep(TM) look and feel
974 Version: $VERSION
975 Requires: wrlib
976 Libs: $lib_search_path -lWINGs $XFTLIBS $XLIBS -lm $INTLIBS
977 Cflags: $inc_search_path
980 cat <<EOF >get-wutil-flags
981 #!/bin/sh
983 WCFLAGS="-I`eval echo ${includedir}`"
984 WLFLAGS="-L${_libdir}"
985 WLIBS="-lWUtil $INTLIBS"
987 usage="Usage: get-wutil-flags #lp#--cflags#rp# #lp#--ldflags#rp# #lp#--libs#rp#"
989 if test \$# -eq 0; then
990       echo "\${usage}" 1>&2
991       exit 1
994 while test \$# -gt 0; do
995   case \$1 in
996     --cflags)
997         echo \$WCFLAGS
998         ;;
999     --ldflags|--lflags)
1000         echo \$WLFLAGS
1001         ;;
1002     --libs)
1003         echo \$WLIBS
1004         ;;
1005     *)
1006         echo "\${usage}" 1>&2
1007         exit 1
1008         ;;
1009   esac
1010   shift
1011 done
1016 sed 's/#lp#/[/g' get-wraster-flags | sed 's/#rp#/]/g' > wrlib/get-wraster-flags
1017 sed 's/#lp#/[/g' get-wings-flags | sed 's/#rp#/]/g' > WINGs/get-wings-flags
1018 sed 's/#lp#/[/g' get-wutil-flags | sed 's/#rp#/]/g' > WINGs/get-wutil-flags
1020 chmod 755 wrlib/get-wraster-flags WINGs/get-wings-flags WINGs/get-wutil-flags
1022 rm -f get-wraster-flags get-wings-flags get-wutil-flags
1026 dnl Spit out the configuration
1027 dnl ==========================
1029 supported_gfx="$supported_gfx builtin-PPM"
1031 if test "x$MOFILES" = "x"; then
1032         mof=None
1033 else
1034         mof=`echo $MOFILES`
1037 if test "x$MOFILES" = "x"; then
1038         languages=None
1039 else
1040         languages=`echo $MOFILES | sed 's/.mo//g'`
1043 echo
1044 echo "Window Maker was configured as follows:"
1045 echo
1046 echo "Installation path prefix            : $prefix"
1047 echo "Installation path for binaries      : $_bindir"
1048 echo "Installation path for WPrefs.app    : $wprefs_base_dir" | sed -e 's|\${prefix}|'"$prefix|"
1049 echo "Supported graphic format libraries  : $supported_gfx"
1050 echo "Use assembly routines for wrlib     : $asm_support"
1051 echo "Use inline MMX(tm) x86 assembly     : $mmx_support"
1052 echo "Antialiased text support in WINGs   : $xft"
1053 echo "Xinerama extension support          : $xinerama"
1054 echo "Translated message files to install : $mof"
1055 dnl echo "Supported languages beside English  : $languages"
1056 if test "x$MOFILES" != "x"; then
1057         echo "Installation path for translations  : $NLSDIR" | sed -e 's|\$(prefix)|'"$prefix|"
1059 echo
1061 dnl WM_PRINT_REDCRAP_BUG_STATUS
1063 if test "x$ac_cv_header_jpeglib_h" != xyes; then
1064 echo "WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"
1065 echo
1066 echo "JPEG support will not be included because the JPEG library is"
1067 echo "not installed correctly or was not found. Background images"
1068 echo "from themes will not display as they usually are JPEG files."
1069 echo
1070 echo "To fix, download and install the jpeg library and/or make sure you"
1071 echo "installed all jpeg related packages, SPECIALLY the development packages"
1072 echo "like jpeg-devel (if you use some prepackaged version of libjpeg)."
1073 echo
1074 echo "WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"
1078 dnl This is for Emacs.  I'm lazy, I know... (nicolai)
1079 dnl ================================================
1080 dnl Local Variables:
1081 dnl compile-command: "autoconf"
1082 dnl End: