1 # To compile this into a configure script, you need:
\r
2 # * Autoconf 2.50 or newer
\r
3 # * Gtk (for $prefix/share/aclocal/gtk.m4)
\r
4 # * Automake (for aclocal)
\r
5 # If you've got them, running "autoreconf" should work.
\r
7 # Version number is substituted by Buildscr for releases, snapshots
\r
8 # and custom builds out of svn; X.XX shows up in ad-hoc developer
\r
9 # builds, which shouldn't matter
\r
10 AC_INIT(putty, X.XX)
\r
11 AC_CONFIG_FILES([Makefile])
\r
12 AC_CONFIG_HEADERS([uxconfig.h:uxconfig.in])
\r
13 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
\r
18 # Mild abuse of the '--enable' option format to allow manual
\r
19 # specification of setuid or setgid setup in pterm.
\r
21 AC_ARG_ENABLE([setuid],
\r
22 [AS_HELP_STRING([--enable-setuid=USER],
\r
23 [make pterm setuid to a given user])],
\r
24 [case "$enableval" in
\r
25 no) setidtype=none;;
\r
26 *) setidtype=setuid; setidval="$enableval";;
\r
28 AC_ARG_ENABLE([setgid],
\r
29 [AS_HELP_STRING([--enable-setgid=GROUP],
\r
30 [make pterm setgid to a given group])],
\r
31 [case "$enableval" in
\r
32 no) setidtype=none;;
\r
33 *) setidtype=setgid; setidval="$enableval";;
\r
35 AM_CONDITIONAL(HAVE_SETID_CMD, [test "$setidtype" != "none"])
\r
36 AS_IF([test "x$setidtype" = "xsetuid"],
\r
37 [SETID_CMD="chown $setidval"; SETID_MODE="4755"])
\r
38 AS_IF([test "x$setidtype" = "xsetgid"],
\r
39 [SETID_CMD="chgrp $setidval"; SETID_MODE="2755"])
\r
41 AC_SUBST(SETID_MODE)
\r
43 AC_ARG_WITH([gssapi],
\r
44 [AS_HELP_STRING([--without-gssapi],
\r
45 [disable GSSAPI support])],
\r
50 AS_IF([test "x$with_gssapi" != xno],
\r
51 [AC_DEFINE([WITH_GSSAPI], [1], [Define if building with GSSAPI support.])])
\r
54 [AS_HELP_STRING([--with-gtk=VER],
\r
55 [specify GTK version to use (`1' or `2')])
\r
56 AS_HELP_STRING([--without-gtk],
\r
57 [do not use GTK (build command-line tools only)])],
\r
58 [gtk_version_desired="$withval"],
\r
59 [gtk_version_desired="any"])
\r
61 case "$gtk_version_desired" in
\r
62 1 | 2 | any | no) ;;
\r
63 yes) gtk_version_desired="any" ;;
\r
64 *) AC_ERROR([Invalid GTK version specified])
\r
67 AC_CHECK_HEADERS([utmpx.h sys/select.h],,,[
\r
68 #include <sys/types.h>
\r
71 # Look for both GTK 2 and GTK 1, in descending order of preference. If
\r
72 # we can't find either, have the makefile only build the CLI programs.
\r
76 case "$gtk_version_desired:$gtk" in
\r
78 ifdef([AM_PATH_GTK_2_0],[
\r
79 AM_PATH_GTK_2_0([2.0.0], [gtk=2], [])
\r
80 ],[AC_WARNING([generating configure script without GTK 2 autodetection])])
\r
84 case "$gtk_version_desired:$gtk" in
\r
86 ifdef([AM_PATH_GTK],[
\r
87 AM_PATH_GTK([1.2.0], [gtk=1], [])
\r
89 # manual check for gtk1
\r
90 AC_PATH_PROG(GTK1_CONFIG, gtk-config, absent)
\r
91 if test "$GTK1_CONFIG" != "absent"; then
\r
92 GTK_CFLAGS=`"$GTK1_CONFIG" --cflags`
\r
93 GTK_LIBS=`"$GTK1_CONFIG" --libs`
\r
100 AM_CONDITIONAL(HAVE_GTK, [test "$gtk" != "none"])
\r
102 if test "$gtk" = "2"; then
\r
103 ac_save_CFLAGS="$CFLAGS"
\r
104 ac_save_LIBS="$LIBS"
\r
105 CFLAGS="$CFLAGS $GTK_CFLAGS"
\r
106 LIBS="$GTK_LIBS $LIBS"
\r
107 AC_CHECK_FUNCS([pango_font_family_is_monospace pango_font_map_list_families])
\r
108 CFLAGS="$ac_save_CFLAGS"
\r
109 LIBS="$ac_save_LIBS"
\r
112 AC_SEARCH_LIBS([socket], [xnet])
\r
114 AS_IF([test "x$with_gssapi" != xno],
\r
118 [AC_DEFINE([NO_LIBDL], [1], [Define if we could not find libdl.])
\r
119 AC_CHECK_HEADERS([gssapi/gssapi.h])
\r
121 [gss_init_sec_context],[gssapi gssapi_krb5 gss],
\r
123 [AC_DEFINE([NO_GSSAPI_LIB], [1], [Define if we could not find a gssapi library])])])])
\r
125 AC_CHECK_LIB(X11, XOpenDisplay,
\r
126 [GTK_LIBS="-lX11 $GTK_LIBS"
\r
127 AC_DEFINE([HAVE_LIBX11],[],[Define if libX11.a is available])])
\r
129 AC_CHECK_FUNCS([getaddrinfo posix_openpt ptsname setresuid strsignal updwtmpx])
\r
130 AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[#include <time.h>]])
\r
131 AC_SEARCH_LIBS([clock_gettime], [rt], [AC_DEFINE([HAVE_CLOCK_GETTIME],[],[Define if clock_gettime() is available])])
\r
133 if test "x$GCC" = "xyes"; then
\r
135 AC_SUBST(WARNINGOPTS, ['-Wall -Werror'])
\r
138 AC_SUBST(WARNINGOPTS, [])
\r
143 if test "$gtk_version_desired" = "no"; then cat <<EOF
\r
145 'configure' was instructed not to build using GTK. Therefore, PuTTY
\r
146 itself and the other GUI utilities will not be built by the generated
\r
147 Makefile: only the command-line tools such as puttygen, plink and
\r
148 psftp will be built.
\r
151 elif test "$gtk" = "none"; then cat <<EOF
\r
153 'configure' was unable to find either the GTK 1 or GTK 2 libraries on
\r
154 your system. Therefore, PuTTY itself and the other GUI utilities will
\r
155 not be built by the generated Makefile: only the command-line tools
\r
156 such as puttygen, plink and psftp will be built.
\r
162 /* Convert autoconf definitions to ones that PuTTY wants. */
\r
164 #ifndef HAVE_GETADDRINFO
\r
167 #ifndef HAVE_SETRESUID
\r
168 # define HAVE_NO_SETRESUID
\r
170 #ifndef HAVE_STRSIGNAL
\r
171 # define HAVE_NO_STRSIGNAL
\r
173 #if !defined(HAVE_UTMPX_H) || !defined(HAVE_UPDWTMPX)
\r
176 #ifndef HAVE_PTSNAME
\r
179 #ifndef HAVE_SYS_SELECT_H
\r
180 # define HAVE_NO_SYS_SELECT_H
\r
182 #ifndef HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
\r
183 # define PANGO_PRE_1POINT4
\r
185 #ifndef HAVE_PANGO_FONT_MAP_LIST_FAMILIES
\r
186 # define PANGO_PRE_1POINT6
\r
188 #if !defined(WITH_GSSAPI)
\r
191 #if !defined(NO_GSSAPI) && defined(NO_LIBDL)
\r
192 # if !defined(HAVE_GSSAPI_GSSAPI_H) || defined(NO_GSSAPI_LIB)
\r