Mercurial > hg > early-roguelike
annotate rogue3/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 | 0b3d1b38998f |
rev | line source |
---|---|
88 | 1 # -*- Autoconf -*- |
2 # Process this file with autoconf to produce a configure script. | |
3 | |
4 AC_PREREQ(2.56) | |
5 AC_INIT([Rogue],[3.6.4], [yendor@rogueforge.net]) | |
6 AC_CONFIG_HEADERS([config.h]) | |
7 AC_CONFIG_FILES([Makefile rogue.6 rogue.r]) | |
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([arpa/inet.h 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 # WARN: the sources often don't include the headers when needed. That is one | |
17 # reason why adding "-Wall" to CFLAGS produces 1246 lines of messages. | |
18 | |
19 # Checks for typedefs, structures, and compiler characteristics. | |
20 AC_TYPE_UID_T | |
21 AC_TYPE_SIZE_T | |
22 AC_STRUCT_TM | |
23 # Checks for library functions. | |
24 AC_FUNC_FORK | |
25 AC_PROG_GCC_TRADITIONAL | |
26 AC_FUNC_LSTAT | |
27 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK | |
28 AC_TYPE_SIGNAL | |
29 AC_FUNC_STAT | |
30 AC_FUNC_VPRINTF | |
31 AC_CHECK_FUNCS([erasechar killchar alarm getpass memset setenv strchr nlist _spawnl spawnl getpwuid loadav getloadavg strerror setgid setuid getuid getgid]) | |
32 AC_PROG_INSTALL | |
33 | |
34 # Programs to process the documentation | |
35 AC_CHECK_PROG([NROFF], [nroff], [nroff],) | |
36 AC_CHECK_PROG([GROFF], [groff], [groff],) | |
37 AC_CHECK_PROG([COLCRT], [colcrt], [colcrt],) | |
38 AC_CHECK_PROG([TBL], [tbl], [tbl],) | |
39 | |
40 AC_ARG_WITH(program-name, AC_HELP_STRING([--with-program-name=NAME],[alternate executable name]),[progname="$withval" ], [progname="rogue3"] ) | |
41 PROGRAM=$progname | |
42 AC_SUBST(PROGRAM) | |
43 | |
278
c222f9d56776
Remove an extra bracket from some Autoconf macros.
John "Elwin" Edwards
parents:
223
diff
changeset
|
44 AC_ARG_ENABLE(setgid, AC_HELP_STRING([--enable-setgid=NAME],[install executable as setgid with group ownership of NAME @<:@default=no@:>@]),[],[]) |
88 | 45 AC_MSG_CHECKING([if using setgid execute bit]) |
46 if test "x$enable_setgid" = "xno" ; then | |
47 GROUPOWNER= | |
48 elif test "x$enable_setgid" = "xyes" ; then | |
49 GROUPOWNER=games | |
50 elif test "x$enable_setgid" = "x" ; then | |
51 GROUPOWNER= | |
52 else | |
53 GROUPOWNER=$enable_setgid | |
54 fi | |
55 | |
56 if test "x$GROUPOWNER" != "x" ; then | |
57 AC_DEFINE_UNQUOTED([GROUPOWNER],[$GROUPOWNER], [Define to group owner of setgid executable]) | |
58 AC_MSG_RESULT([$GROUPOWNER]) | |
59 else | |
60 AC_MSG_RESULT([no]) | |
61 fi | |
62 | |
63 AC_SUBST(GROUPOWNER) | |
64 | |
65 AC_ARG_ENABLE([scorefile],[AC_HELP_STRING([--enable-scorefile=SCOREFILE], [enable scoreboard with given filename])],[],[]) | |
66 AC_MSG_CHECKING([for scoreboard file]) | |
67 if test "x$enable_scorefile" = "xno" ; then | |
68 SCOREFILE= | |
69 elif test "x$enable_scorefile" = "xyes" ; then | |
70 SCOREFILE=$progname.scr | |
71 elif test "x$enable_scorefile" = "x" ; then | |
72 SCOREFILE=$progname.scr | |
73 else | |
74 SCOREFILE=$enable_scorefile | |
75 fi | |
76 | |
77 if test "x$SCOREFILE" != "x" ; then | |
78 AC_DEFINE_UNQUOTED([SCOREFILE], ["$SCOREFILE"], [Define to file to use for scoreboard]) | |
79 AC_MSG_RESULT([$SCOREFILE]) | |
80 else | |
81 AC_MSG_RESULT([disabled]) | |
82 fi | |
83 | |
84 AC_SUBST(SCOREFILE) | |
85 | |
86 AC_ARG_ENABLE([logfile],[AC_HELP_STRING([--enable-logfile=LOGFILE], [enable logfile with given filename])],[],[]) | |
87 AC_MSG_CHECKING([for log file]) | |
88 if test "x$enable_logfile" = "xno" ; then | |
89 LOGFILE= | |
90 elif test "x$enable_logfile" = "xyes" ; then | |
91 LOGFILE=$progname.log | |
92 elif test "x$enable_logfile" = "x" ; then | |
93 LOGFILE=$progname.log | |