wmcalc: Use version number from autoconf.
[dockapps.git] / wmbiff / configure.ac
bloba17905f98afd8ef35839a1ce1da7278b17de7c5e
1 dnl Autoconf is here to detect:
2 dnl  gnutls, libgcrypt
3 dnl  default ssh-askpass
4 dnl and the basics X11, Xext, Xpm
5 dnl and configure:
6 dnl  installation prefix
7 dnl  version
9 AC_INIT(WMBiff, 0.4.31, wmaker-dev@googlegroups.com, wmbiff)
10 AC_CONFIG_AUX_DIR(autoconf)
11 AM_INIT_AUTOMAKE
12 AC_CONFIG_HEADER([config.h])
13 dnl make sure autoheader finds version, implicitly defined above.
14 AH_TEMPLATE([VERSION], [wmbiff's release version])
15 AC_SUBST(VERSION)
17 AC_PROG_INSTALL
18 AC_PROG_CC
19 AC_PROG_RANLIB
21 if test -n "$GCC"; then
22  CFLAGS="$CFLAGS -D_GNU_SOURCE -W -Wall -Wshadow -Wpointer-arith -Wwrite-strings"
23  AC_MSG_RESULT(adding -Wall and friends to CFLAGS.)
26 case `(uname -s) 2>/dev/null` in
27     "Darwin")
28        CFLAGS="$CFLAGS -no-cpp-precomp"
29        AC_MSG_RESULT(adding cpp precompiler workaround for Mac OS X)
30        LDFLAGS="$LDFLAGS -framework Security"
31        AC_MSG_RESULT(adding -framework Security for Mac OS X)
32      ;;
33 esac
35 dnl a no-op to force autoconf to seek out the preprocessor now.
36 AC_CHECK_HEADERS(stdio.h)
38 dnl for IPv6 support
39 AC_CHECK_FUNCS(getaddrinfo)
41 dnl see if we can cheaply "encrypt" passwords in memory
42 AC_CHECK_FUNCS(memfrob)
44 dnl AC_CHECK_FUNC(asprintf, , VASPRINTF="vasprintf.c")
46 dnl replacing the old USE_POLL define
47 AC_CHECK_FUNCS(poll)
49 dnl for gnutls-common.h, which defines this if missing.
50 AC_CHECK_FUNCS(inet_ntop)
52 dnl declare RETSIGTYPE
53 AC_TYPE_SIGNAL
55 dnl solaris
56 AC_CHECK_LIB(nsl, gethostbyname)
57 AC_CHECK_LIB(socket, connect)
58 AC_CHECK_LIB(resolv, herror)
60 dnl Pre-gnutls.
61 gnutls="ok"
62 gcrypt="ok"
63 AC_CHECK_LIB(z, gzopen, [], [gnutls="nope"]) dnl GNUTLS seems to need libz; fail here if it's missing.
64 dnl perhaps not required anymore:
65 dnl AC_CHECK_LIB(gdbm, dbminit, [], [gnutls="nope"]) dnl GNUTLS seems to need libgdbm; fail here if it's missing.
67 dnl Parameter is minimum version
68 dnl TODO: fix so that GCRYPT is tested only if GNUTLS fails; the dependence
69 dnl between them makes this turn redundant
71 AC_ARG_ENABLE(crypto, AC_HELP_STRING([ --disable-crypto ], [ disable gnutls/gcrypt ]),
72                       [ if test $enableval != yes; then
73                         gnutls="disabled"
74                         gcrypt="disabled"
75                        fi ])
78 GNUTLS_MAN_STATUS="This copy of WMBiff was not compiled with GNUTLS."
79 if test "$gnutls" = "ok"; then
80  PKG_CHECK_MODULES([LIBGNUTLS], [gnutls > 2.2.0], [LIBS="$LIBS $LIBGNUTLS_LIBS"
81                           CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
82                          CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS"
83                          GNUTLS_COMMON_O="gnutls-common.o"
84                          GNUTLS_MAN_STATUS="This copy of WMBiff was compiled with GNUTLS."
85                          AC_CHECK_HEADERS(gnutls/gnutls.h) ],
86                          [ echo GNUTLS can be found at ftp://gnutls.hellug.gr/pub/gnutls ])
87 else
88  AC_MSG_RESULT(GNUTLS support requires libz.a and libgdbm.a, so will be disabled)
91 GCRYPT_MAN_STATUS="This copy of WMBiff was not compiled with gcrypt."
92 if test "$gcrypt" = "ok"; then
93  AM_PATH_LIBGCRYPT(1.1.90, [CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
94                          CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CFLAGS"
95                          GCRYPT_MAN_STATUS="This copy of WMBiff was compiled with gcrypt."
96                          AC_CHECK_HEADERS(gcrypt.h) ],
97                          [ echo libgcrypt can be found at ftp://ftp.gnupg.org/pub/gcrypt/alpha/libgcrypt/ ]  )
98 else
99         AC_MSG_RESULT(GCRYPT disabled.)
103 AC_SUBST(LIBGCRYPT_LIBS)
104 AC_SUBST(GNUTLS_MAN_STATUS)
105 AC_SUBST(GCRYPT_MAN_STATUS)
106 AC_SUBST(GNUTLS_COMMON_O)
108 dnl regex stuff.
109 AC_CHECK_HEADERS(regex.h) dnl gnuregex.h
110 dnl no longer needed AC_CHECK_LIB(gnuregex, re_search) dnl BSD.
112 dnl X11 stuff.
113 AC_PATH_XTRA
114 if test "$no_x" = yes; then
115    AC_MSG_ERROR("Really need a working X.  Check config.log to see why configure couldn't find it")
117 LIBS="$X_LIBS $LIBS"
118 dnl want to get the -I flags so that later tests for include files work.
119 dnl the preprocessor is used for check_headers, which doesn't use cflags.
120 CPPFLAGS="$X_CFLAGS $CPPFLAGS"
121 AC_CHECK_LIB(X11, XrmParseCommand)
122 AC_CHECK_LIB(Xext, XShapeCombineMask, , AC_MSG_ERROR(libXext not found or does not include XShape))
123 AC_CHECK_LIB(Xpm, XpmCreateImageFromXpmImage)
125 AC_CHECK_HEADERS(X11/xpm.h, [], [AC_CHECK_HEADERS(xpm.h, [], AC_MSG_ERROR([xpm.h is needed]))])
126 dnl AM_PATH_GTK(1.2.10, , AC_MSG_WARN(Cannot find GTK: Is gtk-config in path?))
127 dnl AM_PATH_GDK_PIXBUF(0.15.0, [CFLAGS="$CFLAGS $GDK_PIXBUF_CFLAGS"],
128                            dnl AC_MSG_ERROR(Cannot find gdk-pixbuf))
129 dnl GNOME_INIT_HOOK([ ], failure)
130 dnl GNOME_ORBIT_HOOK([GNOME_LIBS="$GNOME_LIBS $ORBIT_LIBS"
131 dnl                   GNOME_CFLAGS="$GNOME_CFLAGS $ORBIT_CFLAGS"], failure)
132 dnl GNOME_GNORBA_HOOK([GNOME_LIBS="$GNOME_LIBS $GNORBA_LIBS"
133 dnl                   GNOME_CFLAGS="$GNOME_CFLAGS $GNORBA_CFLAGS"], failure)
135 dnl AC_SUBST(GNOME_LIBS)
136 dnl AC_SUBST(GNOME_CFLAGS)
139 dnl see if __attribute__ is supported.  modified from AC_C_INLINE
140 dnl in the autoconf distribution.
141 AC_DEFUN([WM_C_ATTRIBUTE],
142 [AC_CACHE_CHECK([for __attribute__ support], wm_cv_c_attribute,
143 [wm_cv_c_attribute=no
144 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
145 [#ifndef __cplusplus
146 typedef int foo_t;
147 foo_t foo () __attribute__((unused));
148 foo_t foo () {return 0; }
149 #endif
150 ])],
151                     [wm_cv_c_attribute=yes])
153 case $wm_cv_c_attribute in
154   yes)AC_DEFINE(HAVE___ATTRIBUTE__, ,
155                 [Define if '__attribute__' is supported by the compiler])
156   ;;
157 esac
158 ])# WM_C_ATTRIBUTE
160 WM_C_ATTRIBUTE
162 dnl Password prompting stuff.
163 AC_PATH_PROGS(DEFAULT_ASKPASS, ssh-askpass x11-ssh-askpass ssh-askpass-gnome, /usr/bin/ssh-askpass)
164 AC_PATH_PROG(CVS2CL, cvs2cl)
165 AC_DEFINE_UNQUOTED(DEFAULT_ASKPASS, "$DEFAULT_ASKPASS", [Program to use for querying the user for a password: redefine if not on a debian system])
167 AC_CHECK_HEADERS(CoreServices/CoreServices.h Security/Security.h)
169 dnl Skin files; note - this is duplicated in wmbiff/Makefile.am
170 dnl haven't thought of a way around it.
171 if test "x$prefix" != xNONE; then
172   SKINDIR="$prefix/share/wmbiff/skins"
173 else
174   SKINDIR="$ac_default_prefix/share/wmbiff/skins"
176 dnl where to install em
177 AC_SUBST(SKINDIR)
178 dnl where to find em
179 AC_DEFINE_UNQUOTED(DEFAULT_SKIN_PATH,
180                    "$SKINDIR:/usr/share/wmbiff/skins:/usr/local/share/wmbiff/skins:.", [Path to use when finding skins (modified pixmaps)] )
182 dnl We're done.
183 AC_CONFIG_FILES(Makefile wmbiff/Makefile wmgeneral/Makefile wmbiff/wmbiffrc.5 autoconf/Makefile scripts/Makefile)
184 AC_OUTPUT
185 dnl remind not to write the file.
186 chmod 0444 wmbiff/wmbiffrc.5