]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - configure.ac
first pass
[PuTTY.git] / configure.ac
index 29fbde6d6bf0114f401d304d1969ec6bce404190..adb31915b501f082e366c2297169df9189147948 100644 (file)
@@ -42,26 +42,47 @@ AS_IF([test "x$setidtype" = "xsetgid"],
 AC_SUBST(SETID_CMD)
 AC_SUBST(SETID_MODE)
 
+AC_ARG_ENABLE([git-commit],
+  [AS_HELP_STRING([--disable-git-commit],
+                  [disable embedding current git HEAD in binaries])],
+  [],
+  [if test -d "$srcdir/.git"; then
+    enable_git_commit=yes; else enable_git_commit=no; fi])
+
+if test "x$enable_git_commit" = "xyes" -a ! -d "$srcdir/.git"; then
+  AC_ERROR([Cannot --enable-git-commit when source tree is not a git checkout])
+fi
+AM_CONDITIONAL(AUTO_GIT_COMMIT, [test "x$enable_git_commit" = "xyes"])
+
 AC_ARG_WITH([gssapi],
   [AS_HELP_STRING([--without-gssapi],
                   [disable GSSAPI support])],
   [],
   [with_gssapi=yes])
 
+AC_ARG_WITH([quartz],
+  [AS_HELP_STRING([--with-quartz],
+                  [build for the MacOS Quartz GTK back end])],
+  [AC_DEFINE([OSX_GTK], [1], [Define if building with GTK for MacOS.])
+   with_quartz=yes],
+  [with_quartz=no])
+
+AM_CONDITIONAL([HAVE_QUARTZ],[test "x$with_quartz" = "xyes"])
+
 WITH_GSSAPI=
 AS_IF([test "x$with_gssapi" != xno],
   [AC_DEFINE([WITH_GSSAPI], [1], [Define if building with GSSAPI support.])])
 
 AC_ARG_WITH([gtk],
   [AS_HELP_STRING([--with-gtk=VER],
-                  [specify GTK version to use (`1' or `2')])
+                  [specify GTK version to use (`1', `2' or `3')])
 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 | no) ;;
+  1 | 2 | 3 | any | no) ;;
   yes) gtk_version_desired="any" ;;
   *) AC_ERROR([Invalid GTK version specified])
 esac
@@ -70,11 +91,19 @@ AC_CHECK_HEADERS([utmpx.h sys/select.h],,,[
 #include <sys/types.h>
 #include <utmp.h>])
 
-# 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.
+# Look for GTK 3, GTK 2 and GTK 1, in descending order of preference.
+# If we can't find any, have the makefile only build the CLI programs.
 
 gtk=none
 
+case "$gtk_version_desired:$gtk" in
+  3:none | any:none)
+    ifdef([AM_PATH_GTK_3_0],[
+    AM_PATH_GTK_3_0([3.0.0], [gtk=3], [])
+    ],[AC_WARNING([generating configure script without GTK 3 autodetection])])
+    ;;
+esac
+
 case "$gtk_version_desired:$gtk" in
   2:none | any:none)
     ifdef([AM_PATH_GTK_2_0],[
@@ -101,7 +130,7 @@ esac
 
 AM_CONDITIONAL(HAVE_GTK, [test "$gtk" != "none"])
 
-if test "$gtk" = "2"; then
+if test "$gtk" = "2" -o "$gtk" = "3"; then
   ac_save_CFLAGS="$CFLAGS"
   ac_save_LIBS="$LIBS"
   CFLAGS="$CFLAGS $GTK_CFLAGS"
@@ -132,6 +161,28 @@ 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])])
 
+AC_CACHE_CHECK([for SO_PEERCRED and dependencies], [x_cv_linux_so_peercred], [
+    AC_COMPILE_IFELSE([
+        AC_LANG_PROGRAM([[
+            #define _GNU_SOURCE
+            #include <features.h>
+            #include <sys/socket.h>
+          ]],[[
+            struct ucred cr;
+            socklen_t crlen = sizeof(cr);
+            return getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cr, &crlen) +
+            cr.pid + cr.uid + cr.gid;
+          ]]
+        )],
+        AS_VAR_SET(x_cv_linux_so_peercred, yes),
+        AS_VAR_SET(x_cv_linux_so_peercred, no)
+    )
+])
+AS_IF([test AS_VAR_GET(x_cv_linux_so_peercred) = yes],
+    [AC_DEFINE([HAVE_SO_PEERCRED], [1],
+     [Define if SO_PEERCRED works in the Linux fashion.])]
+)
+
 if test "x$GCC" = "xyes"; then
   :
   AC_SUBST(WARNINGOPTS, ['-Wall -Werror'])
@@ -152,7 +203,7 @@ 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
+'configure' was unable to find any version of the GTK libraries on
 your system. 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.