When we check for libX11 in the autoconf script, add it to $GTK_LIBS
[sgt/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
7AC_INIT
8AC_CONFIG_FILES([Makefile])
9AC_CONFIG_HEADERS([uxconfig.h:uxconfig.in])
10
11AC_PROG_INSTALL
12AC_PROG_CC
13if test "X$GCC" = Xyes; then
16707d1c 14 PUTTYCFLAGS="-Wall -Werror"
15else
16 PUTTYCFLAGS=""
76d3a838 17fi
16707d1c 18AC_SUBST(PUTTYCFLAGS)
76d3a838 19
b3d375b2 20AC_ARG_WITH([gssapi],
21 [AS_HELP_STRING([--without-gssapi],
22 [disable GSSAPI support])],
23 [],
24 [with_gssapi=yes])
25
26WITH_GSSAPI=
27AS_IF([test "x$with_gssapi" != xno],
28 [AC_DEFINE([WITH_GSSAPI], [1], [Define if building with GSSAPI support.])])
95aec249 29
a84abdae 30AC_ARG_WITH([gtk-version],
31 [AS_HELP_STRING([--with-gtk-version],
32 [specify GTK version to use (1 or 2) (optional)])],
33 [gtk_version_desired="$withval"],
34 [gtk_version_desired="any"])
35
36case "$gtk_version_desired" in
37 1 | 2 | any) ;;
38 *) AC_ERROR([Invalid GTK version specified])
39esac
40
154c73d5 41AC_CHECK_HEADERS([utmpx.h sys/select.h],,,[
bea25c48 42#include <sys/types.h>
43#include <utmp.h>])
dbf58cfa 44
f160b7b8 45# Look for both GTK 1 and GTK 2.
a84abdae 46
47gtk=none
48
49case "$gtk_version_desired" in
50 1 | any)
51 ifdef([AM_PATH_GTK],[
52 AM_PATH_GTK([1.2.0], [gtk=1], [])
53 ],[AC_WARNING([generating configure script without GTK 1 autodetection])])
54 ;;
55esac
56
57case "$gtk_version_desired" in
58 2 | any)
59 ifdef([AM_PATH_GTK_2_0],[
60 AM_PATH_GTK_2_0([2.0.0], [gtk=2], [])
61 ],[AC_WARNING([generating configure script without GTK 2 autodetection])])
62 ;;
63esac
64
f160b7b8 65if test "$gtk" = "none"; then
66 all_targets="all-cli"
67else
68 all_targets="all-cli all-gtk"
69fi
a84abdae 70
f160b7b8 71if test "$gtk" = "2"; then
72 ac_save_CFLAGS="$CFLAGS"
73 ac_save_LIBS="$LIBS"
74 CFLAGS="$CFLAGS $GTK_CFLAGS"
75 LIBS="$GTK_LIBS $LIBS"
76 AC_CHECK_FUNCS([pango_font_family_is_monospace pango_font_map_list_families])
77 CFLAGS="$ac_save_CFLAGS"
78 LIBS="$ac_save_LIBS"
79fi
76d3a838 80AC_SUBST([all_targets])
81
82AC_SEARCH_LIBS([socket], [xnet])
b3d375b2 83
84AS_IF([test "x$with_gssapi" != xno],
85 [AC_SEARCH_LIBS(
86 [dlopen],[dl],
87 [],
88 [AC_DEFINE([NO_LIBDL], [1], [Define if we could not find libdl.])
89 AC_CHECK_HEADERS([gssapi/gssapi.h])
90 AC_SEARCH_LIBS(
91 [gss_init_sec_context],[gssapi gssapi_krb5 gss],
92 [],
93 [AC_DEFINE([NO_GSSAPI_LIB], [1], [Define if we could not find a gssapi library])])])])
76d3a838 94
63c25c94 95AC_CHECK_LIB(X11, XOpenDisplay,
96 [GTK_LIBS="-lX11 $GTK_LIBS"
97 AC_DEFINE([HAVE_LIBX11],[],[Define if libX11.a is available])])
c349ffb1 98
b0f0a9f5 99AC_CHECK_FUNCS([getaddrinfo ptsname setresuid strsignal updwtmpx])
76d3a838 100
101AC_OUTPUT
102
103AH_BOTTOM([
104/* Convert autoconf definitions to ones that PuTTY wants. */
105
106#ifndef HAVE_GETADDRINFO
107# define NO_IPV6
108#endif
109#ifndef HAVE_SETRESUID
110# define HAVE_NO_SETRESUID
111#endif
112#ifndef HAVE_STRSIGNAL
113# define HAVE_NO_STRSIGNAL
114#endif
b0f0a9f5 115#if !defined(HAVE_UTMPX_H) || !defined(HAVE_UPDWTMPX)
76d3a838 116# define OMIT_UTMP
117#endif
118#ifndef HAVE_PTSNAME
119# define BSD_PTYS
120#endif
154c73d5 121#ifndef HAVE_SYS_SELECT_H
122# define HAVE_NO_SYS_SELECT_H
123#endif
f160b7b8 124#ifndef HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
125# define PANGO_PRE_1POINT4
126#endif
127#ifndef HAVE_PANGO_FONT_MAP_LIST_FAMILIES
128# define PANGO_PRE_1POINT6
129#endif
b3d375b2 130#if !defined(WITH_GSSAPI)
95aec249 131# define NO_GSSAPI
132#endif
b3d375b2 133#if !defined(NO_GSSAPI) && defined(NO_LIBDL)
134# if !defined(HAVE_GSSAPI_GSSAPI_H) || defined(NO_GSSAPI_LIB)
135# define NO_GSSAPI
136# endif
137#endif
76d3a838 138])