Mercurial > hg > early-roguelike
annotate arogue5/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 | c222f9d56776 |
children | 6376b514a30b |
rev | line source |
---|---|
99 | 1 # -*- Autoconf -*- |
2 # Process this file with autoconf to produce a configure script. | |
3 | |
4 AC_PREREQ(2.56) | |
5 AC_INIT([ARogue],[5.8.2], [yendor@rogueforge.net]) | |
6 AC_CONFIG_HEADERS([config.h]) | |
7 # May not be needed for the documentation | |
8 AC_CONFIG_FILES([Makefile]) | |
9 | |
10 # Checks for programs. | |
11 AC_PROG_CC | |
12 # Checks for libraries. | |
13 MP_WITH_CURSES | |
14 # Checks for header files. | |
15 AC_HEADER_STDC | |
122 | 16 AC_CHECK_HEADERS([pwd.h errno.h fcntl.h limits.h nlist.h stdlib.h string.h sys/ioctl.h sys/utsname.h termios.h unistd.h utmp.h term.h ncurses/term.h process.h]) |
99 | 17 |
18 # Checks for typedefs, structures, and compiler characteristics. | |
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 AC_ARG_WITH(program-name, AC_HELP_STRING([--with-program-name=NAME],[alternate executable name]),[progname="$withval" ], [progname="arogue5"] ) | |
33 PROGRAM=$progname | |
34 AC_SUBST(PROGRAM) | |
35 | |
278
c222f9d56776
Remove an extra bracket from some Autoconf macros.
John "Elwin" Edwards
parents:
157
diff
changeset
|
36 AC_ARG_ENABLE(setgid, AC_HELP_STRING([--enable-setgid=NAME],[install executable as setgid with group ownership of NAME @<:@default=no@:>@]),[],[]) |
99 | 37 AC_MSG_CHECKING([if using setgid execute bit]) |
38 if test "x$enable_setgid" = "xno" ; then | |
39 GROUPOWNER= | |
40 elif test "x$enable_setgid" = "xyes" ; then | |
41 GROUPOWNER=games | |
42 elif test "x$enable_setgid" = "x" ; then | |
43 GROUPOWNER= | |
44 else | |
45 GROUPOWNER=$enable_setgid | |
46 fi | |
47 | |
48 if test "x$GROUPOWNER" != "x" ; then | |
49 AC_DEFINE_UNQUOTED([GROUPOWNER],[$GROUPOWNER], [Define to group owner of setgid executable]) | |
50 AC_MSG_RESULT([$GROUPOWNER]) | |
51 else | |
52 AC_MSG_RESULT([no]) | |
53 fi | |
54 | |
55 AC_SUBST(GROUPOWNER) | |
56 | |
57 AC_ARG_ENABLE([scorefile],[AC_HELP_STRING([--enable-scorefile=SCOREFILE], [enable scoreboard with given filename])],[],[]) | |
58 AC_MSG_CHECKING([for scoreboard file]) | |
59 if test "x$enable_scorefile" = "xno" ; then | |
60 SCOREFILE= | |
61 elif test "x$enable_scorefile" = "xyes" ; then | |
62 SCOREFILE=$progname.scr | |
63 elif test "x$enable_scorefile" = "x" ; then | |
64 SCOREFILE=$progname.scr | |
65 else | |
66 SCOREFILE=$enable_scorefile | |
67 fi | |
68 | |
69 if test "x$SCOREFILE" != "x" ; then | |
70 AC_DEFINE_UNQUOTED([SCOREFILE], ["$SCOREFILE"], [Define to file to use for scoreboard]) | |
71 AC_MSG_RESULT([$SCOREFILE]) | |
72 else | |
73 AC_MSG_RESULT([disabled]) | |
74 fi | |
75 | |
76 AC_SUBST(SCOREFILE) | |
77 | |
78 AC_ARG_ENABLE([logfile],[AC_HELP_STRING([--enable-logfile=LOGFILE], [enable logfile with given filename])],[],[]) | |
79 AC_MSG_CHECKING([for log file]) | |
80 if test "x$enable_logfile" = "xno" ; then | |
81 LOGFILE= | |
82 elif test "x$enable_logfile" = "xyes" ; then | |
83 LOGFILE=$progname.log | |
84 elif test "x$enable_logfile" = "x" ; then | |
85 LOGFILE=$progname.log | |
86 else | |
87 LOGFILE=$enable_logfile | |
88 fi | |
89 | |
90 if test "x$LOGFILE" != "x" ; then | |
91 AC_DEFINE_UNQUOTED([LOGFILE], ["$LOGFILE"], [Define to file to use for log]) | |
92 AC_MSG_RESULT([$LOGFILE]) | |
93 else | |
94 AC_MSG_RESULT([disabled]) | |
95 fi | |
96 | |
97 AC_SUBST(LOGFILE) | |
98 | |
99 AC_ARG_ENABLE([savedir],[AC_HELP_STRING([--enable-savedir=SAVEDIR], [enable systemwide location for saved games])],[],[enable_savedir="no"]) | |
100 AC_MSG_CHECKING([for save directory]) | |
101 if test "x$enable_savedir" = "xno" ; then | |
102 SAVEDIR= | |
103 elif test "x$enable_savedir" = "xyes" -o "x$enable_savedir" = "x"; then | |
157 | 104 if test "x$GROUPOWNER" != "x"; then |
99 | 105 SAVEDIR="/var/local/games/roguelike/${progname}save/" |
106 else | |
107 SAVEDIR="$progname/" | |
108 fi | |
109 else | |
110 SAVEDIR="$enable_savedir" | |
111 fi | |
112 | |
113 if test "x$SAVEDIR" != "x" ; then | |
114 AC_DEFINE_UNQUOTED([SAVEDIR], ["$SAVEDIR"], [Define to systemwide directory for storing saved games]) | |
115 AC_MSG_RESULT([$SAVEDIR]) | |
116 else | |
117 AC_MSG_RESULT([disabled]) | |
118 fi | |
119 | |
120 AC_SUBST(SAVEDIR) | |
121 | |
122 AC_ARG_ENABLE([wizardmode],[AC_HELP_STRING([--enable-wizardmode], [enable availability of wizard mode @<:@default=no@:>@])],[],[]) | |
123 AC_MSG_CHECKING([if wizard mode is enabled]) | |
124 if test "x$enable_wizardmode" = "xno" ; then | |
125 AC_MSG_RESULT([no]) | |
126 elif test "x$enable_wizardmode" = "x" ; then | |
127 AC_MSG_RESULT([no]) | |
128 else | |
129 AC_DEFINE([WIZARD], [], [Define to include wizard mode]) | |
130 AC_MSG_RESULT([yes]) | |
131 fi | |
132 | |
133 AC_ARG_ENABLE([limitscore],[AC_HELP_STRING([--enable-limitscore], [limit scores to one per class per uid @<:@default=no@:>@])],[],[]) | |
134 AC_MSG_CHECKING([if limiting scores]) | |
135 if test "x$enable_limitscore" = "xno" ; then | |
136 AC_MSG_RESULT([no]) | |
137 elif test "x$enable_limitscore" = "x" ; then | |
138 AC_MSG_RESULT([no]) | |
139 else | |
140 AC_DEFINE([LIMITSCORE], [], [Define to limit scores to one per class per uid]) | |
141 AC_MSG_RESULT([yes]) | |
142 fi | |
143 | |
144 AC_ARG_ENABLE([maxload],[AC_HELP_STRING([--enable-maxload], [enable maxload @<:@default=no@:>@])],[],[]) | |
145 AC_MSG_CHECKING([runtime execution limit (maximum system load average)]) | |
146 if test "x$enable_maxload" = "xyes" ; then | |
147 AC_DEFINE([MAXLOAD], [100], [Define if maxload feature should be enabled]) | |
148 AC_MSG_RESULT([100]) | |
149 elif test "x$enable_maxload" = "x" ; then | |
150 AC_MSG_RESULT([unlimited]) | |
151 elif test "x$enable_maxload" = "xno" ; then | |
152 AC_MSG_RESULT([unlimited]) | |
153 else | |
154 AC_DEFINE_UNQUOTED([MAXLOAD], [$enable_maxload], [Define if maxload feature should be enabled]) | |
155 AC_MSG_RESULT([$enable_maxload]) | |
156 fi | |
157 | |
158 AC_ARG_ENABLE([maxusers],[AC_HELP_STRING([--enable-maxusers], [enable maxuser @<:@default=no@:>@])],[],[]) | |
159 AC_MSG_CHECKING([runtime execution limit (maximum online system users)]) | |
160 if test "x$enable_maxusers" = "xyes" ; then | |
161 AC_DEFINE([MAXUSERS], [100], [Define if maxusers feature should be enabled]) | |
162 AC_MSG_RESULT([100]) | |
163 elif test "x$enable_maxusers" = "x" ; then | |
164 AC_MSG_RESULT([unlimited]) | |
165 elif test "x$enable_maxload" = "xno" ; then | |
166 AC_MSG_RESULT([unlimited]) | |
167 else | |
168 AC_DEFINE_UNQUOTED([MAXLOAD], [$enable_maxusers], [Define if maxusers feature should be enabled]) | |
169 AC_MSG_RESULT([$enable_maxusers]) | |
170 fi | |
171 | |
172 AC_MSG_CHECKING([whether to docdir is defined]) | |
173 if test "x$docdir" = "x" ; then | |
174 AC_MSG_RESULT([docdir undefined]) | |
175 docdir=\${datadir}/doc/\${PACKAGE_TARNAME} | |
176 AC_SUBST(docdir) | |
177 else | |
178 AC_MSG_RESULT([docdir defined]) | |
179 fi | |
180 | |
181 AC_OUTPUT |