Initial revision
[wmaker-crm.git] / configure.in
blob107af9da8799f3da467631ca27f7e53287e29181
1 dnl 
2 dnl WindowMaker autoconf input.
3 dnl 
4 dnl Process with: aclocal; autoconf; automake
7 AC_INIT(src/WindowMaker.h)
9 AM_INIT_AUTOMAKE(WindowMaker, 0.20.1)
14 AM_CONFIG_HEADER(src/config.h)
17 dnl Checks for host/os name
18 dnl =======================
19 AC_CANONICAL_HOST
22 dnl Checks for programs.
23 dnl ===================
24 AC_ISC_POSIX
25 AC_PROG_CC
26 AC_PROG_MAKE_SET
27 AC_PROG_RANLIB
28 AC_PROG_INSTALL
29 AC_PROG_LN_S
30 AC_PROG_GCC_TRADITIONAL
33 dnl Checks for library functions.
34 dnl ============================
35 dnl not used anywhere
36 dnl AC_FUNC_MEMCMP  
37 AC_TYPE_SIGNAL
38 AC_FUNC_VPRINTF
39 AC_FUNC_ALLOCA
40 AC_CHECK_FUNCS(gethostname gettimeofday select poll strerror strncasecmp setpgid)
43 AC_PATH_PROG(CPP_PATH, cpp, notfound,
44         /lib:/usr/bin:/bin:/usr/lib:/usr/ccs/lib:$PATH)
46 dnl
47 dnl Tell stupid Solaris cpp that the files it will process have C++ like syntax
48 dnl RedHat 5.x is broken too, so it won't make a symlink from cpp to the
49 dnl standard locations
50 dnl
51 if test "$CPP_PATH" = "/usr/ccs/lib/cpp" -o "$CPP_PATH" = "notfound" ; then
52     if test "$GCC" = "yes"; then
53         CPP_PATH="gcc -E -x c"
54     else 
55         if test "$CPP_PATH" = "/usr/ccs/lib/cpp"; then
56             CPP_PATH="$CPP_PATH -B"
57         else
58             echo "cpp, the C preprocessor was not found in your system."
59             echo "Create a symbolic link from it to /lib/cpp and rerun configure"
60             exit
61         fi
62     fi
64 AC_DEFINE_UNQUOTED(CPP_PATH, "$CPP_PATH")
66 dnl gettext
67 dnl =======
70 dnl AM_GNU_GETTEXT
74 INTLIBS=""
77 AC_CHECK_FUNC(gettext, [HAVEGETTEXT="yes"], 
78         AC_CHECK_LIB(intl, gettext, [INTLIBS="-lintl" HAVEGETTEXT="yes"],
79                          INTLIBS="" ))
81 AC_CHECK_PROG(XGETTEXT, xgettext, xgettext)
83 if test "$XGETTEXT" != ""; then 
84     if $XGETTEXT --help 2>&1 | grep illegal >/dev/null ; then
85         echo "xgettext isn't GNU version"
86         XGETTEXT=""
87     fi
90 if test "$LINGUAS" != ""; then
91     if test "$XGETTEXT" != "" -a "$HAVEGETTEXT" != ""; then
92         I18N="-DI18N"
93         PO=""
94 #       if test "$LINGUAS" = ""; then
95 #           ling=` (cd src/po; /bin/ls *.po) `
96 #           for l in $ling; do
97 #               lcode=`basename $l .po`
98 #               LINGUAS="$LINGUAS $lcode"
99 #           done
100 #       fi
101         echo "xgettext and gettext() exist; will build i18n support for $LINGUAS"
102     else
103         I18N=""
104         LINGUAS=""
105         PO=""
106         echo "xgettext and libintl.a don't both exist; will not build i18n support"
107     fi
108 else
109         INTLIBS=""
110         MOFILES=""
111         WPMOFILES=""
112         PO=""
116 dnl The Tower of Babel
117 dnl ==================
119 dnl List of supported locales
120 dnl -------------------------
121 supported_locales="cs de es fr gl it ja ko nl no pt ru se tr fi hr el"
122 supported_wprefs_locales="pt hr fr ko"
124 for lang in $LINGUAS; do
125         ok=0
126         for l in $supported_locales; do
127                 if test "$l" = "$lang"; then
128                         ok=1
129                         break
130                 fi
131         done
132         if test "$ok" = 1; then
133                 MOFILES="$MOFILES $lang.mo"
134         else
135                 echo "Locale $lang is not supported."
136         fi
137         ok=0
138         for l in $supported_wprefs_locales; do
139                 if test "$l" = "$lang"; then
140                         ok=1
141                         break
142                 fi
143         done
144         if test "$ok" = 1; then
145                 WPMOFILES="$WPMOFILES $lang.mo"
146         fi
147 done
150 dnl Kanji Characters support
151 dnl ========================
152 I18n=no
153 AC_ARG_ENABLE(kanji,
154 [  --enable-kanji         multibyte character support (kanji, Korean etc.)],,
155                 enable_kanji=no)
157 if test "$enable_kanji" = yes; then
158         I18N_MB="#define I18N_MB"
159         case $host_os in
160         freebsd*)
161                 AC_CHECK_LIB(xpg4, setlocale, [LIBS="$LIBS -lxpg4"]);;
162         *)
163                 ;;
164         esac
165 else
166         I18N_MB="#undef I18N_MB"
168 AC_SUBST(I18N_MB)
171 dnl Added by Oliver - Support for NLSDIR option,   Hi Oliver!
172 dnl ===========================================
173 AC_ARG_WITH(nlsdir, 
174         [  --with-nlsdir=PATH      specify where the locale stuff should go ])
176 if test "x$NLSDIR" = "x"; then
177         if test "x$with_nlsdir" != "x"; then
178                 NLSDIR=$with_nlsdir
179         else
180                 NLSDIR="/usr/lib/locale"
181         fi
184 dnl Put it back once we have some real gnome support...
186 dnl AC_ARG_WITH(gnome, 
187 dnl     [  --with-gnome            enable support for GNOME extensions ],
188 dnl     [with_gnome=$withval], [with_gnome=yes])
189 dnl AC_MSG_CHECKING([for GNOME support])
190 dnl if test "x$with_gnome" = "xyes"; then
191 dnl     HAVE_GNOME="#define MWM_HINTS"
192 dnl     AC_MSG_RESULT(yes)
193 dnl else
194 dnl     HAVE_GNOME="#undef MWM_HINTS"
195 dnl     AC_MSG_RESULT(no)
196 dnl fi
197 dnl AC_SUBST(HAVE_GNOME)
199 AC_SUBST(I18N)
200 AC_SUBST(INTLIBS)
201 AC_SUBST(NLSDIR)
202 AC_SUBST(MOFILES)
203 AC_SUBST(WPMOFILES)
206 dnl ===========================================
207 dnl             Stuff that uses X
208 dnl ===========================================
210 AC_PATH_XTRA
212 XCFLAGS="$X_CFLAGS"
214 XLFLAGS="$X_LIBS"
216 XLIBS="$X_EXTRA_LIBS -lX11"
218 dnl Decide which locale function to use, setlocale() or _Xsetlocale()
219 dnl by MANOME Tomonori 
220 dnl ===========================================
221 AC_CHECK_LIB(X11, _Xsetlocale, [X_LOCALE="-DX_LOCALE"],, $XLFLAGS $XLIBS)
222 AC_SUBST(X_LOCALE)
225 dnl Shape support
226 dnl =============
227 shape=yes
228 AC_ARG_ENABLE(shape, 
229 [  --disable-shape        disable shaped window extension support],
230                 shape=$enableval, shape=yes)
232 added_xext=no
234 if test "$shape" = yes; then
235         AC_CHECK_LIB(Xext, XShapeSelectInput, [XLIBS="-lXext $XLIBS"
236                 added_xext=yes SHAPE=-DSHAPE], shape=no, $XLFLAGS $XLIBS)
239 AC_SUBST(SHAPE)
242 dnl MIT-SHM support
243 dnl ===============
244 shm=yes
245 AC_ARG_ENABLE(shm,
246 [  --disable-shm                disable usage of MIT-SHM extension],
247                 shm=$enableval, shm=yes)
249 if test "$shm" = yes; then
250         AC_CHECK_LIB(Xext, XShmAttach, ok=yes, ok=no, $XLFLAGS $XLIBS)
252         if test "$ok" = yes; then
253         AC_CHECK_FUNC(shmget, ok=yes, ok=no)
254         fi
256         if test "$ok" = yes; then
257                 if test "$added_xext" = no; then
258                         XLIBS="-lXext $XLIBS"
259                 fi
260                 XSHM=-DXSHM
261         fi
264 AC_SUBST(XSHM)
266 dnl ==============================================
267 dnl         Graphic Format Libraries
268 dnl ==============================================
271 dnl Specify paths to look for graphic format libraries
272 dnl ==================================================
273 AC_ARG_WITH(gfx-libs,
274 [  --with-gfx-libs        pass compiler flags to look for gfx libraries],
275         [GFXLIBS="$withval" GFX_LIB_PATH=$withval],
276         [GFXLIBS="" GFX_LIB_PATH=""])
278 AC_ARG_WITH(gfx-incs,
279 [  --with-gfx-incs        pass compiler flags to look for gfx header files],
280         [GFXFLAGS="$withval" GFX_INC_PATH=$withval],
281         [GFXFLAGS="" GFX_INC_PATH=""])
286 dnl XPM Support
287 dnl ===========
288 xpm=yes
289 AC_ARG_ENABLE(xpm, 
290 [  --disable-xpm                  disable use of XPM pixmaps through libXpm],
291         xpm=$enableval, xpm=yes)
293 if test "$xpm" = yes; then
294     AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData,
295         [GFXFLAGS="$GFXFLAGS -DUSE_XPM" GFXLIBS="$GFXLIBS -lXpm"],,
296         $GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS $XLIBS)
301 AC_SUBST(XLIBS)
302 AC_SUBST(XCFLAGS)
303 AC_SUBST(XLFLAGS)
305 AC_SUBST(X_EXTRA_LIBS)
307 dnl ===============================================
308 dnl             End of stuff that uses X
309 dnl ===============================================
311 dnl test for zlib
312 dnl =============
314 AC_CHECK_LIB(z, gzread, zlib=yes, zlib=no, $GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS)
317 dnl PNG Support
318 dnl ===========
319 png=yes
320 AC_ARG_ENABLE(png, 
321 [  --disable-png                  disable PNG support through libpng],
322         png=$enableval, png=yes)
325 if test "$png" = yes; then
326     if test "$zlib" = yes; then
327        AC_CHECK_LIB(png, png_get_valid, 
328                 [GFXLIBS="$GFXLIBS -lpng -lz" GFXFLAGS="$GFXFLAGS -DUSE_PNG" 
329                 supported_gfx="$supported_gfx PNG"],,
330                 $GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS -lz -lm)
331     fi
335 dnl JPEG Support
336 dnl ============
337 jpeg=yes
338 AC_ARG_ENABLE(jpeg,
339 [  --disable-jpeg         disable JPEG support through libjpeg],
340         jpeg=$enableval, jpeg=yes)
342 if test "$jpeg" = yes; then
343         AC_CHECK_LIB(jpeg, jpeg_destroy_compress,
344                 [GFXLIBS="$GFXLIBS -ljpeg" GFXFLAGS="$GFXFLAGS -DUSE_JPEG"
345                 supported_gfx="$supported_gfx JPEG"],,
346                 $GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS)
350 dnl GIF Support
351 dnl ============
353 dnl giflib uses dangerous function naming... (namespace clashing)
355 jpeg=yes
356 AC_ARG_ENABLE(gif,
357 [  --disable-gif                disable GIF support through libgif or libungif],
358         gif=$enableval, gif=yes)
360 if test "$gif" = yes; then
361         retry=no
362         AC_CHECK_LIB(ungif, DGifOpenFileName,
363             [GFXLIBS="$GFXLIBS -lungif" GFXFLAGS="$GFXFLAGS -DUSE_GIF"
364             supported_gfx="$supported_gfx GIF"],retry=yes,
365             $GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS)
367 dnl libungif is the same thing as libgif for all practical purposes.
369         if test "$retry" = yes; then
370             AC_CHECK_LIB(gif, DGifOpenFileName,
371                 [GFXLIBS="$GFXLIBS -lgif" GFXFLAGS="$GFXFLAGS -DUSE_GIF"
372                 supported_gfx="$supported_gfx GIF"],,
373                 $GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS)
374         fi
379 dnl TIFF Support
380 dnl ============
381 AC_ARG_ENABLE(tiff, 
382 [  --disable-tiff         disable use of TIFF images through libtiff],
383         tif=$enableval, tif=yes)
386 # TIFF can optionally have JPEG and/or zlib support. Must find out
387 # when they are supported so that correct library flags are passed during
388 # detection and linkage
391 # By default use xpm icons if tiff is not found.
392 ICONEXT="xpm"
395 if test "$tif" = yes; then
396     AC_CHECK_LIB(tiff, TIFFGetVersion, 
397         [GFXFLAGS="$GFXFLAGS -DUSE_TIFF" GFXLIBS="-ltiff $GFXLIBS" 
398         ICONEXT="tiff"],,
399         [$GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS $XLIBS $GFXLIBS -lm])
401 dnl Retry with zlib
403     if test ! "$ICONEXT" = "tiff"; then
404         if test "$zlib" = "yes"; then
405             AC_CHECK_LIB(tiff, TIFFGetVersion, 
406                 [GFXFLAGS="$GFXFLAGS -DUSE_TIFF" GFXLIBS="-ltiff -lz $GFXLIBS" 
407                 ICONEXT="tiff"],,
408                 [$GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS $XLIBS $GFXLIBS -lz -lm])
409         fi
410     fi
411     
412     if test ! "$ICONEXT" = "tiff"; then
413         AC_CHECK_LIB(tiff34, TIFFGetVersion, 
414                 [GFXFLAGS="$GFXFLAGS -DUSE_TIFF" GFXLIBS="-ltiff34 $GFXLIBS"
415                 ICONEXT="tiff"],,
416                 [$GFX_INC_PATH $GFX_LIB_PATH $XLFLAGS $XLIBS $GFXLIBS -lm])
417     fi
422 AC_SUBST(GFXFLAGS)
423 AC_SUBST(GFXLIBS)
424 AC_SUBST(ICONEXT)
427 dnl ==============================================
428 dnl         End of Graphic Format Libraries
429 dnl ==============================================
431 dnl =====================================================
432 dnl        Check for libPropList
433 dnl =====================================================
435 PLPATH=`pwd`/libPropList
438 if test -f $PLPATH/libPropList.a; then
439         echo Using compiled libPropList
440         needtobuild=no
441         LIBPL_LIBS="-L$PLPATH -lPropList"
442         LIBPL_INC_PATH="-I$PLPATH"
443 else
444         AC_CHECK_LIB(PropList, PLGetString,
445                 [LIBPL_LIBS=-lPropList LIBPL_INC_PATH="" needtobuild=no],
446                 [LIBPL_LIBS="-L$PLPATH -lPropList"
447                  LIBPL_INC_PATH="-I$PLPATH"
448                  needtobuild=yes])
452 if test "$needtobuild" = yes; then
453     if test -f libPropList/libPropList.a; then
454         echo "using included libPropList"
455     else
456         echo "********** WARNING *************"
457         echo "libPropList is not installed in your system."
458         echo "You need to build it before building WindowMaker (if you already"
459         echo "did that, remove config.cache and rerun configure)."
460         echo "Please read the INSTALL file for detailed instructions."
461         echo "Press <Return> to continue configuring WindowMaker or"
462         echo "type b and <Return> to build it now."
463         read foo
464         if test "$foo" = b; then
465             echo
466             echo "Building libPropList..."
467             echo
468             if test ! -d libPropList; then
469                 gzip -d -c libPropList.tar.gz | tar xf -
470             fi
471             ok=no
472             if (cd libPropList; ./configure); then
473                 if (cd libPropList; make); then
474                     ok=yes
475                 fi
476             fi
477             if test "$ok" = no; then
478                 echo "********** WARNING **********"
479                 echo "An error occurred while building libPropList"
480                 echo "Please build it manually."
481                 echo "Press <Return> to continue."
482                 read foo
483             fi
484             echo
485             echo "resuming WindowMaker configuration..."
486             echo
487         fi
488     fi
491 AC_SUBST(LIBPL_LIBS)
492 AC_SUBST(LIBPL_INC_PATH)
495 dnl Paranoia setup
496 dnl ==============
497 AC_ARG_ENABLE(debug, 
498 [  --enable-debug         enable debugging ],, enable_debug=no)
500 if test "$enable_debug" = yes; then
501     DFLAGS="-g -DDEBUG"
502 #       Efence makes things too slow. Add it by hand in the Makefiles
503 #       if it is really needed.
504 #    AC_CHECK_LIB(efence, malloc, LIBS="$LIBS -lefence")
506 AC_SUBST(DFLAGS)
509 dnl --Sound support - Dan
510 dnl =============================================
511 AC_ARG_ENABLE(sound, 
512 [  --enable-sound         enable sound support ],, enable_sound=no)
513 if test "$enable_sound" = yes; then     
514         SOUND="#define WMSOUND" 
515 else
516         SOUND="#undef WMSOUND"  
518 AC_SUBST(SOUND)
521 # AC_PREFIX_PROGRAM(wmaker)
523 if test "${prefix}" = "NONE"; then
524         prefix="/usr/local"
526 if test "${exec_prefix}" = "NONE"; then
527         exec_prefix="${prefix}"
530 dnl Support for PIXMAPDIR option
531 dnl ============================
532 AC_ARG_WITH(pixmapdir,
533 [  --with-pixmapdir=PATH   specify where pixmaps are located [DATADIR/pixmaps]])
535 if test "x$with_pixmapdir" != "x"; then
536         pixmapdir=$with_pixmapdir
537 else
538         pixmapdir="${datadir}/pixmaps"
541 AC_SUBST(pixmapdir)
544 dnl Support for GNUSTEP_LOCAL_ROOT, for WPrefs.app
545 dnl ==============================================
547 gnustepdir="${prefix}/GNUstep"
549 if test "x$GNUSTEP_LOCAL_ROOT" != "x" ; then
550         gnustepdir=`echo "$GNUSTEP_LOCAL_ROOT" | sed -e "s%${prefix}%\${prefix}%"`
553 appsdir=$gnustepdir/Apps
555 wprefsdir=$appsdir/WPrefs.app
557 AC_SUBST(wprefsdir)
560 dnl Enable single appicon per wm instance+class combo -cls
561 dnl =====================================================
562 AC_ARG_ENABLE(single-icon,
563 [  --enable-single-icon    use single application icon per WM_INSTANCE+WM_CLASS (unsupported) ],
564 if test "$enableval" = yes; then
565         REDUCE_APPICONS="#define REDUCE_APPICONS"
566 else
567         REDUCE_APPICONS="#undef REDUCE_APPICONS"
569         REDUCE_APPICONS="#undef REDUCE_APPICONS"
570 )       
571 AC_SUBST(REDUCE_APPICONS)
573 dnl Checks for header files.
574 dnl =======================
575 dnl AC_HEADER_STDC
576 AC_HEADER_SYS_WAIT
577 AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h sys/types.h libintl.h sys/select.h)
581 dnl Checks for typedefs, structures, and compiler characteristics.
582 dnl ==============================================================
583 AC_DECL_SYS_SIGLIST
584 AC_C_CONST
585 AC_TYPE_SIZE_T
586 AC_TYPE_PID_T
587 AC_HEADER_TIME
590 dnl Some decisions....
591 dnl ==================
592 if test "$GCC" = "yes"; then
593 #       ceflagues=""
594 #       for i in $CFLAGS; do
595 #           if test "$i" != "-g" ; then
596 #               ceflagues="$ceflagues $i"
597 #           fi
598 #       fi
599 #       CFLAGS="$ceflagues -Wall -Wno-implicit-int -finline-functions"
600         CFLAGS="$CFLAGS -Wall -Wno-implicit-int -Wcast-align"
605 dnl Nicolai:  Program tests for Documentation Section
606 dnl =================================================
607 dnl DOCTYPES=""
608 dnl AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, ,$PATH)
609 dnl if test "x$MAKEINFO" != "x" ; then
610 dnl       DOCTYPES="$DOCTYPES info_doc"
611 dnl fi
612 dnl AC_CHECK_PROG(TEX, tex, tex, ,$PATH)
613 dnl if test "x$TEX" != "x" ; then
614 dnl       DOCTYPES="$DOCTYPES dvi_doc"
615 dnl fi
616 dnl AC_CHECK_PROG(DVIPS, dvips, dvips, ,$PATH)
617 dnl if test "x$DVIPS" != "x" ; then
618 dnl       DOCTYPES="$DOCTYPES ps_doc"
619 dnl fi
620 dnl AC_CHECK_PROG(PERL, perl, perl, ,$PATH)
621 dnl if test "x$PERL" != "x" ; then
622 dnl       DOCTYPES="$DOCTYPES html_doc"
623 dnl fi
624 dnl AC_PATH_PROG(PERL_PATH, perl, perl, ,$PATH)
625 dnl AC_CHECK_PROG(TEXI2HTML, texi2html, texi2html, ,$PATH)
626   
627 dnl AC_SUBST(DOCTYPES)
629 AC_OUTPUT(Makefile po/Makefile util/Makefile test/Makefile wmlib/Makefile \
630         WINGs/Makefile WINGs/Resources/Makefile src/Makefile src/wconfig.h \
631         wrlib/Makefile doc/Makefile WindowMaker/Makefile \
632         WindowMaker/Defaults/Makefile WindowMaker/Styles/Makefile \
633         WindowMaker/Themes/Makefile WindowMaker/Backgrounds/Makefile \
634         WindowMaker/Pixmaps/Makefile WindowMaker/Icons/Makefile \
635         WindowMaker/IconSets/Makefile \
636         WindowMaker/Sounds/Makefile \
637         WPrefs.app/Makefile WPrefs.app/tiff/Makefile WPrefs.app/xpm/Makefile \
638         WPrefs.app/po/Makefile )
643 dnl Output some helpfull data for compiling WINGs apps
644 dnl ==================================================
647 echo "WFLAGS=\"$LIBPL_INC_PATH -I$prefix/include\"" > WINGs-flags
648 echo "WLIBS=\"-L$exec_prefix/lib -lWINGs -lwraster $LIBPL_LIBS $GFXLIBS -lm\""\
649          >> WINGs-flags
653 dnl Spit out the configuration
654 dnl ==========================
656 formats="XPM PPM"
658 for i in $GFXFLAGS; do
659     case "$i" in
660         -DUSE_GIF)
661                 formats="$formats GIF"
662                 ;;
663         -DUSE_TIFF)
664                 formats="$formats TIFF"
665                 ;;
666         -DUSE_PNG)
667                 formats="$formats PNG"
668                 ;;
669         -DUSE_JPEG)
670                 formats="$formats JPEG"
671                 ;;
672     esac
673 done
675 echo
676 echo "WindowMaker was configured as follows:"
677 echo
678 echo "Installation path prefix: $prefix"
679 echo "Installation path prefix for binaries: $exec_prefix"
680 echo "Installation path for WPrefs.app: $wprefsdir"
681 echo "Graphic format libraries: $formats"
682 if test "x$MOFILES" = "x"; then
683         mof=none
684 else
685         mof=$MOFILES
687 echo "Translated message files to install: $mof"
688 if test "x$MOFILES" != "x"; then
689         echo "Installation path of translated messages: $NLSDIR"
692 echo "What!? WPrefs.app won't be installed where you want it?"
693 echo "May I point to you to the INSTALL file?"
696 dnl This is for Emacs.  I'm lazy, I know... (nicolai)
697 dnl ================================================
698 dnl Local Variables:
699 dnl compile-command: "autoconf"
700 dnl End: