Patch from Brad Smith to use posix_openpt() instead of
[sgt/putty] / unix / configure.ac
index 2115dff..17db126 100644 (file)
@@ -50,14 +50,17 @@ WITH_GSSAPI=
 AS_IF([test "x$with_gssapi" != xno],
   [AC_DEFINE([WITH_GSSAPI], [1], [Define if building with GSSAPI support.])])
 
-AC_ARG_WITH([gtk-version],
-  [AS_HELP_STRING([--with-gtk-version],
-                  [specify GTK version to use (1 or 2) (optional)])],
+AC_ARG_WITH([gtk],
+  [AS_HELP_STRING([--with-gtk=VER],
+                  [specify GTK version to use (`1' or `2')])
+AS_HELP_STRING([--without-gtk],
+                  [do not use GTK (build command-line tools only)])],
   [gtk_version_desired="$withval"],
   [gtk_version_desired="any"])
 
 case "$gtk_version_desired" in
-  1 | 2 | any) ;;
+  1 | 2 | any | no) ;;
+  yes) gtk_version_desired="any" ;;
   *) AC_ERROR([Invalid GTK version specified])
 esac
 
@@ -65,27 +68,27 @@ AC_CHECK_HEADERS([utmpx.h sys/select.h],,,[
 #include <sys/types.h>
 #include <utmp.h>])
 
-# Look for both GTK 1 and GTK 2. If we can't find either, have the
-# makefile only build the CLI programs.
+# Look for both GTK 2 and GTK 1, in descending order of preference. If
+# we can't find either, have the makefile only build the CLI programs.
 
 gtk=none
 
-case "$gtk_version_desired" in
-  1 | any)
-    ifdef([AM_PATH_GTK],[
-    AM_PATH_GTK([1.2.0], [gtk=1], [])
-    ],[AC_WARNING([generating configure script without GTK 1 autodetection])])
-    ;;
-esac
-
-case "$gtk_version_desired" in
-  2 | any)
+case "$gtk_version_desired:$gtk" in
+  2:none | any:none)
     ifdef([AM_PATH_GTK_2_0],[
     AM_PATH_GTK_2_0([2.0.0], [gtk=2], [])
     ],[AC_WARNING([generating configure script without GTK 2 autodetection])])
     ;;
 esac
 
+case "$gtk_version_desired:$gtk" in
+  1:none | any:none)
+    ifdef([AM_PATH_GTK],[
+    AM_PATH_GTK([1.2.0], [gtk=1], [])
+    ],[AC_WARNING([generating configure script without GTK 1 autodetection])])
+    ;;
+esac
+
 AM_CONDITIONAL(HAVE_GTK, [test "$gtk" != "none"])
 
 if test "$gtk" = "2"; then
@@ -115,11 +118,29 @@ AC_CHECK_LIB(X11, XOpenDisplay,
              [GTK_LIBS="-lX11 $GTK_LIBS"
               AC_DEFINE([HAVE_LIBX11],[],[Define if libX11.a is available])])
 
-AC_CHECK_FUNCS([getaddrinfo ptsname setresuid strsignal updwtmpx])
+AC_CHECK_FUNCS([getaddrinfo posix_openpt ptsname setresuid strsignal updwtmpx])
+AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[#include <time.h>]])
+AC_SEARCH_LIBS([clock_gettime], [rt], [AC_DEFINE([HAVE_CLOCK_GETTIME],[],[Define if clock_gettime() is available])])
+
+if test "x$GCC" = "xyes"; then
+  :
+  AC_SUBST(WARNINGOPTS, ['-Wall -Werror'])
+else
+  :
+  AC_SUBST(WARNINGOPTS, [])
+fi
 
 AC_OUTPUT
 
-if test "$gtk" = "none"; then cat <<EOF
+if test "$gtk_version_desired" = "no"; then cat <<EOF
+
+'configure' was instructed not to build using GTK. Therefore, PuTTY
+itself and the other GUI utilities will not be built by the generated
+Makefile: only the command-line tools such as puttygen, plink and
+psftp will be built.
+
+EOF
+elif test "$gtk" = "none"; then cat <<EOF
 
 'configure' was unable to find either the GTK 1 or GTK 2 libraries on
 your system. Therefore, PuTTY itself and the other GUI utilities will