changeset 273:51ddbe7b992d

UltraRogue: begin autoconfiscation. Build options can now be set with configure.
author John "Elwin" Edwards
date Mon, 04 Sep 2017 21:08:09 -0400
parents 1db299e868b8
children 603e8a99c859
files urogue/Makefile urogue/Makefile.in urogue/acinclude.m4 urogue/configure.ac urogue/getplay.c urogue/main.c urogue/mdport.c
diffstat 7 files changed, 481 insertions(+), 178 deletions(-) [+]
line wrap: on
line diff
--- a/urogue/Makefile	Sun Sep 03 19:58:22 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-# UltraRogue: The Ultimate Adventure in the Dungeons of Doom
-# Copyright (C) 1985, 1986, 1992, 1993, 1995 Herb Chong
-# All rights reserved.
-#
-# See the file LICENSE.TXT for full copyright and licensing information.
-
-#
-# Makefile for urogue
-#
-
-DISTNAME=urogue1.0.7
-
-HDRS		  = dict.h dictutil.h rogue.h
-OBJS		  = armor.o \
-		artifact.o \
-		bag.o \
-		chase.o \
-		command.o \
-		daemon.o \
-		daemons.o \
-		dict.o \
-		dictutil.o \
-		encumb.o \
-		fight.o \
-		getplay.o \
-		ident.o \
-		init.o \
-		io.o \
-		list.o \
-		magic.o \
-		main.o \
-		maze.o \
-		mdport.o \
-		memory.o \
-		misc.o \
-		monsdata.o \
-		monsters.o \
-		move.o \
-		newlvl.o \
-		options.o \
-		pack.o \
-		passages.o \
-		player.o \
-		potions.o \
-		random.o \
-		rings.o \
-		rip.o \
-		rooms.o \
-		save.o \
-		scrolls.o \
-		state.o \
-		status.o \
-		sticks.o \
-		things.o \
-		trader.o \
-		verify.o \
-		vers.o \
-		weapons.o \
-		wizard.o \
-		xcrypt.o
-
-PROGRAM 	  = ur
-
-CFILES		  = armor.c \
-		artifact.c \
-		bag.c \
-		chase.c \
-		command.c \
-		daemon.c \
-		daemons.c \
-		dict.c \
-		dictutil.c \
-		encumb.c \
-		fight.c \
-		getplay.c \
-		ident.c \
-		init.c \
-		io.c \
-		list.c \
-		magic.c \
-		main.c \
-		maze.c \
-		mdport.c \
-		memory.c \
-		misc.c \
-		monsdata.c \
-		monsters.c \
-		move.c \
-		newlvl.c \
-		options.c \
-		pack.c \
-		passages.c \
-		player.c \
-		potions.c \
-		random.c \
-		rings.c \
-		rip.c \
-		rooms.c \
-		save.c \
-		scrolls.c \
-		state.c \
-		status.c \
-		sticks.c \
-		things.c \
-		trader.c \
-		verify.c \
-		vers.c \
-		weapons.c \
-		wizard.c \
-		xcrypt.c
-
-MISC=           Makefile README LICENSE.TXT history.txt TODO
-
-CC    = gcc
-CFLAGS= -O3
-CRLIB = -lcurses
-RM    = rm -f
-TAR   = tar
-
-urogue:	$(OBJS) $(MAKEFILE)
-	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(CRLIB) -o $@
-
-clean:		
-	rm -f $(OBJS) urogue a.out core *.map urogue.exe urogue.cat 
-
-dist.src:
-	make clean
-	tar cf $(DISTNAME)-src.tar $(CFILES) $(HDRS) $(MISC)
-	gzip -f $(DISTNAME)-src.tar
-
-dist.irix:
-	make clean
-	make CC=cc CFLAGS="-woff 1116 -O3" urogue
-	nroff -man urogue.6 | colcrt - > urogue.cat
-	tar cf $(DISTNAME)-irix.tar urogue urogue.cat README LICENSE.TXT
-	gzip -f $(DISTNAME)-irix.tar
-
-dist.aix:
-	make clean
-	make CC=xlc CFLAGS="-qmaxmem=16768 -O3 -qstrict" urogue
-	nroff -man urogue.6 | colcrt - > urogue.cat
-	tar cf $(DISTNAME)-aix.tar urogue urogue.cat README LICENSE.TXT
-	gzip -f $(DISTNAME)-aix.tar
-
-dist.linux:
-	make clean
-	make urogue
-	groff -man urogue.6 | sed -e 's/.\x08//g' > urogue.cat
-	tar cf $(DISTNAME)-linux.tar urogue urogue.cat README LICENSE.TXT
-	gzip -f $(DISTNAME)-linux.tar
-
-dist.interix:
-	make clean
-	make urogue
-	groff -P-b -P-u -man -Tascii urogue.6 > urogue.cat
-	tar cf $(DISTNAME)-interix.tar urogue urogue.cat README LICENSE.TXT
-	gzip -f $(DISTNAME)-interix.tar
-
-dist.cygwin:
-	make clean
-	make urogue
-	groff -P-c -man -Tascii urogue.6 | sed -e 's/.\x08//g' > urogue.cat
-	tar cf $(DISTNAME)-cygwin.tar urogue.exe urogue.cat README LICENSE.TXT
-	gzip -f $(DISTNAME)-cygwin.tar
-
-dist.djgpp:
-	make clean
-	make LDFLAGS="-L$(DJDIR)/LIB" CRLIB="-lpdcurses" urogue
-	groff -man -Tascii urogue.6 | sed -e 's/.\x08//g' > urogue.cat
-	rm -f $(DISTNAME)-djgpp.zip
-	zip $(DISTNAME)-djgpp.zip urogue.exe urogue.cat README LICENSE.TXT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/urogue/Makefile.in	Mon Sep 04 21:08:09 2017 -0400
@@ -0,0 +1,175 @@
+# UltraRogue: The Ultimate Adventure in the Dungeons of Doom
+# Copyright (C) 1985, 1986, 1992, 1993, 1995 Herb Chong
+# All rights reserved.
+#
+# See the file LICENSE.TXT for full copyright and licensing information.
+
+#
+# Makefile for urogue
+#
+
+DISTNAME=urogue1.0.7
+
+HDRS		  = dict.h dictutil.h rogue.h
+OBJS		  = armor.o \
+		artifact.o \
+		bag.o \
+		chase.o \
+		command.o \
+		daemon.o \
+		daemons.o \
+		dict.o \
+		dictutil.o \
+		encumb.o \
+		fight.o \
+		getplay.o \
+		ident.o \
+		init.o \
+		io.o \
+		list.o \
+		magic.o \
+		main.o \
+		maze.o \
+		mdport.o \
+		memory.o \
+		misc.o \
+		monsdata.o \
+		monsters.o \
+		move.o \
+		newlvl.o \
+		options.o \
+		pack.o \
+		passages.o \
+		player.o \
+		potions.o \
+		random.o \
+		rings.o \
+		rip.o \
+		rooms.o \
+		save.o \
+		scrolls.o \
+		state.o \
+		status.o \
+		sticks.o \
+		things.o \
+		trader.o \
+		verify.o \
+		vers.o \
+		weapons.o \
+		wizard.o \
+		xcrypt.o
+
+PROGRAM 	  =@PROGRAM@
+
+CFILES		  = armor.c \
+		artifact.c \
+		bag.c \
+		chase.c \
+		command.c \
+		daemon.c \
+		daemons.c \
+		dict.c \
+		dictutil.c \
+		encumb.c \
+		fight.c \
+		getplay.c \
+		ident.c \
+		init.c \
+		io.c \
+		list.c \
+		magic.c \
+		main.c \
+		maze.c \
+		mdport.c \
+		memory.c \
+		misc.c \
+		monsdata.c \
+		monsters.c \
+		move.c \
+		newlvl.c \
+		options.c \
+		pack.c \
+		passages.c \
+		player.c \
+		potions.c \
+		random.c \
+		rings.c \
+		rip.c \
+		rooms.c \
+		save.c \
+		scrolls.c \
+		state.c \
+		status.c \
+		sticks.c \
+		things.c \
+		trader.c \
+		verify.c \
+		vers.c \
+		weapons.c \
+		wizard.c \
+		xcrypt.c
+
+MISC=           Makefile README LICENSE.TXT history.txt TODO
+
+CC    = @CC@
+CPPFLAGS=@DEFS@
+CFLAGS=
+CRLIB = @LIBS@
+RM    = rm -f
+TAR   = tar
+
+.c.o:
+	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $*.o $*.c
+
+$(PROGRAM):	$(OBJS) $(MAKEFILE)
+	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(CRLIB) -o $@
+
+clean:		
+	rm -f $(OBJS) urogue a.out core *.map urogue.exe urogue.cat 
+
+dist.src:
+	make clean
+	tar cf $(DISTNAME)-src.tar $(CFILES) $(HDRS) $(MISC)
+	gzip -f $(DISTNAME)-src.tar
+
+dist.irix:
+	make clean
+	make CC=cc CFLAGS="-woff 1116 -O3" urogue
+	nroff -man urogue.6 | colcrt - > urogue.cat
+	tar cf $(DISTNAME)-irix.tar urogue urogue.cat README LICENSE.TXT
+	gzip -f $(DISTNAME)-irix.tar
+
+dist.aix:
+	make clean
+	make CC=xlc CFLAGS="-qmaxmem=16768 -O3 -qstrict" urogue
+	nroff -man urogue.6 | colcrt - > urogue.cat
+	tar cf $(DISTNAME)-aix.tar urogue urogue.cat README LICENSE.TXT
+	gzip -f $(DISTNAME)-aix.tar
+
+dist.linux:
+	make clean
+	make urogue
+	groff -man urogue.6 | sed -e 's/.\x08//g' > urogue.cat
+	tar cf $(DISTNAME)-linux.tar urogue urogue.cat README LICENSE.TXT
+	gzip -f $(DISTNAME)-linux.tar
+
+dist.interix:
+	make clean
+	make urogue
+	groff -P-b -P-u -man -Tascii urogue.6 > urogue.cat
+	tar cf $(DISTNAME)-interix.tar urogue urogue.cat README LICENSE.TXT
+	gzip -f $(DISTNAME)-interix.tar
+
+dist.cygwin:
+	make clean
+	make urogue
+	groff -P-c -man -Tascii urogue.6 | sed -e 's/.\x08//g' > urogue.cat
+	tar cf $(DISTNAME)-cygwin.tar urogue.exe urogue.cat README LICENSE.TXT
+	gzip -f $(DISTNAME)-cygwin.tar
+
+dist.djgpp:
+	make clean
+	make LDFLAGS="-L$(DJDIR)/LIB" CRLIB="-lpdcurses" urogue
+	groff -man -Tascii urogue.6 | sed -e 's/.\x08//g' > urogue.cat
+	rm -f $(DISTNAME)-djgpp.zip
+	zip $(DISTNAME)-djgpp.zip urogue.exe urogue.cat README LICENSE.TXT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/urogue/acinclude.m4	Mon Sep 04 21:08:09 2017 -0400
@@ -0,0 +1,122 @@
+AC_DEFUN([MP_WITH_CURSES],
+  [AC_ARG_WITH(ncurses, [  --with-ncurses          Force the use of ncurses over curses],,)
+   mp_save_LIBS="$LIBS"
+   CURSES_LIB=""
+   if test "$with_ncurses" != yes
+   then
+     AC_CACHE_CHECK([for working curses], mp_cv_curses,
+       [LIBS="$LIBS -lcurses"
+        AC_TRY_LINK(
+          [#include <curses.h>],
+          [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
+          mp_cv_curses=yes, mp_cv_curses=no)])
+     if test "$mp_cv_curses" = yes
+     then
+       AC_DEFINE(HAVE_CURSES_H, 1, [Define to 1 if libcurses is requested])
+       #AC_DEFINE(HAVE_CURSES_H)
+       CURSES_LIB="-lcurses"
+     fi
+   fi
+   if test ! "$CURSES_LIB"
+   then
+     AC_CACHE_CHECK([for working ncurses], mp_cv_ncurses,
+       [LIBS="$mp_save_LIBS -lncurses"
+        AC_TRY_LINK(
+          [#include <ncurses.h>],
+          [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
+          mp_cv_ncurses=yes, mp_cv_ncurses=no)])
+     if test "$mp_cv_ncurses" = yes
+     then
+       AC_DEFINE(HAVE_NCURSES_H, 1, [Define to 1 if libncurses is requested])
+       CURSES_LIB="-lncurses"
+     fi
+   fi
+   if test ! "$CURSES_LIB"
+   then
+     AC_CACHE_CHECK([for working pdcurses], mp_cv_pdcurses,
+       [LIBS="$mp_save_LIBS -lpdcurses"
+        AC_TRY_LINK(
+          [#include <curses.h>],
+          [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
+          mp_cv_pdcurses=yes, mp_cv_pdcurses=no)])
+     if test "$mp_cv_pdcurses" = yes
+     then
+       AC_DEFINE(HAVE_CURSES_H, 1, [Define to 1 if libcurses is requested])
+       CURSES_LIB="-lpdcurses"
+     fi
+   fi
+   if test ! "$CURSES_LIB"
+   then
+     AC_CACHE_CHECK([for working pdcur], mp_cv_pdcur,
+       [LIBS="$mp_save_LIBS -lpdcur"
+        AC_TRY_LINK(
+          [#include <curses.h>],
+          [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
+          mp_cv_pdcur=yes, mp_cv_pdcur=no)])
+     if test "$mp_cv_pdcur" = yes
+     then
+       AC_DEFINE(HAVE_CURSES_H, 1, [Define to 1 if libcurses is requested])
+       CURSES_LIB="-lpdcur"
+     fi
+   fi
+   if test ! "$CURSES_LIB"
+   then
+     AC_CACHE_CHECK([for working peer pdcurses], mp_cv_lpdcurses,
+       [LIBS="$mp_save_LIBS ../pdcurses/pdcurses.a"
+        AC_TRY_LINK(
+          [#include "../pdcurses/curses.h"],
+          [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
+          mp_cv_lpdcurses=yes, mp_cv_lpdcurses=no)])
+     if test "$mp_cv_lpdcurses" = yes
+     then
+       AC_DEFINE(HAVE_CURSES_H, 1, [Define to 1 if libcurses is requested])
+       CURSES_LIB="../pdcurses/pdcurses.a"
+       RF_ADDTO(CPPFLAGS,"-I../pdcurses")
+     fi
+   fi
+   AC_CACHE_CHECK([for ESCDELAY variable],
+		   [mc_cv_ncurses_escdelay],
+		   [AC_TRY_LINK([], [
+			extern int ESCDELAY;
+			ESCDELAY = 0;
+			],
+			[mc_cv_ncurses_escdelay=yes],
+			[mc_cv_ncurses_escdelay=no])
+    ])
+    if test "$mc_cv_ncurses_escdelay" = yes; then
+	AC_DEFINE(HAVE_ESCDELAY, 1,
+		  [Define if ncurses has ESCDELAY variable])
+    fi
+   if test ! "$CURSES_LIB" ; then
+       LIBS="$mp_save_LIBS"
+   fi
+])dnl
+
+dnl
+dnl RF_ADDTO(variable, value)
+dnl
+dnl  Add value to variable
+dnl
+AC_DEFUN([RF_ADDTO],[
+  if test "x$$1" = "x"; then
+    test "x$silent" != "xyes" && echo "  setting $1 to \"$2\""
+    $1="$2"
+  else
+    apr_addto_bugger="$2"
+    for i in $apr_addto_bugger; do
+      apr_addto_duplicate="0"
+      for j in $$1; do
+        if test "x$i" = "x$j"; then
+          apr_addto_duplicate="1"
+          break
+        fi
+      done
+      if test $apr_addto_duplicate = "0"; then
+        test "x$silent" != "xyes" && echo "  adding \"$i\" to $1"
+        $1="$$1 $i"
+      fi
+    done
+  fi
+])dnl
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/urogue/configure.ac	Mon Sep 04 21:08:09 2017 -0400
@@ -0,0 +1,171 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.56)
+AC_INIT([UltraRogue],[1.07], [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 nlist.h stdlib.h string.h sys/ioctl.h termios.h unistd.h utmp.h utmpx.h term.h ncurses/term.h process.h])
+
+# 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_ARG_WITH(program-name, AC_HELP_STRING([--with-program-name=NAME],[alternate executable name]),[progname="$withval" ], [progname="urogue"] )
+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 test "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([chardir],[AC_HELP_STRING([--enable-chardir=CHARDIR], [enable systemwide location for character files])],[],[enable_chardir="no"])
+AC_MSG_CHECKING([for character directory])
+if test "x$enable_chardir" = "xno" ; then
+CHARDIR=
+elif test "x$enable_chardir" = "xyes" -o "x$enable_chardir" = "x"; then
+  if test "x$GROUPOWNER" != "x"; then
+  CHARDIR="/var/local/games/roguelike/${progname}char/"
+  else
+  CHARDIR="$progname/"
+  fi
+else
+CHARDIR="$enable_chardir"
+fi
+
+if test "x$CHARDIR" != "x" ; then
+AC_DEFINE_UNQUOTED([CHARDIR], ["$CHARDIR"], [Define to systemwide directory for storing character files])
+AC_MSG_RESULT([$CHARDIR])
+else
+AC_MSG_RESULT([disabled])
+fi
+
+AC_SUBST(CHARDIR)
+
+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_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)