view configure.in @ 500:614a3177b15c noffle tip

Add mail-from option. Some modern mail systems will try and ensure the sender email is a legitimate address. Which will fail if there isn't such an address.
author Jim Hague <jim.hague@acm.org>
date Wed, 14 Aug 2013 12:04:39 +0100
parents d33568bb18ab
children
line wrap: on
line source

dnl ---------------------------------------------------------------------------
dnl Process this file with autoconf to produce a configure script.
dnl ---------------------------------------------------------------------------

AC_INIT(src/noffle.c)
AC_PREREQ(2.13)

PACKAGE=noffle
VERSION=1.2.0rc1

AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE($PACKAGE,$VERSION)

dnl AM_MAINTAINER_MODE

AC_DEFINE(_GNU_SOURCE)

AC_LANG_C


dnl ---------------------------------------------------------------------------
dnl Checks for programs.
dnl ---------------------------------------------------------------------------

AC_PROG_CC
AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
AC_PROG_MAKE_SET

AC_PATH_PROG(SENDMAILPROG, sendmail, 'notfound',
             /usr/sbin:/usr/lib:$PATH)
if test "x$SENDMAILPROG" = "xnotfound"; then
 AC_MSG_ERROR(sendmail program not found in /usr/lib:/usr/sbin:$PATH .)
fi

dnl ---------------------------------------------------------------------------
dnl System checks.
dnl ---------------------------------------------------------------------------

AC_AIX
AC_ISC_POSIX
AC_MINIX


dnl ---------------------------------------------------------------------------
dnl Checks for libraries.
dnl ---------------------------------------------------------------------------

# Whenever both -lsocket and -lnsl are needed, it seems to be always the
# case that gethostbyname requires -lnsl.  So, check -lnsl first, for it
# to be in LIBS before the setsockopt checks are performed.  *However*,
# on SINIX-N 5.43, this is false, and gethostent seems to be a better
# candidate. So, let's use it below instead of gethostbyname, and see.

# [ This is ripped from GNU tar. ]

AC_CHECK_FUNC(gethostent)
if test $ac_cv_func_gethostent = no; then
  AC_CHECK_LIB(nsl, gethostent)
fi
AC_CHECK_FUNC(setsockopt)
if test $ac_cv_func_setsockopt = no; then
  AC_CHECK_LIB(socket, setsockopt)
fi

AC_ARG_WITH(gdbm-include,
[  --with-gdbm-include=DIR GDBM header files are in DIR],
	    [CPPFLAGS="$CFLAGS -I$withval"]
	   )
AC_ARG_WITH(gdbm-libdir,
[  --with-gdbm-libdir=DIR  GDBM library files are in DIR],
	    [LIBS="$LIBS -L$withval"]
	   )
AC_CHECK_LIB(gdbm, gdbm_open,
	     AC_CHECK_HEADER(gdbm.h,,AC_MSG_ERROR([cannot find gdbm.h])),
	     AC_MSG_ERROR([cannot find libgdbm]))

dnl ---------------------------------------------------------------------------
dnl Checks for header files.
dnl ---------------------------------------------------------------------------

AC_HEADER_STDC
AC_HEADER_DIRENT
AC_CHECK_HEADERS(syslog.h sys/resource.h sys/utsname.h)
AC_CHECK_HEADERS(fnmatch.h errno.h getopt.h time.h sys/time.h signal.h)
AC_CHECK_HEADERS(netdb.h sys/socket.h fcntl.h limits.h unistd.h)
AC_CHECK_HEADERS(sys/types.h regex.h pwd.h)


dnl ---------------------------------------------------------------------------
dnl Checks for typedefs, structures, and compiler characteristics.
dnl ---------------------------------------------------------------------------

AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM

AC_CACHE_CHECK(socklen_t, noffle_cv_type_socklen_t,
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
], [ socklen_t s; ],
noffle_cv_type_socklen_t=yes, noffle_cv_type_socklen_t=no)
)

if test "x$noffle_cv_type_socklen_t" = "xno"
then
 AC_DEFINE_UNQUOTED(socklen_t, unsigned int)
fi


dnl ---------------------------------------------------------------------------
dnl Checks for library functions.
dnl ---------------------------------------------------------------------------

AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_FUNC_FNMATCH
AC_CHECK_FUNCS(fdopen mkdir select socket)
AC_CHECK_FUNCS(gethostname uname)
AC_CHECK_FUNCS(snprintf vsnprintf __vsnprintf __snprintf)
AC_CHECK_FUNCS(strerror strstr)
AC_CHECK_FUNCS(mktime timegm)


dnl ---------------------------------------------------------------------------
dnl Checks for system services.
dnl ---------------------------------------------------------------------------


dnl ---------------------------------------------------------------------------
dnl Authentication options
dnl ---------------------------------------------------------------------------

AC_ARG_ENABLE(auth,
[  --enable-auth=[no/file/pam] enable authentication [default=no]], ,
enable_auth=no)

if test "x$enable_auth" = "xfile"; then
  AC_DEFINE(USE_AUTH)
fi
if test "x$enable_auth" = "xpam"; then
  AC_SUBST(LIBPAM)
  AC_CHECK_LIB(pam, pam_start,
	AC_CHECK_HEADER(security/pam_appl.h,,
		AC_MSG_ERROR([cannot find security/pam_appl.h])),
	AC_MSG_ERROR([cannot find libpam]))
  LIBPAM="-lpam"
  AC_DEFINE(USE_PAM)
  AC_DEFINE(USE_AUTH)
fi

dnl check where to put the users file
AC_MSG_CHECKING(usersfile)
AC_ARG_WITH(usersfile,
  [  --with-usersfile=FILE  users file [/etc/noffle.users]],
  if echo "$withval" | egrep >/dev/null -v '^/' ; then
    AC_MSG_ERROR(you must give an absolute path)
  fi
  withval=`echo "$withval" | sed 'sx/*$xx;'`,
  withval="/etc/$PACKAGE.users"
)
USERSFILE=$withval
AC_MSG_RESULT($USERSFILE)
AC_DEFINE_UNQUOTED(USERSFILE,"$USERSFILE")
AC_SUBST(USERSFILE)

dnl ---------------------------------------------------------------------------
dnl Handle user-specified configure options
dnl ---------------------------------------------------------------------------

AC_ARG_ENABLE(debug,
[  --enable-debug=[no/yes] build with debugging [default=no]], ,
enable_debug=no)

if test "x$enable_debug" = "xyes"; then
  if test "x$GCC" = "xyes"; then
    CFLAGS="$CFLAGS \
      -Wall -pedantic -W -Wshadow -Wpointer-arith \
      -Wcast-align -Wwrite-strings \
      -Wstrict-prototypes -Wmissing-prototypes \
      -Wmissing-declarations -Wnested-externs -Winline "
    CPPFLAGS="$CPPFLAGS \
      -D__USE_BSD -D__USE_XOPEN_EXTENDED -D__USE_POSIX -DDEBUG"
  else
      CPPFLAGS="$CPPFLAGS -DDEBUG"
  fi
fi


# [ This is adapted from mutt. ]
AC_ARG_WITH(docdir,
[  --with-docdir=DIR       other documentation [PREFIX/share/doc/noffle]],
[noffle_cv_docdir=$withval],
[ AC_CACHE_CHECK(other documentation directory, noffle_cv_docdir,
  [if test x$prefix = xNONE; then
    noffle_cv_prefix=$ac_default_prefix
   else
    noffle_cv_prefix=$prefix
   fi
   noffle_cv_docdir=$noffle_cv_prefix/share/doc/noffle
  ])
])

dnl check where to put the spooldir - taken from leafnode 2.0beta.
AC_MSG_CHECKING(spooldir)
AC_ARG_WITH(spooldir,
[  --with-spooldir=DIR     news spool directory [/var/spool/noffle]],
  if echo "$withval" | egrep >/dev/null -v '^/' ; then
    AC_MSG_ERROR(you must give an absolute path)
  fi
  withval=`echo "$withval" | sed 'sx/*$xx;'`
,
  withval="/var/spool/$PACKAGE"
)
SPOOLDIR=$withval
AC_MSG_RESULT($SPOOLDIR)
AC_DEFINE_UNQUOTED(SPOOLDIR, "$SPOOLDIR")
AC_SUBST(SPOOLDIR)

dnl check where to put the config file
AC_MSG_CHECKING(configfile)
AC_ARG_WITH(configfile,
[  --with-configfile=FILE  configuration file [/etc/noffle.conf]],
  if echo "$withval" | egrep >/dev/null -v '^/' ; then
    AC_MSG_ERROR(you must give an absolute path)
  fi
  withval=`echo "$withval" | sed 'sx/*$xx;'`
,
  withval="/etc/$PACKAGE.conf"
)
CONFIGFILE=$withval
AC_MSG_RESULT($CONFIGFILE)
AC_DEFINE_UNQUOTED(CONFIGFILE,"$CONFIGFILE")
AC_SUBST(CONFIGFILE)

dnl ---------------------------------------------------------------------------
dnl Unquoted defines and substituted variables.
dnl ---------------------------------------------------------------------------

dnl NOFFLE_EXPAND_DIR(VARNAME, DIR)
dnl expands occurrences of ${prefix} and ${exec_prefix} in the given DIR,
dnl and assigns the resulting string to VARNAME
dnl example: NOFFLE_EXPAND_DIR(LOCALEDIR, "$datadir/locale")
dnl eg, then: AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR")
dnl by Alexandre Oliva
dnl from http://www.cygnus.com/ml/automake/1998-Aug/0040.html
AC_DEFUN(NOFFLE_EXPAND_DIR, [
 $1=$2
 $1=`(
  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
  test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
  eval echo \""[$]$1"\"
 )`
])

DOCDIR=$noffle_cv_docdir
AC_SUBST(DOCDIR)

AC_DEFINE_UNQUOTED(SENDMAILPROG, "$SENDMAILPROG")

dnl ---------------------------------------------------------------------------
dnl Output files.
dnl ---------------------------------------------------------------------------

AC_OUTPUT(Makefile src/Makefile docs/Makefile packages/Makefile packages/redhat/Makefile)