]> asedeno.scripts.mit.edu Git - PuTTY.git/blob - configure.ac
Implement "curve448-sha512" kex, from draft-ietf-curdle-ssh-curves-00.
[PuTTY.git] / 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 # 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
10 AC_INIT(putty, X.XX)
11 AC_CONFIG_FILES([Makefile])
12 AC_CONFIG_HEADERS([uxconfig.h:uxconfig.in])
13 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
14
15 AC_PROG_INSTALL
16 AC_PROG_RANLIB
17 ifdef([AM_PROG_AR],[AM_PROG_AR])
18 AM_PROG_CC_C_O
19
20 # Mild abuse of the '--enable' option format to allow manual
21 # specification of setuid or setgid setup in pterm.
22 setidtype=none
23 AC_ARG_ENABLE([setuid],
24             [AS_HELP_STRING([--enable-setuid=USER],
25                             [make pterm setuid to a given user])],
26             [case "$enableval" in
27                no) setidtype=none;;
28                *) setidtype=setuid; setidval="$enableval";;
29              esac])
30 AC_ARG_ENABLE([setgid],
31             [AS_HELP_STRING([--enable-setgid=GROUP],
32                             [make pterm setgid to a given group])],
33             [case "$enableval" in
34                no) setidtype=none;;
35                *) setidtype=setgid; setidval="$enableval";;
36              esac])
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"])
42 AC_SUBST(SETID_CMD)
43 AC_SUBST(SETID_MODE)
44
45 AC_ARG_WITH([gssapi],
46   [AS_HELP_STRING([--without-gssapi],
47                   [disable GSSAPI support])],
48   [],
49   [with_gssapi=yes])
50
51 AC_ARG_WITH([quartz],
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.])
55    with_quartz=yes],
56   [with_quartz=no])
57
58 AM_CONDITIONAL([HAVE_QUARTZ],[test "x$with_quartz" = "xyes"])
59
60 WITH_GSSAPI=
61 AS_IF([test "x$with_gssapi" != xno],
62   [AC_DEFINE([WITH_GSSAPI], [1], [Define if building with GSSAPI support.])])
63
64 AC_ARG_WITH([gtk],
65   [AS_HELP_STRING([--with-gtk=VER],
66                   [specify GTK version to use (`1', `2' or `3')])
67 AS_HELP_STRING([--without-gtk],
68                   [do not use GTK (build command-line tools only)])],
69   [gtk_version_desired="$withval"],
70   [gtk_version_desired="any"])
71
72 case "$gtk_version_desired" in
73   1 | 2 | 3 | any | no) ;;
74   yes) gtk_version_desired="any" ;;
75   *) AC_ERROR([Invalid GTK version specified])
76 esac
77
78 AC_CHECK_HEADERS([utmpx.h sys/select.h],,,[
79 #include <sys/types.h>
80 #include <utmp.h>])
81
82 # Look for GTK 3, GTK 2 and GTK 1, in descending order of preference.
83 # If we can't find any, have the makefile only build the CLI programs.
84
85 gtk=none
86
87 case "$gtk_version_desired:$gtk" in
88   3:none | any:none)
89     ifdef([AM_PATH_GTK_3_0],[
90     AM_PATH_GTK_3_0([3.0.0], [gtk=3], [])
91     ],[AC_WARNING([generating configure script without GTK 3 autodetection])])
92     ;;
93 esac
94
95 case "$gtk_version_desired:$gtk" in
96   2:none | any:none)
97     ifdef([AM_PATH_GTK_2_0],[
98     AM_PATH_GTK_2_0([2.0.0], [gtk=2], [])
99     ],[AC_WARNING([generating configure script without GTK 2 autodetection])])
100     ;;
101 esac
102
103 case "$gtk_version_desired:$gtk" in
104   1:none | any:none)
105     ifdef([AM_PATH_GTK],[
106     AM_PATH_GTK([1.2.0], [gtk=1], [])
107     ],[
108     # manual check for gtk1
109     AC_PATH_PROG(GTK1_CONFIG, gtk-config, absent)
110     if test "$GTK1_CONFIG" != "absent"; then
111       GTK_CFLAGS=`"$GTK1_CONFIG" --cflags`
112       GTK_LIBS=`"$GTK1_CONFIG" --libs`
113       gtk=1
114     fi
115     ])
116     ;;
117 esac
118
119 AM_CONDITIONAL(HAVE_GTK, [test "$gtk" != "none"])
120
121 if test "$gtk" = "2" -o "$gtk" = "3"; then
122   ac_save_CFLAGS="$CFLAGS"
123   ac_save_LIBS="$LIBS"
124   CFLAGS="$CFLAGS $GTK_CFLAGS"
125   LIBS="$GTK_LIBS $LIBS"
126   AC_CHECK_FUNCS([pango_font_family_is_monospace pango_font_map_list_families])
127   CFLAGS="$ac_save_CFLAGS"
128   LIBS="$ac_save_LIBS"
129 fi
130
131 AC_SEARCH_LIBS([socket], [xnet])
132
133 AS_IF([test "x$with_gssapi" != xno],
134   [AC_SEARCH_LIBS(
135     [dlopen],[dl],
136     [],
137     [AC_DEFINE([NO_LIBDL], [1], [Define if we could not find libdl.])
138      AC_CHECK_HEADERS([gssapi/gssapi.h])
139      AC_SEARCH_LIBS(
140        [gss_init_sec_context],[gssapi gssapi_krb5 gss],
141        [],
142        [AC_DEFINE([NO_GSSAPI_LIB], [1], [Define if we could not find a gssapi library])])])])
143
144 AC_CHECK_LIB(X11, XOpenDisplay,
145              [GTK_LIBS="-lX11 $GTK_LIBS"
146               AC_DEFINE([HAVE_LIBX11],[],[Define if libX11.a is available])])
147
148 AC_CHECK_FUNCS([getaddrinfo posix_openpt ptsname setresuid strsignal updwtmpx])
149 AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[#include <time.h>]])
150 AC_SEARCH_LIBS([clock_gettime], [rt], [AC_DEFINE([HAVE_CLOCK_GETTIME],[],[Define if clock_gettime() is available])])
151
152 AC_CACHE_CHECK([for SO_PEERCRED and dependencies], [x_cv_linux_so_peercred], [
153     AC_COMPILE_IFELSE([
154         AC_LANG_PROGRAM([[
155             #define _GNU_SOURCE
156             #include <features.h>
157             #include <sys/socket.h>
158           ]],[[
159             struct ucred cr;
160             socklen_t crlen = sizeof(cr);
161             return getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cr, &crlen) +
162             cr.pid + cr.uid + cr.gid;
163           ]]
164         )],
165         AS_VAR_SET(x_cv_linux_so_peercred, yes),
166         AS_VAR_SET(x_cv_linux_so_peercred, no)
167     )
168 ])
169 AS_IF([test AS_VAR_GET(x_cv_linux_so_peercred) = yes],
170     [AC_DEFINE([HAVE_SO_PEERCRED], [1],
171      [Define if SO_PEERCRED works in the Linux fashion.])]
172 )
173
174 if test "x$GCC" = "xyes"; then
175   :
176   AC_SUBST(WARNINGOPTS, ['-Wall -Werror'])
177 else
178   :
179   AC_SUBST(WARNINGOPTS, [])
180 fi
181
182 AC_OUTPUT
183
184 if test "$gtk_version_desired" = "no"; then cat <<EOF
185
186 'configure' was instructed not to build using GTK. Therefore, PuTTY
187 itself and the other GUI utilities will not be built by the generated
188 Makefile: only the command-line tools such as puttygen, plink and
189 psftp will be built.
190
191 EOF
192 elif test "$gtk" = "none"; then cat <<EOF
193
194 'configure' was unable to find any version of the GTK libraries on
195 your system. Therefore, PuTTY itself and the other GUI utilities will
196 not be built by the generated Makefile: only the command-line tools
197 such as puttygen, plink and psftp will be built.
198
199 EOF
200 fi
201
202 AH_BOTTOM([
203 /* Convert autoconf definitions to ones that PuTTY wants. */
204
205 #ifndef HAVE_GETADDRINFO
206 # define NO_IPV6
207 #endif
208 #ifndef HAVE_SETRESUID
209 # define HAVE_NO_SETRESUID
210 #endif
211 #ifndef HAVE_STRSIGNAL
212 # define HAVE_NO_STRSIGNAL
213 #endif
214 #if !defined(HAVE_UTMPX_H) || !defined(HAVE_UPDWTMPX)
215 # define OMIT_UTMP
216 #endif
217 #ifndef HAVE_PTSNAME
218 # define BSD_PTYS
219 #endif
220 #ifndef HAVE_SYS_SELECT_H
221 # define HAVE_NO_SYS_SELECT_H
222 #endif
223 #ifndef HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
224 # define PANGO_PRE_1POINT4
225 #endif
226 #ifndef HAVE_PANGO_FONT_MAP_LIST_FAMILIES
227 # define PANGO_PRE_1POINT6
228 #endif
229 #if !defined(WITH_GSSAPI)
230 # define NO_GSSAPI
231 #endif
232 #if !defined(NO_GSSAPI) && defined(NO_LIBDL)
233 # if !defined(HAVE_GSSAPI_GSSAPI_H) || defined(NO_GSSAPI_LIB)
234 #  define NO_GSSAPI
235 # endif
236 #endif
237 ])