Mercurial > hg > early-roguelike
annotate urogue/configure.ac @ 280:70aa5808c782
Fix potential segfaults at restore related to ctime().
In some games, restore() passes the result of ctime() to mvprintw() or
some other variadic message-formatting function. If ctime() has not
been declared properly, its return type is inferred to be int instead
of char *. This does not cause a warning because the compiler does not
know the correct type of variadic arguments.
On platforms where ints and pointers are not the same size, this can,
probably depending on alignment, result in a segfault that is not easy
to trace.
Including time.h fixes the problem. Some games manually declared
ctime() and avoided the bug. These declarations have also been
replaced with the include.
author | John "Elwin" Edwards |
---|---|
date | Fri, 15 Sep 2017 20:51:10 -0400 |
parents | aa0eefcd7df6 |
children | 6376b514a30b |
rev | line source |
---|---|
273 | 1 # -*- Autoconf -*- |
2 # Process this file with autoconf to produce a configure script. | |
3 | |
4 AC_PREREQ(2.56) | |
5 AC_INIT([UltraRogue],[1.07], [yendor@rogueforge.net]) | |
6 AC_CONFIG_HEADERS([config.h]) | |
7 AC_CONFIG_FILES([Makefile]) | |
8 | |
9 # Checks for programs. | |
10 AC_PROG_CC | |
11 # Checks for libraries. | |
12 MP_WITH_CURSES | |
13 # Checks for header files. | |
14 AC_HEADER_STDC | |
15 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]) | |
16 | |
17 # Checks for typedefs, structures, and compiler characteristics. | |
18 AC_TYPE_UID_T | |
19 AC_TYPE_SIZE_T | |
20 AC_STRUCT_TM | |
21 # Checks for library functions. | |
22 AC_FUNC_FORK | |
23 AC_PROG_GCC_TRADITIONAL | |
24 AC_FUNC_LSTAT | |
25 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK | |
26 AC_TYPE_SIGNAL | |
27 AC_FUNC_STAT | |
28 AC_FUNC_VPRINTF | |
29 AC_CHECK_FUNCS([erasechar killchar alarm getpass memset setenv strchr nlist _spawnl spawnl getpwuid loadav getloadavg strerror setgid setuid getuid getgid]) | |
30 AC_PROG_INSTALL | |
31 | |
32 # Programs to process the documentation | |
275
aa0eefcd7df6
UltraRogue: build and install documentation in the Makefile.
John "Elwin" Edwards
parents:
273
diff
changeset
|
33 AC_CHECK_PROG([NROFF], [nroff], [nroff],) |
aa0eefcd7df6
UltraRogue: build and install documentation in the Makefile.
John "Elwin" Edwards
parents:
273
diff
changeset
|
34 AC_CHECK_PROG([GROFF], [groff], [groff],) |
aa0eefcd7df6
UltraRogue: build and install documentation in the Makefile.
John "Elwin" Edwards
parents:
273
diff
changeset
|
35 AC_CHECK_PROG([COLCRT], [colcrt], [colcrt],) |
273 | 36 |
37 AC_ARG_WITH(program-name, AC_HELP_STRING([--with-program-name=NAME],[alternate executable name]),[progname="$withval" ], [progname="urogue"] ) | |
38 PROGRAM=$progname | |
39 AC_SUBST(PROGRAM) | |
40 | |
41 AC_ARG_ENABLE(setgid, AC_HELP_STRING([--enable-setgid=NAME],[install executable as setgid with group ownership of NAME @<:@default=no@:>@]),[],[]) | |
42 AC_MSG_CHECKING([if using setgid execute bit]) | |
43 if test "x$enable_setgid" = "xno" ; then | |
44 GROUPOWNER= | |
45 elif test "x$enable_setgid" = "xyes" ; then | |
46 GROUPOWNER=games | |
47 elif test "x$enable_setgid" = "x" ; then | |
48 GROUPOWNER= | |
49 else | |
50 GROUPOWNER=$enable_setgid | |
51 fi | |
52 | |
53 if test "x$GROUPOWNER" != "x" ; then | |
54 AC_DEFINE_UNQUOTED([GROUPOWNER],[$GROUPOWNER], [Define to group owner of setgid executable]) | |
55 AC_MSG_RESULT([$GROUPOWNER]) | |
56 else | |
57 AC_MSG_RESULT([no]) | |
58 fi | |
59 | |
60 AC_SUBST(GROUPOWNER) | |
61 | |
62 AC_ARG_ENABLE([scorefile],[AC_HELP_STRING([--enable-scorefile=SCOREFILE], [enable scoreboard with given filename])],[],[]) | |
63 AC_MSG_CHECKING([for scoreboard file]) | |
64 if test "x$enable_scorefile" = "xno" ; then | |
65 SCOREFILE= | |
66 elif test "x$enable_scorefile" = "xyes" ; then | |
67 SCOREFILE=$progname.scr | |
68 elif test "x$enable_scorefile" = "x" ; then | |
69 SCOREFILE=$progname.scr | |
70 else | |
71 SCOREFILE=$enable_scorefile | |
72 fi | |
73 | |
74 if test "x$SCOREFILE" != "x" ; then | |
75 AC_DEFINE_UNQUOTED([SCOREFILE], ["$SCOREFILE"], [Define to file to use for scoreboard]) | |
76 AC_MSG_RESULT([$SCOREFILE]) | |
77 else | |
78 AC_MSG_RESULT([disabled]) | |
79 fi | |
80 | |
81 AC_SUBST(SCOREFILE) | |
82 | |
83 AC_ARG_ENABLE([logfile],[AC_HELP_STRING([--enable-logfile=LOGFILE], [enable logfile with given filename])],[],[]) | |
84 AC_MSG_CHECKING([for log file]) | |
85 if test "x$enable_logfile" = "xno" ; then | |
86 LOGFILE= | |
87 elif test "x$enable_logfile" = "xyes" ; then | |
88 LOGFILE=$progname.log | |
89 elif test "x$enable_logfile" = "x" ; then | |
90 LOGFILE=$progname.log | |
91 else | |
92 LOGFILE=$enable_logfile | |
93 fi | |
94 | |
95 if test "x$LOGFILE" != "x" ; then | |
96 AC_DEFINE_UNQUOTED([LOGFILE], ["$LOGFILE"], [Define to file to use for log]) | |
97 AC_MSG_RESULT([$LOGFILE]) | |
98 else | |
99 AC_MSG_RESULT([disabled]) | |
100 fi | |
101 | |
102 AC_SUBST(LOGFILE) | |
103 | |
104 AC_ARG_ENABLE([savedir],[AC_HELP_STRING([--enable-savedir=SAVEDIR], [enable systemwide location for saved games])],[],[enable_savedir="no"]) | |
105 AC_MSG_CHECKING([for save directory]) | |
106 if test "x$enable_savedir" = "xno" ; then | |
107 SAVEDIR= | |
108 elif test "x$enable_savedir" = "xyes" -o "x$enable_savedir" = "x"; then | |
109 if test "x$GROUPOWNER" != "x"; then | |
110 SAVEDIR="/var/local/games/roguelike/${progname}save/" | |
111 else | |
112 SAVEDIR="$progname/" | |
113 fi | |
114 else | |
115 SAVEDIR="$enable_savedir" | |
116 fi | |
117 | |
118 if test "x$SAVEDIR" != "x" ; then | |
119 AC_DEFINE_UNQUOTED([SAVEDIR], ["$SAVEDIR"], [Define to systemwide directory for storing saved games]) | |
120 AC_MSG_RESULT([$SAVEDIR]) | |
121 else | |
122 AC_MSG_RESULT([disabled]) | |
123 fi | |
124 | |
125 AC_SUBST(SAVEDIR) | |
126 | |
127 AC_ARG_ENABLE([chardir],[AC_HELP_STRING([--enable-chardir=CHARDIR], [enable systemwide location for character files])],[],[enable_chardir="no"]) | |
128 AC_MSG_CHECKING([for character directory]) | |
129 if test "x$enable_chardir" = "xno" ; then | |
130 CHARDIR= | |
131 elif test "x$enable_chardir" = "xyes" -o "x$enable_chardir" = "x"; then | |
132 if test "x$GROUPOWNER" != "x"; then | |
133 CHARDIR="/var/local/games/roguelike/${progname}char/" | |
134 else | |
135 CHARDIR="$progname/" | |
136 fi | |
137 else | |
138 CHARDIR="$enable_chardir" | |
139 fi | |
140 | |
141 if test "x$CHARDIR" != "x" ; then | |
142 AC_DEFINE_UNQUOTED([CHARDIR], ["$CHARDIR"], [Define to systemwide directory for storing character files]) | |
143 AC_MSG_RESULT([$CHARDIR]) | |
144 else | |
145 AC_MSG_RESULT([disabled]) | |
146 fi | |
147 | |
148 AC_SUBST(CHARDIR) | |
149 | |
150 AC_ARG_ENABLE([wizardmode],[AC_HELP_STRING([--enable-wizardmode], [enable availability of wizard mode @<:@default=no@:>@])],[],[]) | |
151 AC_MSG_CHECKING([if wizard mode is enabled]) | |
152 if test "x$enable_wizardmode" = "xno" ; then | |
153 AC_MSG_RESULT([no]) | |
154 elif test "x$enable_wizardmode" = "x" ; then | |
155 AC_MSG_RESULT([no]) | |
156 else | |
157 AC_DEFINE([WIZARD], [], [Define to include wizard mode]) | |
158 AC_MSG_RESULT([yes]) | |
159 fi | |
160 | |
161 AC_MSG_CHECKING([whether to docdir is defined]) | |
162 if test "x$docdir" = "x" ; then | |
163 AC_MSG_RESULT([docdir undefined]) | |
164 docdir=\${datadir}/doc/\${PACKAGE_TARNAME} | |
165 AC_SUBST(docdir) | |
166 else | |
167 AC_MSG_RESULT([docdir defined]) | |
168 fi | |
169 | |
170 AC_OUTPUT |