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])
17 ifdef([AM_PROG_AR],[AM_PROG_AR])
20 # Mild abuse of the '--enable' option format to allow manual
21 # specification of setuid or setgid setup in pterm.
23 AC_ARG_ENABLE([setuid],
24 [AS_HELP_STRING([--enable-setuid=USER],
25 [make pterm setuid to a given user])],
28 *) setidtype=setuid; setidval="$enableval";;
30 AC_ARG_ENABLE([setgid],
31 [AS_HELP_STRING([--enable-setgid=GROUP],
32 [make pterm setgid to a given group])],
35 *) setidtype=setgid; setidval="$enableval";;
37 AM_CONDITIONAL(HAVE_SETID_CMD, [test "$setidtype" != "none"])
38 AS_IF([test "x$setidtype" = "xsetuid"],
39 [SETID_CMD="chown $setidval"; SETID_MODE="4755"])
40 AS_IF([test "x$setidtype" = "xsetgid"],
41 [SETID_CMD="chgrp $setidval"; SETID_MODE="2755"])
46 [AS_HELP_STRING([--without-gssapi],
47 [disable GSSAPI support])],
52 [AS_HELP_STRING([--with-quartz],
53 [build for the MacOS Quartz GTK back end])],
54 [AC_DEFINE([OSX_GTK], [1], [Define if building with GTK for MacOS.])],
58 AS_IF([test "x$with_gssapi" != xno],
59 [AC_DEFINE([WITH_GSSAPI], [1], [Define if building with GSSAPI support.])])
62 [AS_HELP_STRING([--with-gtk=VER],
63 [specify GTK version to use (`1', `2' or `3')])
64 AS_HELP_STRING([--without-gtk],
65 [do not use GTK (build command-line tools only)])],
66 [gtk_version_desired="$withval"],
67 [gtk_version_desired="any"])
69 case "$gtk_version_desired" in
70 1 | 2 | 3 | any | no) ;;
71 yes) gtk_version_desired="any" ;;
72 *) AC_ERROR([Invalid GTK version specified])
75 AC_CHECK_HEADERS([utmpx.h sys/select.h],,,[
76 #include <sys/types.h>
79 # Look for GTK 3, GTK 2 and GTK 1, in descending order of preference.
80 # If we can't find any, have the makefile only build the CLI programs.
84 case "$gtk_version_desired:$gtk" in
86 ifdef([AM_PATH_GTK_3_0],[
87 AM_PATH_GTK_3_0([3.0.0], [gtk=3], [])
88 ],[AC_WARNING([generating configure script without GTK 3 autodetection])])
92 case "$gtk_version_desired:$gtk" in
94 ifdef([AM_PATH_GTK_2_0],[
95 AM_PATH_GTK_2_0([2.0.0], [gtk=2], [])
96 ],[AC_WARNING([generating configure script without GTK 2 autodetection])])
100 case "$gtk_version_desired:$gtk" in
102 ifdef([AM_PATH_GTK],[
103 AM_PATH_GTK([1.2.0], [gtk=1], [])
105 # manual check for gtk1
106 AC_PATH_PROG(GTK1_CONFIG, gtk-config, absent)
107 if test "$GTK1_CONFIG" != "absent"; then
108 GTK_CFLAGS=`"$GTK1_CONFIG" --cflags`
109 GTK_LIBS=`"$GTK1_CONFIG" --libs`
116 AM_CONDITIONAL(HAVE_GTK, [test "$gtk" != "none"])
118 if test "$gtk" = "2" -o "$gtk" = "3"; then
119 ac_save_CFLAGS="$CFLAGS"
121 CFLAGS="$CFLAGS $GTK_CFLAGS"
122 LIBS="$GTK_LIBS $LIBS"
123 AC_CHECK_FUNCS([pango_font_family_is_monospace pango_font_map_list_families])
124 CFLAGS="$ac_save_CFLAGS"
128 AC_SEARCH_LIBS([socket], [xnet])
130 AS_IF([test "x$with_gssapi" != xno],
134 [AC_DEFINE([NO_LIBDL], [1], [Define if we could not find libdl.])
135 AC_CHECK_HEADERS([gssapi/gssapi.h])
137 [gss_init_sec_context],[gssapi gssapi_krb5 gss],
139 [AC_DEFINE([NO_GSSAPI_LIB], [1], [Define if we could not find a gssapi library])])])])
141 AC_CHECK_LIB(X11, XOpenDisplay,
142 [GTK_LIBS="-lX11 $GTK_LIBS"
143 AC_DEFINE([HAVE_LIBX11],[],[Define if libX11.a is available])])
145 AC_CHECK_FUNCS([getaddrinfo posix_openpt ptsname setresuid strsignal updwtmpx])
146 AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[#include <time.h>]])
147 AC_SEARCH_LIBS([clock_gettime], [rt], [AC_DEFINE([HAVE_CLOCK_GETTIME],[],[Define if clock_gettime() is available])])
149 AC_CACHE_CHECK([for SO_PEERCRED and dependencies], [x_cv_linux_so_peercred], [
153 #include <features.h>
154 #include <sys/socket.h>
157 socklen_t crlen = sizeof(cr);
158 return getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cr, &crlen) +
159 cr.pid + cr.uid + cr.gid;
162 AS_VAR_SET(x_cv_linux_so_peercred, yes),
163 AS_VAR_SET(x_cv_linux_so_peercred, no)
166 AS_IF([test AS_VAR_GET(x_cv_linux_so_peercred) = yes],
167 [AC_DEFINE([HAVE_SO_PEERCRED], [1],
168 [Define if SO_PEERCRED works in the Linux fashion.])]
171 if test "x$GCC" = "xyes"; then
173 AC_SUBST(WARNINGOPTS, ['-Wall -Werror'])
176 AC_SUBST(WARNINGOPTS, [])
181 if test "$gtk_version_desired" = "no"; then cat <<EOF
183 'configure' was instructed not to build using GTK. Therefore, PuTTY
184 itself and the other GUI utilities will not be built by the generated
185 Makefile: only the command-line tools such as puttygen, plink and
189 elif test "$gtk" = "none"; then cat <<EOF
191 'configure' was unable to find any version of the GTK libraries on
192 your system. Therefore, PuTTY itself and the other GUI utilities will
193 not be built by the generated Makefile: only the command-line tools
194 such as puttygen, plink and psftp will be built.
200 /* Convert autoconf definitions to ones that PuTTY wants. */
202 #ifndef HAVE_GETADDRINFO
205 #ifndef HAVE_SETRESUID
206 # define HAVE_NO_SETRESUID
208 #ifndef HAVE_STRSIGNAL
209 # define HAVE_NO_STRSIGNAL
211 #if !defined(HAVE_UTMPX_H) || !defined(HAVE_UPDWTMPX)
217 #ifndef HAVE_SYS_SELECT_H
218 # define HAVE_NO_SYS_SELECT_H
220 #ifndef HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
221 # define PANGO_PRE_1POINT4
223 #ifndef HAVE_PANGO_FONT_MAP_LIST_FAMILIES
224 # define PANGO_PRE_1POINT6
226 #if !defined(WITH_GSSAPI)
229 #if !defined(NO_GSSAPI) && defined(NO_LIBDL)
230 # if !defined(HAVE_GSSAPI_GSSAPI_H) || defined(NO_GSSAPI_LIB)