-- William Pursell
>From d33fc82bf17ee7723caa70c74a4f7b3dc1d489d9 Mon Sep 17 00:00:00 2001 From: William Pursell <[EMAIL PROTECTED]> Date: Mon, 6 Oct 2008 20:25:58 +0100 Subject: [PATCH] Finished adding configure.ac
--- src/configure.ac | 297 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 297 insertions(+), 0 deletions(-) diff --git a/src/configure.ac b/src/configure.ac index ed0c10e..fef1130 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -998,3 +998,300 @@ loadnum=3 ]) if test -n "$load" ; then AC_DEFINE(LOADAV) fi +if test -n "$loadtype" ; then AC_DEFINE_UNQUOTED(LOADAV_TYPE,$loadtype) fi +if test -n "$loadnum" ; then AC_DEFINE_UNQUOTED(LOADAV_NUM,$loadnum) fi +if test -n "$loadscale" ; then AC_DEFINE_UNQUOTED(LOADAV_SCALE,$loadscale) fi + +dnl +dnl **** signal handling **** +dnl +if test -n "$posix" ; then + +dnl POSIX has reliable signals with void return type. +AC_MSG_NOTICE(assuming posix signal definition) +AC_DEFINE(SIGVOID) + +else + +AC_CHECKING(return type of signal handlers) +AC_TRY_COMPILE( +[#include <sys/types.h> +#include <signal.h> +#ifdef signal +#undef signal +#endif +extern void (*signal ()) ();], [int i;], AC_DEFINE(SIGVOID)) +AC_CHECKING(sigset) +AC_TRY_LINK([ +#include <sys/types.h> +#include <signal.h> +],[ +#ifdef SIGVOID +sigset(0, (void (*)())0); +#else +sigset(0, (int (*)())0); +#endif +], AC_DEFINE(USESIGSET)) +AC_CHECKING(signal implementation) +AC_TRY_RUN([ +#include <sys/types.h> +#include <signal.h> + +#ifndef SIGCLD +#define SIGCLD SIGCHLD +#endif +#ifdef USESIGSET +#define signal sigset +#endif + +int got; + +#ifdef SIGVOID +void +#endif +hand() +{ + got++; +} + +main() +{ + /* on hpux we use sigvec to get bsd signals */ +#ifdef __hpux + (void)signal(SIGCLD, hand); + kill(getpid(), SIGCLD); + kill(getpid(), SIGCLD); + if (got < 2) + exit(1); +#endif + exit(0); +} +],,AC_DEFINE(SYSVSIGS)) + +fi + +dnl +dnl **** libraries **** +dnl + +AC_CHECKING(for crypt and sec libraries) +test -f /lib/libcrypt_d.a || test -f /usr/lib/libcrypt_d.a && LIBS="$LIBS -lcrypt_d" +oldlibs="$LIBS" +LIBS="$LIBS -lcrypt" +AC_CHECKING(crypt) +AC_TRY_LINK(,,,LIBS="$oldlibs") +test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec" +test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow" +oldlibs="$LIBS" +LIBS="$LIBS -lsun" +AC_CHECKING(IRIX sun library) +AC_TRY_LINK(,,,LIBS="$oldlibs") + +AC_CHECKING(syslog) +AC_TRY_LINK(,[closelog();], , [oldlibs="$LIBS" +LIBS="$LIBS -lbsd" +AC_CHECKING(syslog in libbsd.a) +AC_TRY_LINK(, [closelog();], AC_MSG_NOTICE(- found.), [LIBS="$oldlibs" +AC_MSG_NOTICE(- bad news: syslog missing.) + AC_DEFINE(NOSYSLOG)])]) + +AC_EGREP_CPP(yes, +[#ifdef M_UNIX + yes; +#endif +], LIBS="$LIBS -lsocket -lcrypt_i") + +dnl +dnl **** misc things **** +dnl +AC_CHECKING(wait union) +AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/wait.h> +],[ + union wait x; + int y; +#ifdef WEXITSTATUS + y = WEXITSTATUS(x); +#endif +],AC_DEFINE(BSDWAIT)) + +if test -z "$butterfly"; then +AC_CHECKING(for termio or termios) +AC_TRY_CPP([#include <termio.h>], AC_DEFINE(TERMIO), +if test -n "$posix"; then +AC_TRY_CPP([#include <termios.h>], AC_DEFINE(TERMIO)) +fi +) +fi + +dnl AC_CHECK_HEADER(shadow.h, AC_DEFINE(SHADOWPW)) +AC_CHECKING(getspnam) +AC_TRY_LINK([#include <shadow.h>], [getspnam("x");],AC_DEFINE(SHADOWPW)) + +AC_CHECKING(getttyent) +AC_TRY_LINK(,[getttyent();], AC_DEFINE(GETTTYENT)) + +AC_CHECKING(fdwalk) +AC_TRY_LINK([#include <stdlib.h>], [fdwalk(NULL, NULL);],AC_DEFINE(HAVE_FDWALK)) + +AC_CHECKING(whether memcpy/memmove/bcopy handles overlapping arguments) +AC_TRY_RUN([ +main() { + char buf[10]; + strcpy(buf, "abcdefghi"); + bcopy(buf, buf + 2, 3); + if (strncmp(buf, "ababcf", 6)) + exit(1); + strcpy(buf, "abcdefghi"); + bcopy(buf + 2, buf, 3); + if (strncmp(buf, "cdedef", 6)) + exit(1); + exit(0); /* libc version works properly. */ +}], AC_DEFINE(USEBCOPY)) + +AC_TRY_RUN([ +#define bcopy(s,d,l) memmove(d,s,l) +main() { + char buf[10]; + strcpy(buf, "abcdefghi"); + bcopy(buf, buf + 2, 3); + if (strncmp(buf, "ababcf", 6)) + exit(1); + strcpy(buf, "abcdefghi"); + bcopy(buf + 2, buf, 3); + if (strncmp(buf, "cdedef", 6)) + exit(1); + exit(0); /* libc version works properly. */ +}], AC_DEFINE(USEMEMMOVE)) + + +AC_TRY_RUN([ +#define bcopy(s,d,l) memcpy(d,s,l) +main() { + char buf[10]; + strcpy(buf, "abcdefghi"); + bcopy(buf, buf + 2, 3); + if (strncmp(buf, "ababcf", 6)) + exit(1); + strcpy(buf, "abcdefghi"); + bcopy(buf + 2, buf, 3); + if (strncmp(buf, "cdedef", 6)) + exit(1); + exit(0); /* libc version works properly. */ +}], AC_DEFINE(USEMEMCPY)) + +AC_MSG_CHECKING(long file names) +(echo 1 > /tmp/conftest9012345) 2>/dev/null +(echo 2 > /tmp/conftest9012346) 2>/dev/null +val=`cat /tmp/conftest9012345 2>/dev/null` +if test -f /tmp/conftest9012345 && test "$val" = 1; then +AC_MSG_RESULT(yes) +else +AC_MSG_RESULT(no) +AC_DEFINE(NAME_MAX, 14) +fi +rm -f /tmp/conftest* + +AC_MSG_CHECKING(for vsprintf) +AC_TRY_LINK(,[vsprintf(0,0,0);], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS), AC_MSG_RESULT(no)) + +AC_HEADER_DIRENT + +AC_MSG_CHECKING(for setenv) +if test -z "$ac_setenv_args"; then + AC_TRY_COMPILE( + [#include <stdlib.h>], + [ + setenv((char *) 0, (char *) 0, 0); + ], ac_setenv_args=3) +fi +if test -z "$ac_setenv_args"; then + AC_TRY_COMPILE( + [#include <stdlib.h>], + [ + setenv((char *) 0, (char *) 0); + ], ac_setenv_args=2) +fi +if test -n "$ac_setenv_args"; then + AC_DEFINE(USESETENV) + if test "$ac_setenv_args" = 3; then + AC_DEFINE(HAVE_SETENV_3) + elif test "$ac_setenv_args" = 2; then + AC_DEFINE(HAVE_SETENV_2) + fi +else + AC_MSG_RESULT(no) + AC_MSG_CHECKING(for putenv) + AC_TRY_LINK(,[putenv((char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes) , AC_MSG_RESULT(no);AC_DEFINE(NEEDPUTENV)) +fi +AC_MSG_CHECKING([for nl_langinfo(CODESET)]) +AC_TRY_LINK([ +#include <langinfo.h> +],[nl_langinfo(CODESET);], AC_MSG_RESULT(yes);AC_DEFINE(HAVE_NL_LANGINFO), AC_MSG_RESULT(no)) + +AC_SEARCH_LIBS(gethostname, nsl) + +AC_CHECK_FUNCS(rename fchmod fchown strerror lstat _exit utimes vsnprintf getcwd setlocale strftime) + +AC_ARG_ENABLE(pam, [ --enable-pam enable PAM support]) +if test "$enable_pam" = "yes"; then + AC_MSG_CHECKING(for PAM support) + oldlibs="$LIBS" + LIBS="$LIBS -lpam" + AC_TRY_LINK([#include <security/pam_appl.h>], [ + pam_start(0, 0, 0, 0); + pam_authenticate(0, 0); + pam_end(0,0); + ], AC_MSG_RESULT(yes);AC_DEFINE(USE_PAM), + AC_MSG_RESULT(no);LIBS="$oldlibs") +fi + +AC_ARG_ENABLE(use_locale, [ --enable-locale use localized month/day names]) +if test "$enable_use_locale" = "yes"; then + AC_DEFINE(USE_LOCALE) +fi +AC_ARG_ENABLE(telnet, [ --enable-telnet enable builtin telnet]) +if test "$enable_telnet" = "yes"; then + AC_DEFINE(BUILTIN_TELNET) +fi +AC_ARG_ENABLE(colors256, [ --enable-colors256 enable support for 256 colors]) +if test "$enable_colors256" = "yes"; then + AC_DEFINE(COLORS256) +fi +AC_ARG_ENABLE(rxvt_osc, [ --enable-rxvt_osc enable support for rxvt OSC codes]) +if test "$enable_rxvt_osc" = "yes"; then + AC_DEFINE(RXVT_OSC) +fi + +dnl +dnl **** the end **** +dnl +if test -z "$old_CFLAGS"; then + if test "x$CFLAGS" = "x-g"; then + CFLAGS="-O" + fi +fi +dnl Ptx bug workaround -- insert -lc after -ltermcap +test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq" + +AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.)) + +AC_CONFIG_FILES([ Makefile src/Makefile src/doc/Makefile]) +AC_OUTPUT + +for i in term.sh tty.sh comm.sh osdef.sh; do + chmod +x $srcdir/$i; +done + +echo "" +if test -z "$AWK"; then +echo "!!! Since you have no awk you must copy the files 'comm.h.dist'" +echo "!!! and 'term.h.dist' to 'comm.h' and 'term.h'." +echo "!!! Do _not_ change the user configuration section in config.h!" +echo "Please check the pathnames in the Makefile." +else +echo "Now please check the pathnames in the Makefile and in the user" +echo "configuration section in config.h." +fi +echo "Then type 'make' to make screen. Good luck." +echo "" -- 1.6.0.2.GIT