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