Patch from Alejandro Sedeno, somewhat modified by me, which
[u/mdw/putty] / unix / configure.ac
1 # To compile this into a configure script, you need:
2 # * Autoconf 2.50 or newer
3 # * Gtk (for $prefix/share/aclocal/gtk.m4)
4 # * Automake (for aclocal)
5 # If you've got them, running "autoreconf" should work.
6
7 AC_INIT
8 AC_CONFIG_FILES([Makefile])
9 AC_CONFIG_HEADERS([uxconfig.h:uxconfig.in])
10
11 AC_PROG_INSTALL
12 AC_PROG_CC
13 if test "X$GCC" = Xyes; then
14 PUTTYCFLAGS="-Wall -Werror"
15 else
16 PUTTYCFLAGS=""
17 fi
18 AC_SUBST(PUTTYCFLAGS)
19
20 AC_ARG_WITH([gssapi],
21 [AS_HELP_STRING([--without-gssapi],
22 [disable GSSAPI support])],
23 [],
24 [with_gssapi=yes])
25
26 WITH_GSSAPI=
27 AS_IF([test "x$with_gssapi" != xno],
28 [AC_DEFINE([WITH_GSSAPI], [1], [Define if building with GSSAPI support.])])
29
30 AC_CHECK_HEADERS([utmpx.h sys/select.h],,,[
31 #include <sys/types.h>
32 #include <utmp.h>])
33
34 # Look for both GTK 1 and GTK 2.
35 # AM_PATH_GTK([1.2.0], [gtk=1], [gtk=none])
36 AM_PATH_GTK_2_0([2.0.0], [gtk=2], [])
37 if test "$gtk" = "none"; then
38 all_targets="all-cli"
39 else
40 all_targets="all-cli all-gtk"
41 fi
42 if test "$gtk" = "2"; then
43 ac_save_CFLAGS="$CFLAGS"
44 ac_save_LIBS="$LIBS"
45 CFLAGS="$CFLAGS $GTK_CFLAGS"
46 LIBS="$GTK_LIBS $LIBS"
47 AC_CHECK_FUNCS([pango_font_family_is_monospace pango_font_map_list_families])
48 CFLAGS="$ac_save_CFLAGS"
49 LIBS="$ac_save_LIBS"
50 fi
51 AC_SUBST([all_targets])
52
53 AC_SEARCH_LIBS([socket], [xnet])
54
55 AS_IF([test "x$with_gssapi" != xno],
56 [AC_SEARCH_LIBS(
57 [dlopen],[dl],
58 [],
59 [AC_DEFINE([NO_LIBDL], [1], [Define if we could not find libdl.])
60 AC_CHECK_HEADERS([gssapi/gssapi.h])
61 AC_SEARCH_LIBS(
62 [gss_init_sec_context],[gssapi gssapi_krb5 gss],
63 [],
64 [AC_DEFINE([NO_GSSAPI_LIB], [1], [Define if we could not find a gssapi library])])])])
65
66 AC_CHECK_LIB(X11, XOpenDisplay)
67
68 AC_CHECK_FUNCS([getaddrinfo ptsname setresuid strsignal updwtmpx])
69
70 AC_OUTPUT
71
72 AH_BOTTOM([
73 /* Convert autoconf definitions to ones that PuTTY wants. */
74
75 #ifndef HAVE_GETADDRINFO
76 # define NO_IPV6
77 #endif
78 #ifndef HAVE_SETRESUID
79 # define HAVE_NO_SETRESUID
80 #endif
81 #ifndef HAVE_STRSIGNAL
82 # define HAVE_NO_STRSIGNAL
83 #endif
84 #if !defined(HAVE_UTMPX_H) || !defined(HAVE_UPDWTMPX)
85 # define OMIT_UTMP
86 #endif
87 #ifndef HAVE_PTSNAME
88 # define BSD_PTYS
89 #endif
90 #ifndef HAVE_SYS_SELECT_H
91 # define HAVE_NO_SYS_SELECT_H
92 #endif
93 #ifndef HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
94 # define PANGO_PRE_1POINT4
95 #endif
96 #ifndef HAVE_PANGO_FONT_MAP_LIST_FAMILIES
97 # define PANGO_PRE_1POINT6
98 #endif
99 #if !defined(WITH_GSSAPI)
100 # define NO_GSSAPI
101 #endif
102 #if !defined(NO_GSSAPI) && defined(NO_LIBDL)
103 # if !defined(HAVE_GSSAPI_GSSAPI_H) || defined(NO_GSSAPI_LIB)
104 # define NO_GSSAPI
105 # endif
106 #endif
107 ])