view rogue4/configure.ac @ 88:07c4d4883ef2

rogue3: begin porting to autoconf. Rogue V3 can now be built with './configure && make'. This is preliminary: 'make install' does not work yet.
author John "Elwin" Edwards
date Sat, 24 Aug 2013 13:36:13 -0700
parents ae4f413fe76c
children 8f7c082fde46
line wrap: on
line source

#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.56)
AC_INIT([Rogue],[5.2.2], [yendor@rogueforge.net])
AC_CONFIG_SRCDIR([armor.c])
AC_CONFIG_HEADERS([config.h])
# May not be needed for the documentation
AC_CONFIG_FILES([Makefile rogue.6 rogue.me])

# Checks for programs.
AC_PROG_CC
# Checks for libraries.
MP_WITH_CURSES
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h sys/utsname.h pwd.h fcntl.h limits.h nlist.h stdlib.h string.h sys/ioctl.h termios.h unistd.h utmp.h term.h ncurses/term.h process.h])
# WARN: the sources often don't include the headers when needed.  That is one
# reason why adding "-Wall" to CFLAGS produces 1246 lines of messages.

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
# Checks for library functions.
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_LSTAT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([erasechar killchar alarm getpass memset setenv strchr nlist _spawnl spawnl getpwuid loadav getloadavg strerror setgid setuid getuid getgid])
AC_PROG_INSTALL

# Programs to process the documentation
AC_CHECK_PROG([NROFF], [nroff], [nroff],)
AC_CHECK_PROG([GROFF], [groff], [groff],)
AC_CHECK_PROG([COLCRT], [colcrt], [colcrt],)
AC_CHECK_PROG([TBL], [tbl], [tbl],)
AC_CHECK_PROG([SED], [sed], [sed],)

AC_ARG_WITH(program-name, AC_HELP_STRING([--with-program-name=NAME],[alternate executable name]),[progname="$withval" ], [progname="rogue4"] )
PROGRAM=$progname
AC_SUBST(PROGRAM)

AC_ARG_ENABLE(setgid, AC_HELP_STRING([--enable-setgid=NAME],[install executable as setgid with group ownership of NAME @<:@default=no@:>@])],[],[])
AC_MSG_CHECKING([if using setgid execute bit])
if test "x$enable_setgid" = "xno" ; then
GROUPOWNER=
elif test "x$enable_setgid" = "xyes" ; then
GROUPOWNER=games
elif test "x$enable_setgid" = "x" ; then
GROUPOWNER=
else
GROUPOWNER=$enable_setgid
fi

if test "x$GROUPOWNER" != "x" ; then
AC_DEFINE_UNQUOTED([GROUPOWNER],[$GROUPOWNER], [Define to group owner of setgid executable])
AC_MSG_RESULT([$GROUPOWNER])
else
AC_MSG_RESULT([no])
fi

AC_SUBST(GROUPOWNER)

AC_ARG_ENABLE([scorefile],[AC_HELP_STRING([--enable-scorefile=SCOREFILE], [enable scoreboard with given filename])],[],[])
AC_MSG_CHECKING([for scoreboard file])
if test "x$enable_scorefile" = "xno" ; then
SCOREFILE=
elif test "x$enable_scorefile" = "xyes" ;  then
SCOREFILE=$progname.scr
elif test "x$enable_scorefile" = "x" ; then
SCOREFILE=$progname.scr
else
SCOREFILE=$enable_scorefile
fi

if test "x$SCOREFILE" != "x" ; then
AC_DEFINE_UNQUOTED([SCOREFILE], ["$SCOREFILE"], [Define to file to use for scoreboard])
AC_MSG_RESULT([$SCOREFILE])
else
AC_MSG_RESULT([disabled])
fi

AC_SUBST(SCOREFILE)

AC_ARG_ENABLE([logfile],[AC_HELP_STRING([--enable-logfile=LOGFILE], [enable logfile with given filename])],[],[])
AC_MSG_CHECKING([for log file])
if test "x$enable_logfile" = "xno" ; then
LOGFILE=
elif test "x$enable_logfile" = "xyes" ;  then
LOGFILE=$progname.log
elif test "x$enable_logfile" = "x" ; then
LOGFILE=$progname.log
else
LOGFILE=$enable_logfile
fi

if test "x$LOGFILE" != "x" ; then
AC_DEFINE_UNQUOTED([LOGFILE], ["$LOGFILE"], [Define to file to use for log])
AC_MSG_RESULT([$LOGFILE])
else
AC_MSG_RESULT([disabled])
fi

AC_SUBST(LOGFILE)

AC_ARG_ENABLE([lockfile],[AC_HELP_STRING([--enable-lockfile=LOCKFILE], [enable scoreboard lockfile with given filename])],[],[])
AC_MSG_CHECKING([for scoreboard lockfile file])
if test "x$enable_lockfile" = "xno" ; then
LOCKFILE=
elif test "x$enable_lockfile" = "xyes" ; then
LOCKFILE=$progname.lck
elif test "x$enable_lockfile" = "x" ; then
LOCKFILE=$progname.lck
else
LOCKFILE=$enable_lockfile
fi

if test "x$LOCKFILE" != "x" ; then
AC_DEFINE_UNQUOTED([LOCKFILE], ["$LOCKFILE"], [Define to file to use for scoreboard lockfile])
AC_MSG_RESULT([$LOCKFILE])
else
AC_MSG_RESULT([disabled])
fi

AC_SUBST(LOCKFILE)

AC_ARG_ENABLE([savedir],[AC_HELP_STRING([--enable-savedir=SAVEDIR], [enable systemwide location for saved games])],[],[enable_savedir="no"])
AC_MSG_CHECKING([for save directory])
if test "x$enable_savedir" = "xno" ; then
SAVEDIR=
elif test "x$enable_savedir" = "xyes" -o "x$enable_savedir" = "x"; then
  if text "x$GROUPOWNER" != "x"; then
  SAVEDIR="/var/local/games/roguelike/${progname}save/"
  else
  SAVEDIR="$progname/"
  fi
else
SAVEDIR="$enable_savedir"
fi

if test "x$SAVEDIR" != "x" ; then
AC_DEFINE_UNQUOTED([SAVEDIR], ["$SAVEDIR"], [Define to systemwide directory for storing saved games])
AC_MSG_RESULT([$SAVEDIR])
else
AC_MSG_RESULT([disabled])
fi

AC_SUBST(SAVEDIR)

AC_ARG_ENABLE([destdir],[AC_HELP_STRING([--enable-destdir=DESTDIR], [chroot to install into])],[],[])
AC_MSG_CHECKING([for chrooted install])
if test "x$enable_destdir" = "xno" ; then
DESTDIR=
elif test "x$enable_destdir" = "xyes" ; then
DESTDIR=
elif test "x$enable_destdir" = "x" ; then
DESTDIR=
else
DESTDIR=$enable_destdir
fi

if test "x$DESTDIR" != "x" ; then
AC_MSG_RESULT([$DESTDIR])
else
AC_MSG_RESULT([disabled])
fi

AC_SUBST(DESTDIR)

AC_ARG_ENABLE([wizardmode],[AC_HELP_STRING([--enable-wizardmode], [enable availability of wizard mode @<:@default=no@:>@])],[],[])
AC_MSG_CHECKING([if wizard mode is enabled])
if test "x$enable_wizardmode" = "xno" ; then
AC_MSG_RESULT([no])
elif test "x$enable_wizardmode" = "x" ; then
AC_MSG_RESULT([no])
else
AC_DEFINE([WIZARD], [], [Define to include wizard mode])
if test "x$enable_wizardmode" != "xyes" ; then
AC_DEFINE_UNQUOTED([PASSWD],["$enable_wizardmode"], [Define crypt(3) wizard mode password])
fi
AC_MSG_RESULT([yes])
fi

AC_ARG_ENABLE([checktime],[AC_HELP_STRING([--enable-checktime], [enable checktime @<:@default=no@:>@])],[],[])
AC_MSG_CHECKING([if checktime is enabled])
if test "x$enable_checktime" = "xyes" ; then
AC_DEFINE([CHECKTIME], [1], [Define if checktime feature should be enabled])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi

AC_ARG_ENABLE([maxload],[AC_HELP_STRING([--enable-maxload], [enable maxload @<:@default=no@:>@])],[],[])
AC_MSG_CHECKING([runtime execution limit (maximum system load average)])
if test "x$enable_maxload" = "xyes" ; then
AC_DEFINE([MAXLOAD], [100], [Define if maxload feature should be enabled])
AC_MSG_RESULT([100])
elif test "x$enable_maxload" = "x" ; then
AC_MSG_RESULT([unlimited])
elif test "x$enable_maxload" = "xno" ; then
AC_MSG_RESULT([unlimited])
else
AC_DEFINE_UNQUOTED([MAXLOAD], [$enable_maxload], [Define if maxload feature should be enabled])
AC_MSG_RESULT([$enable_maxload])
fi

AC_ARG_ENABLE([maxusers],[AC_HELP_STRING([--enable-maxusers], [enable maxuser @<:@default=no@:>@])],[],[])
AC_MSG_CHECKING([runtime execution limit (maximum online system users)])
if test "x$enable_maxusers" = "xyes" ; then
AC_DEFINE([MAXUSERS], [100], [Define if maxusers feature should be enabled])
AC_MSG_RESULT([100])
elif test "x$enable_maxusers" = "x" ; then
AC_MSG_RESULT([unlimited])
elif test "x$enable_maxload" = "xno" ; then 
AC_MSG_RESULT([unlimited])
else
AC_DEFINE_UNQUOTED([MAXLOAD], [$enable_maxusers], [Define if maxusers feature should be enabled])
AC_MSG_RESULT([$enable_maxusers])
fi

AC_MSG_CHECKING([whether to docdir is defined])
if test "x$docdir" = "x" ; then
AC_MSG_RESULT([docdir undefined])
docdir=\${datadir}/doc/\${PACKAGE_TARNAME}
AC_SUBST(docdir)
else
AC_MSG_RESULT([docdir defined])
fi

AC_OUTPUT