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