Clean up library linking
[wmaker-crm.git] / configure.ac
blob7cd56a97b08901b1b31524f7abc1d7cd552a6050
1 dnl
2 dnl Window Maker autoconf input.
3 dnl
4 dnl Process with:
5 dnl               aclocal
6 dnl               autoheader
7 dnl               autoconf
8 dnl               libtoolize --force --automake
9 dnl               automake -a --gnu --include-deps
10 dnl
11 dnl
14 AC_INIT(WindowMaker, 0.94.0-crm, , WindowMaker, http://www.windowmaker.info/)
15 AC_CONFIG_SRCDIR(src/WindowMaker.h)
16 AC_CONFIG_MACRO_DIR([m4])
17 AM_CONFIG_HEADER(src/config.h)
18 AM_INIT_AUTOMAKE([1.11 silent-rules])
20 dnl libtool library versioning
21 dnl =======================
22 dnl
23 dnl current
24 dnl revision
25 dnl age
26 dnl
27 dnl 1. Start with version information of ‘0:0:0’ for each libtool library.
28 dnl 2. Update the version information only immediately before a public
29 dnl release of your software. More frequent updates are unnecessary, and
30 dnl only guarantee that the current interface number gets larger faster.
31 dnl 3. If the library source code has changed at all since the last
32 dnl update, then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
33 dnl 4. If any interfaces have been added, removed, or changed since the
34 dnl last update, increment current, and set revision to 0.
35 dnl 5. If any interfaces have been added since the last public release,
36 dnl then increment age.
37 dnl 6. If any interfaces have been removed or changed since the last
38 dnl public release, then set age to 0.
39 dnl
40 dnl libwraster
41 WRASTER_CURRENT=4
42 WRASTER_REVISION=0
43 WRASTER_AGE=1
44 WRASTER_VERSION=$WRASTER_CURRENT:$WRASTER_REVISION:$WRASTER_AGE
45 AC_SUBST(WRASTER_VERSION)
46 dnl
47 dnl libWINGs
48 WINGS_CURRENT=2
49 WINGS_REVISION=1
50 WINGS_AGE=0
51 WINGS_VERSION=$WINGS_CURRENT:$WINGS_REVISION:$WINGS_AGE
52 AC_SUBST(WINGS_VERSION)
53 dnl
54 dnl libWUtil
55 WUTIL_CURRENT=2
56 WUTIL_REVISION=0
57 WUTIL_AGE=0
58 WUTIL_VERSION=$WUTIL_CURRENT:$WUTIL_REVISION:$WUTIL_AGE
59 AC_SUBST(WUTIL_VERSION)
62 dnl Checks for host/os name
63 dnl =======================
64 dnl AC_CANONICAL_HOST -- already done by AC_PROG_LIBTOOL
66 dnl Checks for programs.
67 dnl ===================
68 AC_ISC_POSIX
69 AC_PROG_CC
70 AC_PROG_LN_S
71 AC_PROG_GCC_TRADITIONAL
72 AC_PROG_LIBTOOL
74 AX_CFLAGS_GCC_OPTION(-Wall)
75 AX_CFLAGS_GCC_OPTION(-Wextra -Wno-sign-compare -Wno-unused-parameter)
77 dnl Platform-specific Makefile setup
78 dnl ================================
80 case "${host}" in
81         *-*-linux*|*-*-cygwin*)
82                 WM_OSDEP="linux"
83         ;;
84         *-*-freebsd*)
85                 WM_OSDEP="bsd"
86                 CFLAGS="$CFLAGS -DFREEBSD"
87         ;;
88         *-*-netbsd*)
89                 WM_OSDEP="bsd"
90                 CFLAGS="$CFLAGS -DNETBSD"
91         ;;
92         *-*-openbsd*)
93                 WM_OSDEP="bsd"
94         CFLAGS="$CFLAGS -DOPENBSD"
95         ;;
96         *-*-dragonfly*)
97                 WM_OSDEP="bsd"
98                 CFLAGS="$CFLAGS -DDRAGONFLYBSD"
99         ;;
100         *-apple-darwin*)
101                 WM_OSDEP="darwin"
102         ;;
103         *-*-solaris*)
104                 WM_OSDEP="stub"         # solaris.c when done
105         ;;
106         *)
107                 WM_OSDEP="stub"
108                 CFLAGS="-DSTUB_HINT=\\\"${host}\\\""
109         ;;
110 esac
111 AC_SUBST(WM_OSDEP)
114 dnl the prefix
115 dnl ==========
117 dnl move this earlier in the script... anyone know why this is handled
118 dnl in such a bizarre way?
120 test "x$prefix" = xNONE && prefix=$ac_default_prefix
121 dnl Let make expand exec_prefix.
122 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
125 _bindir=`eval echo $bindir`
126 _bindir=`eval echo $_bindir`
128 _libdir=`eval echo $libdir`
129 _libdir=`eval echo $_libdir`
130 lib_search_path="-L$_libdir"
132 inc_search_path=`eval echo $includedir`
133 inc_search_path="-I`eval echo $inc_search_path`"
135 dnl ===============================================
136 dnl Specify paths to look for libraries and headers
137 dnl ===============================================
138 AC_ARG_WITH(libs-from, AS_HELP_STRING([--with-libs-from], [pass compiler flags to look for libraries]),
139         [lib_search_path="$withval $lib_search_path"])
141 AC_ARG_WITH(incs-from, AS_HELP_STRING([--with-incs-from], [pass compiler flags to look for header files]),
142         [inc_search_path="$withval $inc_search_path"])
145 dnl Boehm GC
146 dnl ========
147 with_boehm_gc=no
148 AC_ARG_ENABLE([boehm-gc],
149     [AS_HELP_STRING([--enable-boehm-gc], [use Boehm GC instead of the default libc malloc() [default=no]])],
150     [with_boehm_gc=$enableval])
152 AS_IF([test "x$with_boehm_gc" = "xyes"],
153     AC_SEARCH_LIBS([GC_malloc], [gc],
154         [AC_DEFINE(USE_BOEHM_GC, 1, [Define if Boehm GC is to be used])],
155         [AC_MSG_FAILURE([--enable-boehm-gc specified but test for libgc failed])]
156     )
160 dnl ============================
161 dnl Checks for library functions
162 dnl ============================
163 dnl not used anywhere
164 AC_FUNC_MEMCMP
165 AC_FUNC_VPRINTF
166 AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
167                setsid atexit mallinfo mkstemp sysconf)
169 dnl Check for strlcat/strlcpy
170 dnl =========================
171 AC_ARG_WITH([libbsd],
172   [AS_HELP_STRING([--without-libbsd], [do not use libbsd for strlcat and strlcpy [default=check]])],
173   [AS_IF([test "x$with_libbsd" != "xno"],
174     [with_libbsd=bsd]
175     [with_libbsd=]
176   )],
177   [with_libbsd=bsd])
179 tmp_libs=$LIBS
180 AC_SEARCH_LIBS([strlcat],[$with_libbsd],
181   [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available])],
182   []
184 AC_SEARCH_LIBS([strlcpy],[$with_libbsd],
185   [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcpy is available])],
186   []
188 LIBS=$tmp_libs
190 LIBBSD=
191 AS_IF([test "x$ac_cv_search_strlcat" = "x-lbsd" -o "x$ac_cv_search_strlcpy" = "x-lbsd"],
192   [LIBBSD=-lbsd
193    AC_CHECK_HEADERS([bsd/string.h])]
195 AC_SUBST(LIBBSD)
197 dnl Check for inotify
198 dnl =================
199 AC_CHECK_HEADERS(sys/inotify.h, AC_DEFINE(HAVE_INOTIFY, 1, Check for inotify))
201 dnl Check CPP
202 dnl =========
203 if test "x$CPP_PATH" = x; then
204     AC_PATH_PROG(CPP_PATH, cpp, notfound, 
205                 $PATH:/lib:/usr/bin:/bin:/usr/lib:/usr/ccs/lib)
209 dnl Tell stupid Solaris cpp that the files it will process have C++ like syntax
210 dnl RedHat 5.x is broken too, so it won't make a symlink from cpp to the
211 dnl standard locations
213 if test "$CPP_PATH" = "/usr/ccs/lib/cpp" -o "$CPP_PATH" = "notfound" ; then
214     if test "$GCC" = "yes"; then
215         CPP_PATH="gcc -E -x c"
216     else 
217         if test "$CPP_PATH" = "/usr/ccs/lib/cpp"; then
218             CPP_PATH="$CPP_PATH -B"
219         else
220             echo "cpp, the C preprocessor was not found in your system."
221             echo "Create a symbolic link from it to /lib/cpp and rerun configure"
222             exit
223         fi
224     fi
226 AC_DEFINE_UNQUOTED(CPP_PATH, "$CPP_PATH", [define to the path to cpp])
230 dnl Checks for header files.
231 dnl =======================
232 AC_HEADER_SYS_WAIT
233 AC_HEADER_TIME
234 AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h sys/types.h \
235                  libintl.h sys/select.h poll.h malloc.h ctype.h string.h \
236                  strings.h)
240 dnl Checks for typedefs, structures, and compiler characteristics.
241 dnl ==============================================================
242 AC_DECL_SYS_SIGLIST
243 AC_C_CONST
244 AC_TYPE_SIZE_T
245 AC_TYPE_PID_T
246 AC_TYPE_SIGNAL
249 dnl pkg-config
250 dnl ==========
251 dnl AC_ARG_VAR(PKGCONFIG, [pkg-config command])
252 AC_CHECK_PROG(PKGCONFIG, pkg-config, pkg-config) 
254 dnl gettext
255 dnl =======
257 dnl AM_GNU_GETTEXT
259 INTLIBS=""
261 AC_CHECK_FUNC(gettext, [HAVEGETTEXT="yes"], 
262         AC_CHECK_LIB(intl, gettext, [INTLIBS="-lintl" HAVEGETTEXT="yes"],
263                          INTLIBS="" ))
265 AC_CHECK_PROG(XGETTEXT, xgettext, xgettext)
267 if test "$XGETTEXT" != ""; then 
268     if $XGETTEXT --help 2>&1 | grep illegal >/dev/null ; then
269         echo "xgettext isn't GNU version"
270         XGETTEXT=""
271     fi
274 if test "$LINGUAS" != ""; then
275     if test "$XGETTEXT" != "" -a "$HAVEGETTEXT" != ""; then
276         AC_DEFINE(I18N, 1, [Internationalization (I18N) support (set by configure)])
277         PO=""
278         echo "xgettext and gettext() exist; will build i18n support for $LINGUAS"
279     else
280         LINGUAS=""
281         PO=""
282         echo "xgettext and libintl.a don't both exist; will not build i18n support"
283     fi
284 else
285         INTLIBS=""
286         MOFILES=""
287         WPMOFILES=""
288         UTILMOFILES=""
289         PO=""
293 dnl The Tower of Babel
294 dnl ==================
296 dnl List of supported locales
297 dnl =========================
298 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"
299 supported_wprefs_locales="bg ca cs de es et fi fr hr hu it ja ko pt ru sk zh_CN zh_TW"
300 supported_wings_locales="bg ca cs de fr sk"
301 supported_util_locales="de"
303 for lang in $LINGUAS; do
304         ok=0
305         for l in $supported_locales; do
306                 if test "$l" = "$lang"; then
307                         ok=1
308                         break
309                 fi
310         done
311         if test "$ok" = 1; then
312                 MOFILES="$MOFILES $lang.mo"
313         else
314                 echo "Locale $lang is not supported."
315         fi
316         ok=0
317         for l in $supported_wprefs_locales; do
318                 if test "$l" = "$lang"; then
319                         ok=1
320                         break
321                 fi
322         done
323         if test "$ok" = 1; then
324                 WPMOFILES="$WPMOFILES $lang.mo"
325         fi
326         ok=0
327         for l in $supported_util_locales; do
328                 if test "$l" = "$lang"; then
329                         ok=1
330                         break
331                 fi
332         done
333         if test "$ok" = 1; then
334                 UTILMOFILES="$UTILMOFILES $lang.mo"
335         fi
336         ok=0
337         for l in $supported_wings_locales; do
338                 if test "$l" = "$lang"; then
339                         ok=1
340                         break
341                 fi
342         done
343         if test "$ok" = 1; then
344                 WINGSMOFILES="$WINGSMOFILES $lang.mo"
345         fi
346 done
349 dnl Added by Oliver - Support for NLSDIR option
350 dnl ===========================================
351 AC_ARG_WITH(nlsdir, AS_HELP_STRING([--with-nlsdir=PATH], [specify where the locale stuff should go]))
353 if test "x$NLSDIR" = "x"; then
354         if test "x$with_nlsdir" != "x"; then
355                 NLSDIR=$with_nlsdir
356         else
357                 NLSDIR='$(prefix)/lib/locale'
358         fi
361 AC_ARG_WITH(menu-textdomain, AS_HELP_STRING([--with-menu-textdomain=DOMAIN], [specify gettext domain used for menu translations]),
362         [if test "x$withval" != "xno"; then
363          AC_DEFINE_UNQUOTED([MENU_TEXTDOMAIN], ["$withval"], [gettext domain used for menu translations])
364          fi])
366 AC_SUBST(INTLIBS)
367 AC_SUBST(NLSDIR)
368 AC_SUBST(MOFILES)
369 AC_SUBST(WPMOFILES)
370 AC_SUBST(UTILMOFILES)
371 AC_SUBST(WINGSMOFILES)
372 AC_SUBST(supported_locales)
374 dnl ===========================================
375 dnl             Stuff that uses X
376 dnl ===========================================
378 AC_PATH_XTRA
380 if test $no_x; then
381     AC_MSG_ERROR([The path for the X11 files not found!
382 Make sure you have X and it's headers and libraries (the -devel packages
383 in Linux) installed.])
386 X_LIBRARY_PATH=$x_libraries
387 XCFLAGS="$X_CFLAGS"
388 XLFLAGS="$X_LIBS"
389 XLIBS="-lX11 $X_EXTRA_LIBS"
390 LIBXMU="-lXmu"
391 AC_SUBST(LIBXMU)
393 lib_search_path="$lib_search_path $XLFLAGS"
394 inc_search_path="$inc_search_path $XCFLAGS"
396 AC_SUBST(X_LIBRARY_PATH)
398 dnl Decide which locale function to use, setlocale() or _Xsetlocale()
399 dnl by MANOME Tomonori 
400 dnl ===========================================
401 use_locale=yes
402 AC_ARG_ENABLE(locale, AS_HELP_STRING([--disable-locale], [disable use of X locale support]),
403               use_locale=no)
405 if test "$use_locale" = yes; then
406         AC_CHECK_LIB(X11, _Xsetlocale,
407                 AC_DEFINE(X_LOCALE, 1, [define if you want support for X window's X_LOCALE (set by configure)]),,
408                 $XLFLAGS $XLIBS)
411 dnl Check whether XInternAtoms() exist
412 dnl ==================================
413 AC_CHECK_LIB(X11, XInternAtoms, 
414              AC_DEFINE(HAVE_XINTERNATOMS, 1, [define if your X server has XInternAtoms() (set by configure)]),,
415              $XLFLAGS $XLIBS)
417 dnl Check whether XConvertCase() exist
418 dnl ==================================
419 AC_CHECK_LIB(X11, XConvertCase, 
420              AC_DEFINE(HAVE_XCONVERTCASE, 1, [define if your X server has XConvertCase() (set by configure)]),,
421              $XLFLAGS $XLIBS)
423 dnl XKB keyboard language status
424 dnl ============================
425 AC_ARG_ENABLE(modelock, AS_HELP_STRING([--enable-modelock], [XKB keyboard language status support]),
426                 AC_DEFINE(XKB_MODELOCK, 1, [whether XKB language MODELOCK should be enabled]))
428 dnl Shape support
429 dnl =============
430 shape=yes
431 AC_ARG_ENABLE(shape, AS_HELP_STRING([--disable-shape], [disable shaped window extension support]),
432                 shape=$enableval, shape=yes)
433 added_xext=no
435 if test "$shape" = yes; then
436         AC_CHECK_LIB(Xext, XShapeSelectInput, [XLIBS="-lXext $XLIBS"
437                 added_xext=yes
438                 AC_DEFINE(SHAPE, 1, [define if you want support for shaped windows (set by configure)])], 
439                 shape=no, $XLFLAGS $XLIBS)
442 dnl XRandR support
443 dnl ==============
444 xrandr=no
445 AC_ARG_ENABLE(xrandr, AS_HELP_STRING([--enable-xrandr], [enable XRandR window extension support]),
446                 xrandr=$enableval, xrandr=no)
447 added_xext=no
449 LIBXRANDR=
450 if test "$xrandr" = yes; then
451         AC_CHECK_LIB(Xrandr, XRRQueryExtension, [LIBXRANDR=-lXrandr
452                 added_xext=yes
453                 AC_DEFINE(HAVE_XRANDR, 1, [define if you want support for XRandR (set by configure)])],
454                 xrandr=no, $XLFLAGS $XLIBS)
456 AC_SUBST(LIBXRANDR)
459 dnl libWINGS uses math functions, check whether usage requires linking
460 dnl against libm
462 AC_CHECK_FUNC(atan,[mathneedslibm=no;LIBM=],[mathneedslibm=dunno])
463 if test "x$mathneedslibm" = "xdunno" ; then
464         AC_CHECK_LIB(m, atan, [LIBM=-lm])
466 AC_SUBST(LIBM)
470 dnl libWINGS uses FcPatternDel from libfontconfig
472 AC_MSG_CHECKING([for fontconfig library])
473 FCLIBS=`$PKGCONFIG fontconfig --libs`
474 if test "x$FCLIBS" = "x" ; then
475         AC_MSG_RESULT([not found])
476 else
477         AC_MSG_RESULT([found])
479 AC_SUBST(FCLIBS)
482 dnl Xft2 antialiased font support
483 dnl =============================
485 xft=yes
486 XFTLIBS=""
488 if test "x$PKGCONFIG" != x -a "`$PKGCONFIG xft; echo $?`" = 0; then
489         XFTCONFIG="$PKGCONFIG xft"
490         pkgconfig_xft=yes
491 else
492         AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config)
495 AC_MSG_CHECKING([for the Xft2 library])
497 if test "x$XFTCONFIG" != x; then
498         XFTLIBS=`$XFTCONFIG --libs`
499         XFTFLAGS=`$XFTCONFIG --cflags`
500         AC_MSG_RESULT([found])
501 else
502         AC_MSG_RESULT([not found])
503         echo
504         echo "ERROR!!! libXft2 is not installed or could not be found."
505         echo "         Xft2 is a requirement for building Window Maker."
506         echo "         Please install it (along with fontconfig) before continuing."
507         echo
508         exit 1
511 minXFT="2.1.0"
512 goodxft="no"
515 dnl The macro below will use $XFTFLAGS (defined above) to find Xft.h
517 WM_CHECK_XFT_VERSION($minXFT, goodxft=yes, goodxft=no)
519 if test "$goodxft" = no; then
520         echo
521         echo "ERROR!!! libXft on this system is an old version."
522         echo "         Please consider upgrading to at least version ${minXFT}."
523         echo
524         exit 1
527 AC_SUBST(XFTFLAGS)
528 AC_SUBST(XFTLIBS)
531 dnl XINERAMA support
532 dnl ================
533 xinerama=no
534 AC_ARG_ENABLE(xinerama, AS_HELP_STRING([--enable-xinerama], [enable Xinerama extension support]),
535                 xinerama=$enableval, xinerama=no)
537 LIBXINERAMA=
538 if test "$xinerama" = yes; then
539         AC_CHECK_LIB(Xinerama, XineramaQueryScreens, 
540                 [LIBXINERAMA=-lXinerama
541                 xfxine=yes],
542                 xfxine=no, $XLFLAGS $XLIBS)
544         AC_CHECK_LIB(Xext, XineramaGetInfo,
545                 [sunxine=yes
546                 ], sunxine=no, $XLFLAGS $XLIBS)
548         if test "$xfxine" = yes; then
549                 xine=1
550         fi
552         if test "$sunxine" = yes; then
553             xine=1
554             AC_DEFINE(SOLARIS_XINERAMA, 1, 
555                 [define if you want support for the XINERAMA extension and are in Solaris (set by configure)])
556         fi
558         if test "$xine" = 1; then
559             AC_DEFINE(XINERAMA, 1, 
560                 [define if you want support for the XINERAMA extension (set by configure)])
561         fi
563 AC_SUBST(LIBXINERAMA)
566 dnl MIT-SHM support
567 dnl ===============
568 shm=yes
569 AC_ARG_ENABLE(shm, AS_HELP_STRING([--disable-shm], [disable usage of MIT-SHM extension]),
570                 shm=$enableval, shm=yes)
572 if test "$shm" = yes; then
573         AC_CHECK_LIB(Xext, XShmAttach, ok=yes, ok=no, $XLFLAGS $XLIBS)
575         if test "$ok" = yes; then
576         AC_CHECK_FUNC(shmget, ok=yes, ok=no)
577         fi
579         if test "$ok" = yes; then
580                 if test "$added_xext" = no; then
581                         XLIBS="-lXext $XLIBS"
582                 fi
583                 AC_DEFINE(XSHM, 1, [define if X's shared memory extension is available (set by configure)])
584         fi
588 dnl R6 Style Session Management Support
589 dnl ===================================
593 #AC_DEFINE(R6SM)
594 #AC_SUBST(XSMPLIBS)
598 dnl ==============================================
599 dnl         Graphic Format Libraries
600 dnl ==============================================
602 dnl XPM Support
603 dnl ===========
604 xpm=yes
605 AC_ARG_ENABLE(xpm, AS_HELP_STRING([--disable-xpm], [disable use of XPM pixmaps through libXpm]),
606         xpm=$enableval, xpm=yes)
608 if test "$xpm" = yes; then
609     WM_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [$XLFLAGS $XLIBS])
611     if test "x$ac_cv_lib_Xpm_XpmCreatePixmapFromData" = xyes; then
612         WM_CHECK_HEADER(X11/xpm.h)
613         if test "x$ac_cv_header_X11_xpm_h" = xyes; then
614                 GFXLIBS="$GFXLIBS -lXpm"
615                 supported_gfx="XPM"
616                 AC_DEFINE(USE_XPM, 1, [define if XPM libraries are available (set by configure)])
617         else
618                 supported_gfx="builtin-XPM"
619         fi
620     fi
623 AC_SUBST(XLFLAGS)
624 AC_SUBST(XLIBS)
625 AC_SUBST(X_EXTRA_LIBS)
627 dnl ===============================================
628 dnl             End of stuff that uses X
629 dnl ===============================================
631 dnl PNG Support
632 dnl ===========
633 png=yes
634 AC_ARG_ENABLE(png, AS_HELP_STRING([--disable-png], [disable PNG support through libpng]),
635         png=$enableval, png=yes, png=no)
637 if test "$png" = yes ; then
638     my_libname=""
639     WM_CHECK_LIB(png, png_get_valid, [-lm])
640     if test "x$ac_cv_lib_png_png_get_valid" = xyes; then
641         my_libname="-lpng"
642     fi
644 dnl Retry with zlib
646     if test "x$my_libname" = x; then
647         unset ac_cv_lib_png_png_get_valid
648         WM_CHECK_LIB(png, png_get_valid, [-lz -lm])
649         if test "x$ac_cv_lib_png_png_get_valid" = xyes; then
650             my_libname="-lpng -lz"
651         fi
652     fi
654     if test "x$ac_cv_lib_png_png_get_valid" = xyes; then
655         WM_CHECK_HEADER(png.h)
656         if test "x$ac_cv_header_png_h" = xyes; then
657             GFXLIBS="$GFXLIBS $my_libname"
658             supported_gfx="$supported_gfx PNG"
659             AC_DEFINE(USE_PNG, 1, [define if PNG libraries are available (set by configure)])
660         fi
661     fi
665 dnl JPEG Support
666 dnl ============
667 jpeg=yes
668 ljpeg=""
669 AC_ARG_ENABLE(jpeg, AS_HELP_STRING([--disable-jpeg], [disable JPEG support through libjpeg]),
670         jpeg=$enableval, jpeg=yes, jpeg=no)
672 if test "$jpeg" = yes; then
673     WM_CHECK_LIB(jpeg, jpeg_destroy_compress)
675     if test "x$ac_cv_lib_jpeg_jpeg_destroy_compress" = xyes; then
677         ljpeg="-ljpeg"
679         WM_CHECK_HEADER(jpeglib.h)
680         if test "x$ac_cv_header_jpeglib_h" = xyes; then
681             GFXLIBS="$GFXLIBS -ljpeg"
682             supported_gfx="$supported_gfx JPEG"
683             AC_DEFINE(USE_JPEG, 1, [define if JPEG libraries are available (set by configure)])
684         fi
685     fi
689 dnl GIF Support
690 dnl ============
691 gif=yes
692 AC_ARG_ENABLE(gif, AS_HELP_STRING([--disable-gif], [disable GIF support through libgif or libungif]),
693         gif=$enableval, gif=yes, gif=no)
695 if test "$gif" = yes; then
696     my_libname=""
697     WM_CHECK_LIB(ungif, DGifOpenFileName, [$XLFLAGS $XLIBS])
698     if test "x$ac_cv_lib_ungif_DGifOpenFileName" = xyes; then
699         my_libname=-lungif
700     fi
702 dnl libungif is the same thing as libgif for all practical purposes.
704     if test "x$my_libname" = x; then
705         WM_CHECK_LIB(gif, DGifOpenFileName, [$XLFLAGS $XLIBS])
706         if test "x$ac_cv_lib_gif_DGifOpenFileName" = xyes; then
707             my_libname=-lgif
708         fi
709     fi
711     if test "$my_libname" != x; then
712         WM_CHECK_HEADER(gif_lib.h)
713         if test "x$ac_cv_header_gif_lib_h" = xyes; then
714             GFXLIBS="$GFXLIBS $my_libname"
715             supported_gfx="$supported_gfx GIF"
716             AC_DEFINE(USE_GIF, 1, [define if GIF libraries are available (set by configure)])
717         fi
718     fi
723 dnl TIFF Support
724 dnl ============
725 AC_ARG_ENABLE(tiff, 
726 AS_HELP_STRING([--disable-tiff], [disable use of TIFF images through libtiff]),
727         tif=$enableval, tif=yes, tif=no)
730 # TIFF can optionally have JPEG and/or zlib support. Must find out
731 # when they are supported so that correct library flags are passed during
732 # detection and linkage
735 # By default use xpm icons if tiff is not found.
736 ICONEXT="xpm"
739 if test "$tif" = yes; then
740     my_libname=""
741     WM_CHECK_LIB(tiff, TIFFGetVersion, [-lm])
742     if test "x$ac_cv_lib_tiff_TIFFGetVersion" = xyes; then
743         my_libname="-ltiff"
744     fi
746 dnl Retry with zlib
748     unset ac_cv_lib_tiff_TIFFGetVersion
749     if test "x$my_libname" = x; then
750         WM_CHECK_LIB(tiff, TIFFGetVersion, [$ljpeg -lz -lm])
751         if test "x$ac_cv_lib_tiff_TIFFGetVersion" = xyes; then
752             my_libname="-ltiff -lz"
753         fi
754     fi
756     if test "x$my_libname" = x; then
757         WM_CHECK_LIB(tiff34, TIFFGetVersion, [$ljpeg -lm])
758         if test "x$ac_cv_lib_tiff34_TIFFGetVersion" = xyes; then
759             my_libname="-ltiff34"
760         fi
761     fi
764     if test "x$my_libname" != x; then
765         WM_CHECK_HEADER(tiffio.h)
766         if test "x$ac_cv_header_tiffio_h" = xyes; then
767             GFXLIBS="$my_libname $GFXLIBS"
768             ICONEXT="tiff"
769             supported_gfx="$supported_gfx TIFF"
770             AC_DEFINE(USE_TIFF, 1, [define if TIFF libraries are available (set by configure)])     
771         fi
772     fi
775 LIBRARY_SEARCH_PATH="$lib_search_path"
776 HEADER_SEARCH_PATH="$inc_search_path"
778 AC_SUBST(LIBRARY_SEARCH_PATH)
779 AC_SUBST(HEADER_SEARCH_PATH)
782 AC_SUBST(GFXLIBS)
783 AC_SUBST(ICONEXT)
786 dnl ==============================================
787 dnl         End of Graphic Format Libraries
788 dnl ==============================================
792 dnl stdlib.h is checked here, because of conflict in jpeglib.h
793 AC_CHECK_HEADERS(stdlib.h)
795 # AC_PREFIX_PROGRAM(wmaker)
797 dnl Support for PIXMAPDIR option
798 dnl ============================
799 AC_ARG_WITH(pixmapdir, AS_HELP_STRING([--with-pixmapdir=PATH], [specify where pixmaps are located [DATADIR/pixmaps]]))
801 if test "x$with_pixmapdir" != "x"; then
802         pixmapdir=$with_pixmapdir
803 else
804         pixmapdir=`eval echo ${datadir}/pixmaps`
807 AC_DEFINE_UNQUOTED(PIXMAPDIR, "$pixmapdir", [define an extra path for pixmaps (set by configure)])
809 pkgdatadir=`eval echo $datadir`
810 AC_DEFINE_UNQUOTED(PKGDATADIR, "$pkgdatadir/WindowMaker", [where shared data is stored (defined by configure)])
812 _sysconfdir=`eval echo $sysconfdir`
813 AC_DEFINE_UNQUOTED(SYSCONFDIR, "$_sysconfdir", [where the configuration is stored (defined by configure)])
816 dnl Support for GNUSTEP_LOCAL_ROOT, for WPrefs.app
817 dnl ==============================================
819 AC_ARG_WITH(gnustepdir, AS_HELP_STRING([--with-gnustepdir=PATH], [specify the directory for GNUstep applications]))
821 if test "x`echo $with_gnustepdir | grep ^/`" != "x"; then
822     appspath=$with_gnustepdir
825 if test "x$appspath$GNUSTEP_LOCAL_ROOT" = "x"; then
826     wprefs_base_dir=${prefix}
827     wprefs_datadir="${datadir}/WPrefs"
828     wprefs_bindir="${bindir}"
829 else
830     gnustepdir=$appspath
832     if test "x$GNUSTEP_LOCAL_ROOT" != "x" ; then
833         gnustepdir=`echo "$GNUSTEP_LOCAL_ROOT" | sed -e "s|^${prefix}|prefix|"`
834         gnustepdir=`echo $gnustepdir | sed -e 's|^prefix|${prefix}|'`
835     fi
837     wprefs_base_dir=$gnustepdir/Applications
838     wprefs_datadir=$wprefs_base_dir/WPrefs.app
839     wprefs_bindir=$wprefs_base_dir/WPrefs.app
842 AC_SUBST(wprefs_datadir)
843 AC_SUBST(wprefs_bindir)
846 dnl Enable User Defined Menu thing
847 dnl ==============================
848 AC_ARG_ENABLE(usermenu, AS_HELP_STRING([--enable-usermenu], [user defined menus for applications]),
849 if test "$enableval" = yes; then
850         AC_DEFINE(USER_MENU, 1, [define if you want user defined menus for applications])
854 gl_LD_VERSION_SCRIPT
856 AC_OUTPUT(Makefile po/Makefile util/Makefile util/po/Makefile \
857         WINGs/Makefile WINGs/WINGs/Makefile WINGs/Documentation/Makefile \
858         WINGs/Examples/Makefile WINGs/Resources/Makefile WINGs/Tests/Makefile \
859         WINGs/Extras/Makefile WINGs/po/Makefile \
860         wrlib/Makefile wrlib/tests/Makefile \
861         src/Makefile src/wconfig.h \
862         doc/Makefile doc/sk/Makefile doc/cs/Makefile \
863         doc/ru/Makefile \
864         WindowMaker/Makefile WindowMaker/Backgrounds/Makefile \
865         WindowMaker/Defaults/Makefile WindowMaker/IconSets/Makefile \
866         WindowMaker/Icons/Makefile WindowMaker/Pixmaps/Makefile \
867         WindowMaker/Styles/Makefile WindowMaker/Themes/Makefile \
868         WPrefs.app/Makefile WPrefs.app/tiff/Makefile WPrefs.app/xpm/Makefile \
869         WPrefs.app/po/Makefile )
872 dnl Output some helpful data for compiling wraster and WINGs/WUtil apps
873 dnl ===================================================================
875 dnl echo "WFLAGS=\"$LIBPL_INC_PATH -I$prefix/include\"" > WINGs-flags
876 dnl echo "WLIBS=\"-L$exec_prefix/lib -lWINGs -lwraster $LIBPL_LIBS $GFXLIBS -lm\""\
877 dnl     | sed -e 's|\$(prefix)|'"$prefix|" >> WINGs-flags
879 dnl The #lp# and #rp# stuff below is a hack because [ and ] get lost when
880 dnl parsed by m4
882 cat <<EOF >get-wraster-flags
883 #!/bin/sh
885 WCFLAGS="$inc_search_path"
886 WLFLAGS="$lib_search_path"
887 WLIBS="-lwraster $GFXLIBS $XLIBS -lm"
889 usage="Usage: get-wraster-flags #lp#--cflags#rp# #lp#--ldflags#rp# #lp#--libs#rp#"
891 if test \$# -eq 0; then
892       echo "\${usage}" 1>&2
893       exit 1
896 while test \$# -gt 0; do
897   case \$1 in
898     --cflags)
899         echo \$WCFLAGS
900         ;;
901     --ldflags|--lflags)
902         echo \$WLFLAGS
903         ;;
904     --libs)
905         echo \$WLIBS
906         ;;
907     *)
908         echo "\${usage}" 1>&2
909         exit 1
910         ;;
911   esac
912   shift
913 done
918 cat <<EOF > wrlib/wrlib.pc
919 Name: wrlib
920 Description: Image manipulation and conversion library
921 Version: $VERSION
922 Libs: $lib_search_path -lwraster $GFXLIBS $XLIBS -lm
923 Cflags: $inc_search_path
926 cat <<EOF >get-wings-flags
927 #!/bin/sh
929 WCFLAGS="$inc_search_path"
930 WLFLAGS="$lib_search_path"
931 WLIBS="-lWINGs -lWUtil -lwraster $GFXLIBS $XFTLIBS $XLIBS -lm $INTLIBS"
933 usage="Usage: get-wings-flags #lp#--cflags#rp# #lp#--ldflags#rp# #lp#--libs#rp#"
935 if test \$# -eq 0; then
936       echo "\${usage}" 1>&2
937       exit 1
940 while test \$# -gt 0; do
941   case \$1 in
942     --cflags)
943         echo \$WCFLAGS
944         ;;
945     --ldflags|--lflags)
946         echo \$WLFLAGS
947         ;;
948     --libs)
949         echo \$WLIBS
950         ;;
951     *)
952         echo "\${usage}" 1>&2
953         exit 1
954         ;;
955   esac
956   shift
957 done
962 cat <<EOF > WINGs/WINGs.pc
963 Name: WINGs
964 Description: Small widget set with the NeXTStep(TM) look and feel
965 Version: $VERSION
966 Requires: wrlib
967 Libs: $lib_search_path -lWINGs $XFTLIBS $XLIBS -lm $INTLIBS
968 Cflags: $inc_search_path
971 cat <<EOF >get-wutil-flags
972 #!/bin/sh
974 WCFLAGS="-I`eval echo ${includedir}`"
975 WLFLAGS="-L${_libdir}"
976 WLIBS="-lWUtil $INTLIBS"
978 usage="Usage: get-wutil-flags #lp#--cflags#rp# #lp#--ldflags#rp# #lp#--libs#rp#"
980 if test \$# -eq 0; then
981       echo "\${usage}" 1>&2
982       exit 1
985 while test \$# -gt 0; do
986   case \$1 in
987     --cflags)
988         echo \$WCFLAGS
989         ;;
990     --ldflags|--lflags)
991         echo \$WLFLAGS
992         ;;
993     --libs)
994         echo \$WLIBS
995         ;;
996     *)
997         echo "\${usage}" 1>&2
998         exit 1
999         ;;
1000   esac
1001   shift
1002 done
1007 sed 's/#lp#/[/g' get-wraster-flags | sed 's/#rp#/]/g' > wrlib/get-wraster-flags
1008 sed 's/#lp#/[/g' get-wings-flags | sed 's/#rp#/]/g' > WINGs/get-wings-flags
1009 sed 's/#lp#/[/g' get-wutil-flags | sed 's/#rp#/]/g' > WINGs/get-wutil-flags
1011 chmod 755 wrlib/get-wraster-flags WINGs/get-wings-flags WINGs/get-wutil-flags
1013 rm -f get-wraster-flags get-wings-flags get-wutil-flags
1017 dnl Spit out the configuration
1018 dnl ==========================
1020 supported_gfx="$supported_gfx builtin-PPM"
1022 if test "x$MOFILES" = "x"; then
1023         mof=None
1024 else
1025         mof=`echo $MOFILES`
1028 if test "x$MOFILES" = "x"; then
1029         languages=None
1030 else
1031         languages=`echo $MOFILES | sed 's/.mo//g'`
1034 echo
1035 echo "Window Maker was configured as follows:"
1036 echo
1037 echo "Installation path prefix            : $prefix"
1038 echo "Installation path for binaries      : $_bindir"
1039 echo "Installation path for WPrefs.app    : $wprefs_base_dir" | sed -e 's|\${prefix}|'"$prefix|"
1040 echo "Supported graphic format libraries  : $supported_gfx"
1041 echo "Antialiased text support in WINGs   : $xft"
1042 echo "Xinerama extension support          : $xinerama"
1043 echo "XRandR extension support            : $xrandr"
1044 echo "Translated message files to install : $mof"
1045 dnl echo "Supported languages beside English  : $languages"
1046 if test "x$MOFILES" != "x"; then
1047         echo "Installation path for translations  : $NLSDIR" | sed -e 's|\$(prefix)|'"$prefix|"
1049 echo
1051 dnl WM_PRINT_REDCRAP_BUG_STATUS
1053 if test "x$ac_cv_header_jpeglib_h" != xyes; then
1054 echo "WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"
1055 echo
1056 echo "JPEG support will not be included because the JPEG library is"
1057 echo "not installed correctly or was not found. Background images"
1058 echo "from themes will not display as they usually are JPEG files."
1059 echo
1060 echo "To fix, download and install the jpeg library and/or make sure you"
1061 echo "installed all jpeg related packages, SPECIALLY the development packages"
1062 echo "like jpeg-devel (if you use some prepackaged version of libjpeg)."
1063 echo
1064 echo "WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"
1068 dnl This is for Emacs.  I'm lazy, I know... (nicolai)
1069 dnl ================================================
1070 dnl Local Variables:
1071 dnl compile-command: "autoconf"
1072 dnl End: