76d3a838 |
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 | |
44747c53 |
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) |
76d3a838 |
11 | AC_CONFIG_FILES([Makefile]) |
12 | AC_CONFIG_HEADERS([uxconfig.h:uxconfig.in]) |
44747c53 |
13 | AM_INIT_AUTOMAKE([-Wall -Werror foreign]) |
76d3a838 |
14 | |
15 | AC_PROG_INSTALL |
44747c53 |
16 | AC_PROG_RANLIB |
17 | |
18 | # Mild abuse of the '--enable' option format to allow manual |
19 | # specification of setuid or setgid setup in pterm. |
20 | setidtype=none |
21 | AC_ARG_ENABLE([setuid], |
22 | [AS_HELP_STRING([--enable-setuid=USER], |
23 | [make pterm setuid to a given user])], |
24 | [case "$enableval" in |
25 | no) setidtype=none;; |
26 | *) setidtype=setuid; setidval="$enableval";; |
27 | esac]) |
28 | AC_ARG_ENABLE([setgid], |
29 | [AS_HELP_STRING([--enable-setgid=GROUP], |
30 | [make pterm setgid to a given group])], |
31 | [case "$enableval" in |
32 | no) setidtype=none;; |
33 | *) setidtype=setgid; setidval="$enableval";; |
34 | esac]) |
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"]) |
40 | AC_SUBST(SETID_CMD) |
41 | AC_SUBST(SETID_MODE) |
76d3a838 |
42 | |
b3d375b2 |
43 | AC_ARG_WITH([gssapi], |
44 | [AS_HELP_STRING([--without-gssapi], |
45 | [disable GSSAPI support])], |
46 | [], |
47 | [with_gssapi=yes]) |
48 | |
49 | WITH_GSSAPI= |
50 | AS_IF([test "x$with_gssapi" != xno], |
51 | [AC_DEFINE([WITH_GSSAPI], [1], [Define if building with GSSAPI support.])]) |
95aec249 |
52 | |
691b58ac |
53 | AC_ARG_WITH([gtk], |
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)])], |
a84abdae |
58 | [gtk_version_desired="$withval"], |
59 | [gtk_version_desired="any"]) |
60 | |
61 | case "$gtk_version_desired" in |
691b58ac |
62 | 1 | 2 | any | no) ;; |
63 | yes) gtk_version_desired="any" ;; |
a84abdae |
64 | *) AC_ERROR([Invalid GTK version specified]) |
65 | esac |
66 | |
154c73d5 |
67 | AC_CHECK_HEADERS([utmpx.h sys/select.h],,,[ |
bea25c48 |
68 | #include <sys/types.h> |
69 | #include <utmp.h>]) |
dbf58cfa |
70 | |
fe165011 |
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. |
a84abdae |
73 | |
74 | gtk=none |
75 | |
fe165011 |
76 | case "$gtk_version_desired:$gtk" in |
77 | 2:none | any:none) |
a84abdae |
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])]) |
81 | ;; |
82 | esac |
83 | |
fe165011 |
84 | case "$gtk_version_desired:$gtk" in |
85 | 1:none | any:none) |
86 | ifdef([AM_PATH_GTK],[ |
87 | AM_PATH_GTK([1.2.0], [gtk=1], []) |
f0001709 |
88 | ],[ |
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` |
94 | gtk=1 |
95 | fi |
96 | ]) |
fe165011 |
97 | ;; |
98 | esac |
99 | |
44747c53 |
100 | AM_CONDITIONAL(HAVE_GTK, [test "$gtk" != "none"]) |
a84abdae |
101 | |
f160b7b8 |
102 | if test "$gtk" = "2"; then |
103 | ac_save_CFLAGS="$CFLAGS" |
104 | ac_save_LIBS="$LIBS" |
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" |
109 | LIBS="$ac_save_LIBS" |
110 | fi |
76d3a838 |
111 | |
112 | AC_SEARCH_LIBS([socket], [xnet]) |
b3d375b2 |
113 | |
114 | AS_IF([test "x$with_gssapi" != xno], |
115 | [AC_SEARCH_LIBS( |
116 | [dlopen],[dl], |
117 | [], |
118 | [AC_DEFINE([NO_LIBDL], [1], [Define if we could not find libdl.]) |
119 | AC_CHECK_HEADERS([gssapi/gssapi.h]) |
120 | AC_SEARCH_LIBS( |
121 | [gss_init_sec_context],[gssapi gssapi_krb5 gss], |
122 | [], |
123 | [AC_DEFINE([NO_GSSAPI_LIB], [1], [Define if we could not find a gssapi library])])])]) |
76d3a838 |
124 | |
63c25c94 |
125 | AC_CHECK_LIB(X11, XOpenDisplay, |
126 | [GTK_LIBS="-lX11 $GTK_LIBS" |
127 | AC_DEFINE([HAVE_LIBX11],[],[Define if libX11.a is available])]) |
c349ffb1 |
128 | |
32f8db2c |
129 | AC_CHECK_FUNCS([getaddrinfo posix_openpt ptsname setresuid strsignal updwtmpx]) |
92fb929a |
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])]) |
76d3a838 |
132 | |
b8487fe0 |
133 | if test "x$GCC" = "xyes"; then |
134 | : |
135 | AC_SUBST(WARNINGOPTS, ['-Wall -Werror']) |
136 | else |
137 | : |
138 | AC_SUBST(WARNINGOPTS, []) |
139 | fi |
140 | |
76d3a838 |
141 | AC_OUTPUT |
142 | |
691b58ac |
143 | if test "$gtk_version_desired" = "no"; then cat <<EOF |
144 | |
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 |
148 | psftp will be built. |
149 | |
150 | EOF |
151 | elif test "$gtk" = "none"; then cat <<EOF |
44747c53 |
152 | |
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. |
157 | |
158 | EOF |
159 | fi |
160 | |
76d3a838 |
161 | AH_BOTTOM([ |
162 | /* Convert autoconf definitions to ones that PuTTY wants. */ |
163 | |
164 | #ifndef HAVE_GETADDRINFO |
165 | # define NO_IPV6 |
166 | #endif |
167 | #ifndef HAVE_SETRESUID |
168 | # define HAVE_NO_SETRESUID |
169 | #endif |
170 | #ifndef HAVE_STRSIGNAL |
171 | # define HAVE_NO_STRSIGNAL |
172 | #endif |
b0f0a9f5 |
173 | #if !defined(HAVE_UTMPX_H) || !defined(HAVE_UPDWTMPX) |
76d3a838 |
174 | # define OMIT_UTMP |
175 | #endif |
176 | #ifndef HAVE_PTSNAME |
177 | # define BSD_PTYS |
178 | #endif |
154c73d5 |
179 | #ifndef HAVE_SYS_SELECT_H |
180 | # define HAVE_NO_SYS_SELECT_H |
181 | #endif |
f160b7b8 |
182 | #ifndef HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE |
183 | # define PANGO_PRE_1POINT4 |
184 | #endif |
185 | #ifndef HAVE_PANGO_FONT_MAP_LIST_FAMILIES |
186 | # define PANGO_PRE_1POINT6 |
187 | #endif |
b3d375b2 |
188 | #if !defined(WITH_GSSAPI) |
95aec249 |
189 | # define NO_GSSAPI |
190 | #endif |
b3d375b2 |
191 | #if !defined(NO_GSSAPI) && defined(NO_LIBDL) |
192 | # if !defined(HAVE_GSSAPI_GSSAPI_H) || defined(NO_GSSAPI_LIB) |
193 | # define NO_GSSAPI |
194 | # endif |
195 | #endif |
76d3a838 |
196 | ]) |