Add a -U option to mkfiles.pl, which is just like -u except that it
[u/mdw/putty] / unix / configure.ac
CommitLineData
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
10AC_INIT(putty, X.XX)
76d3a838 11AC_CONFIG_FILES([Makefile])
12AC_CONFIG_HEADERS([uxconfig.h:uxconfig.in])
44747c53 13AM_INIT_AUTOMAKE([-Wall -Werror foreign])
76d3a838 14
15AC_PROG_INSTALL
44747c53 16AC_PROG_RANLIB
17
18# Mild abuse of the '--enable' option format to allow manual
19# specification of setuid or setgid setup in pterm.
20setidtype=none
21AC_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])
28AC_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])
35AM_CONDITIONAL(HAVE_SETID_CMD, [test "$setidtype" != "none"])
36AS_IF([test "x$setidtype" = "xsetuid"],
37 [SETID_CMD="chown $setidval"; SETID_MODE="4755"])
38AS_IF([test "x$setidtype" = "xsetgid"],
39 [SETID_CMD="chgrp $setidval"; SETID_MODE="2755"])
40AC_SUBST(SETID_CMD)
41AC_SUBST(SETID_MODE)
76d3a838 42
b3d375b2 43AC_ARG_WITH([gssapi],
44 [AS_HELP_STRING([--without-gssapi],
45 [disable GSSAPI support])],
46 [],
47 [with_gssapi=yes])
48
49WITH_GSSAPI=
50AS_IF([test "x$with_gssapi" != xno],
51 [AC_DEFINE([WITH_GSSAPI], [1], [Define if building with GSSAPI support.])])
95aec249 52
691b58ac 53AC_ARG_WITH([gtk],
54 [AS_HELP_STRING([--with-gtk=VER],
55 [specify GTK version to use (`1' or `2')])
56AS_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
61case "$gtk_version_desired" in
691b58ac 62 1 | 2 | any | no) ;;
63 yes) gtk_version_desired="any" ;;
a84abdae 64 *) AC_ERROR([Invalid GTK version specified])
65esac
66
154c73d5 67AC_CHECK_HEADERS([utmpx.h sys/select.h],,,[
bea25c48 68#include <sys/types.h>
69#include <utmp.h>])
dbf58cfa 70
44747c53 71# Look for both GTK 1 and GTK 2. If we can't find either, have the
72# makefile only build the CLI programs.
a84abdae 73
74gtk=none
75
76case "$gtk_version_desired" in
77 1 | any)
78 ifdef([AM_PATH_GTK],[
79 AM_PATH_GTK([1.2.0], [gtk=1], [])
80 ],[AC_WARNING([generating configure script without GTK 1 autodetection])])
81 ;;
82esac
83
84case "$gtk_version_desired" in
85 2 | any)
86 ifdef([AM_PATH_GTK_2_0],[
87 AM_PATH_GTK_2_0([2.0.0], [gtk=2], [])
88 ],[AC_WARNING([generating configure script without GTK 2 autodetection])])
89 ;;
90esac
91
44747c53 92AM_CONDITIONAL(HAVE_GTK, [test "$gtk" != "none"])
a84abdae 93
f160b7b8 94if test "$gtk" = "2"; then
95 ac_save_CFLAGS="$CFLAGS"
96 ac_save_LIBS="$LIBS"
97 CFLAGS="$CFLAGS $GTK_CFLAGS"
98 LIBS="$GTK_LIBS $LIBS"
99 AC_CHECK_FUNCS([pango_font_family_is_monospace pango_font_map_list_families])
100 CFLAGS="$ac_save_CFLAGS"
101 LIBS="$ac_save_LIBS"
102fi
76d3a838 103
104AC_SEARCH_LIBS([socket], [xnet])
b3d375b2 105
106AS_IF([test "x$with_gssapi" != xno],
107 [AC_SEARCH_LIBS(
108 [dlopen],[dl],
109 [],
110 [AC_DEFINE([NO_LIBDL], [1], [Define if we could not find libdl.])
111 AC_CHECK_HEADERS([gssapi/gssapi.h])
112 AC_SEARCH_LIBS(
113 [gss_init_sec_context],[gssapi gssapi_krb5 gss],
114 [],
115 [AC_DEFINE([NO_GSSAPI_LIB], [1], [Define if we could not find a gssapi library])])])])
76d3a838 116
63c25c94 117AC_CHECK_LIB(X11, XOpenDisplay,
118 [GTK_LIBS="-lX11 $GTK_LIBS"
119 AC_DEFINE([HAVE_LIBX11],[],[Define if libX11.a is available])])
c349ffb1 120
b0f0a9f5 121AC_CHECK_FUNCS([getaddrinfo ptsname setresuid strsignal updwtmpx])
76d3a838 122
123AC_OUTPUT
124
691b58ac 125if test "$gtk_version_desired" = "no"; then cat <<EOF
126
127'configure' was instructed not to build using GTK. Therefore, PuTTY
128itself and the other GUI utilities will not be built by the generated
129Makefile: only the command-line tools such as puttygen, plink and
130psftp will be built.
131
132EOF
133elif test "$gtk" = "none"; then cat <<EOF
44747c53 134
135'configure' was unable to find either the GTK 1 or GTK 2 libraries on
136your system. Therefore, PuTTY itself and the other GUI utilities will
137not be built by the generated Makefile: only the command-line tools
138such as puttygen, plink and psftp will be built.
139
140EOF
141fi
142
76d3a838 143AH_BOTTOM([
144/* Convert autoconf definitions to ones that PuTTY wants. */
145
146#ifndef HAVE_GETADDRINFO
147# define NO_IPV6
148#endif
149#ifndef HAVE_SETRESUID
150# define HAVE_NO_SETRESUID
151#endif
152#ifndef HAVE_STRSIGNAL
153# define HAVE_NO_STRSIGNAL
154#endif
b0f0a9f5 155#if !defined(HAVE_UTMPX_H) || !defined(HAVE_UPDWTMPX)
76d3a838 156# define OMIT_UTMP
157#endif
158#ifndef HAVE_PTSNAME
159# define BSD_PTYS
160#endif
154c73d5 161#ifndef HAVE_SYS_SELECT_H
162# define HAVE_NO_SYS_SELECT_H
163#endif
f160b7b8 164#ifndef HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
165# define PANGO_PRE_1POINT4
166#endif
167#ifndef HAVE_PANGO_FONT_MAP_LIST_FAMILIES
168# define PANGO_PRE_1POINT6
169#endif
b3d375b2 170#if !defined(WITH_GSSAPI)
95aec249 171# define NO_GSSAPI
172#endif
b3d375b2 173#if !defined(NO_GSSAPI) && defined(NO_LIBDL)
174# if !defined(HAVE_GSSAPI_GSSAPI_H) || defined(NO_GSSAPI_LIB)
175# define NO_GSSAPI
176# endif
177#endif
76d3a838 178])