--with-gtk-version option to configure, so you can explicitly tell it
[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_ARG_WITH([gtk-version],
31 [AS_HELP_STRING([--with-gtk-version],
32 [specify GTK version to use (1 or 2) (optional)])],
33 [gtk_version_desired="$withval"],
34 [gtk_version_desired="any"])
35
36 case "$gtk_version_desired" in
37 1 | 2 | any) ;;
38 *) AC_ERROR([Invalid GTK version specified])
39 esac
40
41 AC_CHECK_HEADERS([utmpx.h sys/select.h],,,[
42 #include <sys/types.h>
43 #include <utmp.h>])
44
45 # Look for both GTK 1 and GTK 2.
46
47 gtk=none
48
49 case "$gtk_version_desired" in
50 1 | any)
51 ifdef([AM_PATH_GTK],[
52 AM_PATH_GTK([1.2.0], [gtk=1], [])
53 ],[AC_WARNING([generating configure script without GTK 1 autodetection])])
54 ;;
55 esac
56
57 case "$gtk_version_desired" in
58 2 | any)
59 ifdef([AM_PATH_GTK_2_0],[
60 AM_PATH_GTK_2_0([2.0.0], [gtk=2], [])
61 ],[AC_WARNING([generating configure script without GTK 2 autodetection])])
62 ;;
63 esac
64
65 if test "$gtk" = "none"; then
66 all_targets="all-cli"
67 else
68 all_targets="all-cli all-gtk"
69 fi
70
71 if test "$gtk" = "2"; then
72 ac_save_CFLAGS="$CFLAGS"
73 ac_save_LIBS="$LIBS"
74 CFLAGS="$CFLAGS $GTK_CFLAGS"
75 LIBS="$GTK_LIBS $LIBS"
76 AC_CHECK_FUNCS([pango_font_family_is_monospace pango_font_map_list_families])
77 CFLAGS="$ac_save_CFLAGS"
78 LIBS="$ac_save_LIBS"
79 fi
80 AC_SUBST([all_targets])
81
82 AC_SEARCH_LIBS([socket], [xnet])
83
84 AS_IF([test "x$with_gssapi" != xno],
85 [AC_SEARCH_LIBS(
86 [dlopen],[dl],
87 [],
88 [AC_DEFINE([NO_LIBDL], [1], [Define if we could not find libdl.])
89 AC_CHECK_HEADERS([gssapi/gssapi.h])
90 AC_SEARCH_LIBS(
91 [gss_init_sec_context],[gssapi gssapi_krb5 gss],
92 [],
93 [AC_DEFINE([NO_GSSAPI_LIB], [1], [Define if we could not find a gssapi library])])])])
94
95 AC_CHECK_LIB(X11, XOpenDisplay)
96
97 AC_CHECK_FUNCS([getaddrinfo ptsname setresuid strsignal updwtmpx])
98
99 AC_OUTPUT
100
101 AH_BOTTOM([
102 /* Convert autoconf definitions to ones that PuTTY wants. */
103
104 #ifndef HAVE_GETADDRINFO
105 # define NO_IPV6
106 #endif
107 #ifndef HAVE_SETRESUID
108 # define HAVE_NO_SETRESUID
109 #endif
110 #ifndef HAVE_STRSIGNAL
111 # define HAVE_NO_STRSIGNAL
112 #endif
113 #if !defined(HAVE_UTMPX_H) || !defined(HAVE_UPDWTMPX)
114 # define OMIT_UTMP
115 #endif
116 #ifndef HAVE_PTSNAME
117 # define BSD_PTYS
118 #endif
119 #ifndef HAVE_SYS_SELECT_H
120 # define HAVE_NO_SYS_SELECT_H
121 #endif
122 #ifndef HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
123 # define PANGO_PRE_1POINT4
124 #endif
125 #ifndef HAVE_PANGO_FONT_MAP_LIST_FAMILIES
126 # define PANGO_PRE_1POINT6
127 #endif
128 #if !defined(WITH_GSSAPI)
129 # define NO_GSSAPI
130 #endif
131 #if !defined(NO_GSSAPI) && defined(NO_LIBDL)
132 # if !defined(HAVE_GSSAPI_GSSAPI_H) || defined(NO_GSSAPI_LIB)
133 # define NO_GSSAPI
134 # endif
135 #endif
136 ])