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 | |
a84abdae |
53 | AC_ARG_WITH([gtk-version], |
54 | [AS_HELP_STRING([--with-gtk-version], |
55 | [specify GTK version to use (1 or 2) (optional)])], |
56 | [gtk_version_desired="$withval"], |
57 | [gtk_version_desired="any"]) |
58 | |
59 | case "$gtk_version_desired" in |
60 | 1 | 2 | any) ;; |
61 | *) AC_ERROR([Invalid GTK version specified]) |
62 | esac |
63 | |
154c73d5 |
64 | AC_CHECK_HEADERS([utmpx.h sys/select.h],,,[ |
bea25c48 |
65 | #include <sys/types.h> |
66 | #include <utmp.h>]) |
dbf58cfa |
67 | |
44747c53 |
68 | # Look for both GTK 1 and GTK 2. If we can't find either, have the |
69 | # makefile only build the CLI programs. |
a84abdae |
70 | |
71 | gtk=none |
72 | |
73 | case "$gtk_version_desired" in |
74 | 1 | any) |
75 | ifdef([AM_PATH_GTK],[ |
76 | AM_PATH_GTK([1.2.0], [gtk=1], []) |
77 | ],[AC_WARNING([generating configure script without GTK 1 autodetection])]) |
78 | ;; |
79 | esac |
80 | |
81 | case "$gtk_version_desired" in |
82 | 2 | any) |
83 | ifdef([AM_PATH_GTK_2_0],[ |
84 | AM_PATH_GTK_2_0([2.0.0], [gtk=2], []) |
85 | ],[AC_WARNING([generating configure script without GTK 2 autodetection])]) |
86 | ;; |
87 | esac |
88 | |
44747c53 |
89 | AM_CONDITIONAL(HAVE_GTK, [test "$gtk" != "none"]) |
a84abdae |
90 | |
f160b7b8 |
91 | if test "$gtk" = "2"; then |
92 | ac_save_CFLAGS="$CFLAGS" |
93 | ac_save_LIBS="$LIBS" |
94 | CFLAGS="$CFLAGS $GTK_CFLAGS" |
95 | LIBS="$GTK_LIBS $LIBS" |
96 | AC_CHECK_FUNCS([pango_font_family_is_monospace pango_font_map_list_families]) |
97 | CFLAGS="$ac_save_CFLAGS" |
98 | LIBS="$ac_save_LIBS" |
99 | fi |
76d3a838 |
100 | |
101 | AC_SEARCH_LIBS([socket], [xnet]) |
b3d375b2 |
102 | |
103 | AS_IF([test "x$with_gssapi" != xno], |
104 | [AC_SEARCH_LIBS( |
105 | [dlopen],[dl], |
106 | [], |
107 | [AC_DEFINE([NO_LIBDL], [1], [Define if we could not find libdl.]) |
108 | AC_CHECK_HEADERS([gssapi/gssapi.h]) |
109 | AC_SEARCH_LIBS( |
110 | [gss_init_sec_context],[gssapi gssapi_krb5 gss], |
111 | [], |
112 | [AC_DEFINE([NO_GSSAPI_LIB], [1], [Define if we could not find a gssapi library])])])]) |
76d3a838 |
113 | |
63c25c94 |
114 | AC_CHECK_LIB(X11, XOpenDisplay, |
115 | [GTK_LIBS="-lX11 $GTK_LIBS" |
116 | AC_DEFINE([HAVE_LIBX11],[],[Define if libX11.a is available])]) |
c349ffb1 |
117 | |
b0f0a9f5 |
118 | AC_CHECK_FUNCS([getaddrinfo ptsname setresuid strsignal updwtmpx]) |
76d3a838 |
119 | |
120 | AC_OUTPUT |
121 | |
44747c53 |
122 | if test "$gtk" = "none"; then cat <<EOF |
123 | |
124 | 'configure' was unable to find either the GTK 1 or GTK 2 libraries on |
125 | your system. Therefore, PuTTY itself and the other GUI utilities will |
126 | not be built by the generated Makefile: only the command-line tools |
127 | such as puttygen, plink and psftp will be built. |
128 | |
129 | EOF |
130 | fi |
131 | |
76d3a838 |
132 | AH_BOTTOM([ |
133 | /* Convert autoconf definitions to ones that PuTTY wants. */ |
134 | |
135 | #ifndef HAVE_GETADDRINFO |
136 | # define NO_IPV6 |
137 | #endif |
138 | #ifndef HAVE_SETRESUID |
139 | # define HAVE_NO_SETRESUID |
140 | #endif |
141 | #ifndef HAVE_STRSIGNAL |
142 | # define HAVE_NO_STRSIGNAL |
143 | #endif |
b0f0a9f5 |
144 | #if !defined(HAVE_UTMPX_H) || !defined(HAVE_UPDWTMPX) |
76d3a838 |
145 | # define OMIT_UTMP |
146 | #endif |
147 | #ifndef HAVE_PTSNAME |
148 | # define BSD_PTYS |
149 | #endif |
154c73d5 |
150 | #ifndef HAVE_SYS_SELECT_H |
151 | # define HAVE_NO_SYS_SELECT_H |
152 | #endif |
f160b7b8 |
153 | #ifndef HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE |
154 | # define PANGO_PRE_1POINT4 |
155 | #endif |
156 | #ifndef HAVE_PANGO_FONT_MAP_LIST_FAMILIES |
157 | # define PANGO_PRE_1POINT6 |
158 | #endif |
b3d375b2 |
159 | #if !defined(WITH_GSSAPI) |
95aec249 |
160 | # define NO_GSSAPI |
161 | #endif |
b3d375b2 |
162 | #if !defined(NO_GSSAPI) && defined(NO_LIBDL) |
163 | # if !defined(HAVE_GSSAPI_GSSAPI_H) || defined(NO_GSSAPI_LIB) |
164 | # define NO_GSSAPI |
165 | # endif |
166 | #endif |
76d3a838 |
167 | ]) |