# * Automake (for aclocal)
# If you've got them, running "autoreconf" should work.
-AC_INIT
+# Version number is substituted by Buildscr for releases, snapshots
+# and custom builds out of svn; X.XX shows up in ad-hoc developer
+# builds, which shouldn't matter
+AC_INIT(putty, X.XX)
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([uxconfig.h:uxconfig.in])
+AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_INSTALL
-AC_PROG_CC
-if test "X$GCC" = Xyes; then
- PUTTYCFLAGS="-Wall -Werror"
-else
- PUTTYCFLAGS=""
-fi
-AC_SUBST(PUTTYCFLAGS)
+AC_PROG_RANLIB
+
+# Mild abuse of the '--enable' option format to allow manual
+# specification of setuid or setgid setup in pterm.
+setidtype=none
+AC_ARG_ENABLE([setuid],
+ [AS_HELP_STRING([--enable-setuid=USER],
+ [make pterm setuid to a given user])],
+ [case "$enableval" in
+ no) setidtype=none;;
+ *) setidtype=setuid; setidval="$enableval";;
+ esac])
+AC_ARG_ENABLE([setgid],
+ [AS_HELP_STRING([--enable-setgid=GROUP],
+ [make pterm setgid to a given group])],
+ [case "$enableval" in
+ no) setidtype=none;;
+ *) setidtype=setgid; setidval="$enableval";;
+ esac])
+AM_CONDITIONAL(HAVE_SETID_CMD, [test "$setidtype" != "none"])
+AS_IF([test "x$setidtype" = "xsetuid"],
+ [SETID_CMD="chown $setidval"; SETID_MODE="4755"])
+AS_IF([test "x$setidtype" = "xsetgid"],
+ [SETID_CMD="chgrp $setidval"; SETID_MODE="2755"])
+AC_SUBST(SETID_CMD)
+AC_SUBST(SETID_MODE)
AC_ARG_WITH([gssapi],
[AS_HELP_STRING([--without-gssapi],
#include <sys/types.h>
#include <utmp.h>])
-# Look for both GTK 1 and GTK 2.
+# Look for both GTK 1 and GTK 2. If we can't find either, have the
+# makefile only build the CLI programs.
gtk=none
;;
esac
-if test "$gtk" = "none"; then
- all_targets="all-cli"
-else
- all_targets="all-cli all-gtk"
-fi
+AM_CONDITIONAL(HAVE_GTK, [test "$gtk" != "none"])
if test "$gtk" = "2"; then
ac_save_CFLAGS="$CFLAGS"
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
-AC_SUBST([all_targets])
AC_SEARCH_LIBS([socket], [xnet])
AC_OUTPUT
+if 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
+not be built by the generated Makefile: only the command-line tools
+such as puttygen, plink and psftp will be built.
+
+EOF
+fi
+
AH_BOTTOM([
/* Convert autoconf definitions to ones that PuTTY wants. */