diff xrogue/configure.ac @ 156:3e1146666ae5

arogue7, xrogue: begin using autoconf. File locations can be customized via './configure'. 'make install' does not work yet. Options for wizard mode and load checks may not do what is intended. Fun fact: there's an enlightening epigraph in the introduction to the autoconf manual.
author John "Elwin" Edwards
date Thu, 04 Jun 2015 10:41:39 -0400
parents
children 5238b835d661
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xrogue/configure.ac	Thu Jun 04 10:41:39 2015 -0400
@@ -0,0 +1,140 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.56)
+AC_INIT([XRogue],[8.0.3], [yendor@rogueforge.net])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([Makefile])
+
+# Checks for programs.
+AC_PROG_CC
+# Checks for libraries.
+MP_WITH_CURSES
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([pwd.h errno.h fcntl.h limits.h stdlib.h string.h sys/ioctl.h sys/utsname.h termios.h unistd.h term.h ncurses/term.h process.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_TYPE_SIZE_T
+AC_STRUCT_TM
+# Checks for library functions.
+AC_FUNC_FORK
+AC_PROG_GCC_TRADITIONAL
+AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
+AC_TYPE_SIGNAL
+AC_CHECK_FUNCS([erasechar killchar alarm getpass memset setenv strchr _spawnl spawnl getpwuid loadav strerror setgid setuid getuid getgid])
+AC_PROG_INSTALL
+
+AC_ARG_WITH(program-name, AC_HELP_STRING([--with-program-name=NAME],[alternate executable name]),[progname="$withval" ], [progname="xrogue"] )
+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([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([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])
+AC_MSG_RESULT([yes])
+fi
+
+AC_ARG_ENABLE([limitscore],[AC_HELP_STRING([--enable-limitscore], [limit scores to one per class per uid @<:@default=no@:>@])],[],[])
+AC_MSG_CHECKING([if limiting scores])
+if test "x$enable_limitscore" = "xno" ; then
+AC_MSG_RESULT([no])
+elif test "x$enable_limitscore" = "x" ; then
+AC_MSG_RESULT([no])
+else
+AC_DEFINE([LIMITSCORE], [], [Define to limit scores to one per class per uid])
+AC_MSG_RESULT([yes])
+fi
+
+AC_OUTPUT