screen-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[screen-devel] Automake patch 2


From: William Pursell
Subject: [screen-devel] Automake patch 2
Date: Mon, 06 Oct 2008 20:54:37 +0100
User-agent: Thunderbird 2.0.0.17 (Macintosh/20080914)


--
William Pursell
>From 9d1674e64f491038bbbf721c42cb01246edb4fb7 Mon Sep 17 00:00:00 2001
From: William Pursell <address@hidden>
Date: Mon, 6 Oct 2008 20:21:57 +0100
Subject: [PATCH] Adding initial portion of configure.ac

This is the first third of the file, which is basically
the old configure.in with some modifications.  Since
I intend to submit these patch sets to the mailing list,
and the last time I checked, there was a 10k limit
to the list, I can't submit a single patchset that
adds this entire file.  So I'm doing it in pieces.
---
 src/configure.ac |  400 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 400 insertions(+), 0 deletions(-)
 create mode 100644 src/configure.ac

diff --git a/src/configure.ac b/src/configure.ac
new file mode 100644
index 0000000..0001c39
--- /dev/null
+++ b/src/configure.ac
@@ -0,0 +1,400 @@
+dnl Process this file with autoconf to produce a configure script.
+dnl
+dnl $Id$ FAU
+dnl
+dnl Many thanks to David MacKenzie for writing autoconf and
+dnl providing a sample configure.in file for screen.
+dnl
+
+AC_INIT([screen], [4.1.0], address@hidden)
+AC_CONFIG_SRCDIR([screen.c])
+AC_CONFIG_HEADER([config.h])
+AM_INIT_AUTOMAKE([-Wall -Werror foreign])
+
+AC_DEFINE([ORIGIN], ["FAU"], [origin])
+AC_DEFINE([REV], [4], [revision])
+AC_DEFINE([VERS], [1], [version])
+AC_DEFINE([PATCHLEVEL], [0], [patchlevel])
+AC_DEFINE([DATE], ["2-May-06"], [date])
+AC_DEFINE([STATE], ["devel"], [state])
+
+dnl
+dnl Define some useful macros
+dnl
+AC_DEFUN([AC_PROGRAM_SOURCE],
+[AC_REQUIRE([AC_PROG_CPP])AC_PROVIDE([$0])cat > conftest.c <<EOF
+#include "confdefs.h"
+[$1]
+_CUT_HERE_
+[$2]
+EOF
+eval "$ac_cpp conftest.c 2>&5 | sed -e '1,/_CUT_HERE_/d' -e 's/ //g' > 
conftest.out"
+. ./conftest.out
+rm -f conftest*
+])dnl
+dnl
+
+AC_MSG_NOTICE([this is screen version $PACKAGE_VERSION])
+AC_PREFIX_PROGRAM([screen])
+AC_PREFIX_PROGRAM([gzip])
+
+old_CFLAGS="$CFLAGS"
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_GCC_TRADITIONAL
+AC_ISC_POSIX
+AC_PROG_AWK
+
+AC_PROG_INSTALL
+
+if test -f etc/toolcheck; then
+AC_CHECKING([for buggy tools])
+sh etc/toolcheck 1>&AC_FD_MSG
+fi
+
+
+dnl SOCKDIR
+AC_MSG_CHECKING([if a system-wide socket dir should be used]) 
+AC_ARG_ENABLE(socket-dir,
+    [  --disable-socket-dir    disable system wide socket-dir and use 
~/.screen instead],
+    [
+       AC_MSG_RESULT(no.  ~/.screen will be used instead.)
+    ],
+    [
+       AC_MSG_RESULT(yes)
+       AC_MSG_CHECKING(for the socket dir)
+       SOCKDIR="(eff_uid ? \"/tmp/uscreens\" : \"/tmp/screens\")"
+       AC_ARG_WITH(socket-dir, [  --with-socket-dir=path  where to put the 
per-user sockets], [ 
+         case "${withval}" in
+           *\"*) SOCKDIR="${withval}" ;;
+           *) SOCKDIR="\"${withval}\"" ;;
+         esac
+        ])
+       AC_MSG_RESULT(${SOCKDIR})
+       AC_DEFINE_UNQUOTED(SOCKDIR, $SOCKDIR)
+    ]
+)
+
+
+dnl
+dnl    ****  special unix variants  ****
+dnl
+if test -n "$ISC"; then
+  AC_DEFINE(ISC) LIBS="$LIBS -linet"
+fi
+
+dnl AC_CHECKING(for OSF1)
+dnl if test -f /bin/uname ; then
+dnl if test `/bin/uname` = OSF1 || test -f /osf_boot; then
+dnl AC_DEFINE(OSF1)    # this disables MIPS again....
+dnl fi
+dnl fi
+
+if test -f /sysV68 ; then
+AC_DEFINE(sysV68)
+fi
+
+AC_CHECKING(for MIPS)
+if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f 
/usr/lib/cmplrs/cc/libmld.a; then
+oldlibs="$LIBS"
+test -f /bin/mx || LIBS="$LIBS -lmld" # for nlist. But not on alpha.
+dnl address@hidden: "... for one thing, it doubles the size of the executable"
+AC_CHECKING(mld library)
+AC_TRY_LINK(,,,LIBS="$oldlibs")
+dnl
+dnl
+if test -r /dev/ptc; then
+AC_DEFINE(MIPS)
+AC_CHECKING(wait3)
+AC_TRY_LINK(,[wait3();], ,
+AC_CHECKING(wait2)
+AC_TRY_LINK(,[wait2();],
+dnl John Rouillard (address@hidden):
+dnl need -I/usr/include/bsd in RISCOS otherwise sockets are broken, no
+dnl job control etc.
+dnl Detect RISCOS if wait2 is present, but not wait3.
+AC_DEFINE(USE_WAIT2) LIBS="$LIBS -lbsd" ; CC="$CC -I/usr/include/bsd"
+))
+fi
+fi
+
+
+AC_CHECKING(for Ultrix)
+AC_EGREP_CPP(yes,
+[#if defined(ultrix) || defined(__ultrix)
+   yes;
+#endif
+], ULTRIX=1)
+
+if test -f /usr/lib/libpyr.a ; then
+oldlibs="$LIBS"
+LIBS="$LIBS -lpyr"
+AC_CHECKING(Pyramid OSX)
+AC_TRY_LINK(,[open_controlling_pty("")], AC_DEFINE(OSX), LIBS="$oldlibs")
+fi
+
+dnl address@hidden (Kaveh R. Ghazi):
+dnl BBN butterfly is not POSIX, but a MACH BSD system.
+dnl Do not define POSIX and TERMIO.
+AC_CHECKING(for butterfly)
+AC_EGREP_CPP(yes,
+[#if defined(butterfly)
+  yes;
+#endif
+], butterfly=1)
+
+if test -z "$butterfly"; then
+if test -n "$ULTRIX"; then
+  test -z "$GCC" && CC="$CC -YBSD"
+fi
+AC_CHECKING(for POSIX.1)
+AC_EGREP_CPP(yes,
+[#include <sys/types.h>
+#include <unistd.h>
+main () {
+#ifdef _POSIX_VERSION
+  yes;
+#endif
+], AC_MSG_NOTICE(- you have a POSIX system) 
+AC_DEFINE(POSIX) posix=1)
+fi
+
+AC_CHECKING(for System V)
+AC_TRY_COMPILE(
+[#include <sys/types.h>
+#include <signal.h>
+#include <fcntl.h>], [int x = SIGCHLD | FNDELAY;], , AC_DEFINE(SYSV))
+
+AC_CHECKING(for sequent/ptx)
+AC_EGREP_CPP(yes,
+[#ifdef _SEQUENT_
+  yes;
+#endif
+], LIBS="$LIBS -lsocket -linet";seqptx=1)
+
+oldlibs="$LIBS"
+LIBS="$LIBS -lelf"
+AC_CHECKING(SVR4)
+AC_TRY_LINK([#include <utmpx.h>
+],,
+[AC_CHECK_HEADER(dwarf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN),
+[AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN))])]
+,LIBS="$oldlibs")
+AC_CHECK_HEADERS([stropts.h])
+
+AC_CHECKING(for Solaris 2.x)
+AC_EGREP_CPP(yes,
+[#if defined(SVR4) && defined(sun)
+  yes
+#endif
+], LIBS="$LIBS -lsocket -lnsl -lkstat")
+
+dnl
+dnl    ****  typedefs ****
+dnl
+dnl (currently not used)
+dnl
+dnl AC_CHECKING(for pid_t)
+dnl AC_EGREP_CPP(pid_t,[#include <sys/types.h>
+dnl ],AC_DEFINE(PID_T_DEFINED))
+dnl
+dnl AC_CHECKING(for sig_t)
+dnl AC_EGREP_CPP(sig_t,[#include <sys/types.h>
+dnl #include <signal.h>
+dnl ],AC_DEFINE(SIG_T_DEFINED))
+dnl
+dnl AC_CHECKING(for uid_t)
+dnl AC_EGREP_CPP(uid_t,[#include <sys/types.h>
+dnl ],AC_DEFINE(UID_T_DEFINED))
+dnl
+
+dnl
+dnl   ****     Job control     ****
+dnl
+
+AC_CHECKING(BSD job jontrol)
+AC_TRY_LINK(
+[#include <sys/types.h>
+#include <sys/ioctl.h>
+], [
+#ifdef POSIX
+tcsetpgrp(0, 0);
+#else
+int x = TIOCSPGRP;
+#ifdef SYSV
+setpgrp();
+#else
+int y = TIOCNOTTY;
+#endif
+#endif
+], AC_MSG_NOTICE(- you have jobcontrol)
+ AC_DEFINE(BSDJOBS), AC_MSG_NOTICE(- you don't have jobcontrol))
+
+dnl
+dnl    ****  setresuid(), setreuid(), seteuid()  ****
+dnl
+AC_CHECKING(setresuid)
+AC_TRY_LINK(,[
+setresuid(0, 0, 0);
+], AC_DEFINE(HAVE_SETRESUID))
+AC_CHECKING(setreuid)
+AC_TRY_LINK(,[
+setreuid(0, 0);
+], AC_DEFINE(HAVE_SETREUID))
+dnl
+dnl seteuid() check:
+dnl   linux seteuid was broken before V1.1.11
+dnl   NeXT, AUX, ISC, and ultrix are still broken (no saved uid support)
+dnl   Solaris seteuid doesn't change the saved uid, bad for
+dnl     multiuser screen sessions
+AC_CHECKING(seteuid)
+AC_TRY_LINK(,[
+#if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX) || 
defined(ultrix) || (defined(sun) && defined(SVR4)) || defined(ISC) || 
defined(sony_news)
+seteuid_is_broken(0);
+#else
+seteuid(0);
+#endif
+], AC_DEFINE(HAVE_SETEUID))
+
+dnl
+dnl    ****  select()  ****
+dnl
+
+AC_CHECKING(select)
+AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],, 
+LIBS="$LIBS -lnet -lnsl"
+AC_CHECKING(select with $LIBS)
+AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],, 
+AC_MSG_ERROR(!!! no select - no screen))
+)
+dnl
+dnl    ****  FIFO tests  ****
+dnl
+
+AC_CHECKING(fifos)
+AC_TRY_RUN([
+/* For select - According to POSIX 1003.1-2001 */
+#include <sys/select.h>
+
+/* For select - According to earlier standards */
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#ifndef O_NONBLOCK
+#define O_NONBLOCK O_NDELAY
+#endif
+#ifndef S_IFIFO
+#define S_IFIFO 0010000
+#endif
+
+char *fin = "/tmp/conftest$$";
+
+main()
+{
+  struct stat stb;
+  fd_set f;
+
+  (void)alarm(5);
+  unlink(fin);
+#ifdef POSIX
+  if (mkfifo(fin, 0777))
+#else
+  if (mknod(fin, S_IFIFO|0777, 0))
+#endif
+    exit(1);
+  if (stat(fin, &stb) || (stb.st_mode & S_IFIFO) != S_IFIFO)
+    exit(1);
+  close(0);
+#ifdef __386BSD__
+  /*
+   * The next test fails under 386BSD, but screen works using fifos.
+   * Fifos in O_RDWR mode are only used for the BROKEN_PIPE case and for
+   * the select() configuration test.
+   */
+  exit(0);
+#endif
+  if (open(fin, O_RDONLY | O_NONBLOCK))
+    exit(1);
+  if (fork() == 0)
+    {
+      close(0);
+      if (open(fin, O_WRONLY | O_NONBLOCK))
+       exit(1);
+      close(0);
+      if (open(fin, O_WRONLY | O_NONBLOCK))
+       exit(1);
+      if (write(0, "TEST", 4) == -1)
+       exit(1);
+      exit(0);
+    }
+  FD_SET(0, &f);
+  if (select(1, &f, 0, 0, 0) == -1)
+    exit(1);
+  exit(0);
+}
+], AC_MSG_NOTICE(- your fifos are usable) 
+fifo=1,
+AC_MSG_NOTICE(- your fifos are not usable))
+rm -f /tmp/conftest*
+
+if test -n "$fifo"; then
+AC_CHECKING(for broken fifo implementation)
+AC_TRY_RUN([
+/* For select - According to POSIX 1003.1-2001 */
+#include <sys/select.h>
+
+/* For select - According to earlier standards */
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#ifndef O_NONBLOCK
+#define O_NONBLOCK O_NDELAY
+#endif
+#ifndef S_IFIFO
+#define S_IFIFO 0010000
+#endif
+
+char *fin = "/tmp/conftest$$";
+
+main()
+{
+  struct timeval tv;
+  fd_set f;
+
+#ifdef POSIX
+  if (mkfifo(fin, 0600))
+#else
+  if (mknod(fin, S_IFIFO|0600, 0))
+#endif
+    exit(1);
+  close(0);
+  if (open(fin, O_RDONLY|O_NONBLOCK))
+    exit(1);
+  FD_SET(0, &f);
+  tv.tv_sec = 1;
+  tv.tv_usec = 0;
+  if (select(1, &f, 0, 0, &tv))
+    exit(1);
+  exit(0);
+}
+], AC_MSG_NOTICE(- your implementation is ok), 
+AC_MSG_NOTICE(- you have a broken implementation)
+ AC_DEFINE(BROKEN_PIPE) fifobr=1)
+rm -f /tmp/conftest*
+fi
+
+dnl
+dnl    ****  SOCKET tests  ****
+dnl 
+dnl    may need        LIBS="$LIBS -lsocket"   here
+dnl
+
+AC_CHECKING(sockets)
-- 
1.6.0.2.GIT


reply via email to

[Prev in Thread] Current Thread [Next in Thread]