Mercurial > hg > early-roguelike
annotate srogue/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 |
---|---|
101 | 1 # -*- Autoconf -*- |
2 # Process this file with autoconf to produce a configure script. | |
3 | |
4 AC_PREREQ(2.56) | |
5 AC_INIT([SRogue],[9.0], [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 | |
118 | 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 term.h ncurses/term.h process.h]) |
101 | 16 |
17 # Checks for typedefs, structures, and compiler characteristics. | |
119 | 18 AC_TYPE_UID_T |
101 | 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_TYPE_SIGNAL | |
25 AC_FUNC_STAT | |
26 AC_FUNC_VPRINTF | |
121
e6c8652473fe
srogue: more compatibility improvements.
John "Elwin" Edwards
parents:
119
diff
changeset
|
27 AC_CHECK_FUNCS([erasechar killchar alarm getpass memset setenv strchr nlist _spawnl spawnl getpwuid loadav getloadavg strerror setgid setuid getuid getgid lrand48 random srand48 srandom]) |
101 | 28 AC_PROG_INSTALL |
29 | |
223
0e99eade579c
Generate text documentation from the troff source files.
John "Elwin" Edwards
parents:
157
diff
changeset
|
30 AC_CHECK_PROG([NROFF], [nroff], [nroff],) |
0e99eade579c
Generate text documentation from the troff source files.
John "Elwin" Edwards
parents:
157
diff
changeset
|
31 AC_CHECK_PROG([GROFF], [groff], [groff],) |
0e99eade579c
Generate text documentation from the troff source files.
John "Elwin" Edwards
parents:
157
diff
changeset
|
32 AC_CHECK_PROG([COLCRT], [colcrt], [colcrt],) |
0e99eade579c
Generate text documentation from the troff source files.
John "Elwin" Edwards
parents:
157
diff
changeset
|
33 AC_CHECK_PROG([TBL], [tbl], [tbl],) |
0e99eade579c
Generate text documentation from the troff source files.
John "Elwin" Edwards
parents:
157
diff
changeset
|
34 |
101 | 35 AC_ARG_WITH(program-name, AC_HELP_STRING([--with-program-name=NAME],[alternate executable name]),[progname="$withval" ], [progname="srogue"] ) |
36 PROGRAM=$progname | |
37 AC_SUBST(PROGRAM) | |
38 | |
278
c222f9d56776
Remove an extra bracket from some Autoconf macros.
John "Elwin" Edwards
parents:
223
diff
changeset
|
39 AC_ARG_ENABLE(setgid, AC_HELP_STRING([--enable-setgid=NAME],[install executable as setgid with group ownership of NAME @<:@default=no@:>@]),[],[]) |
101 | 40 AC_MSG_CHECKING([if using setgid execute bit]) |
41 if test "x$enable_setgid" = "xno" ; then | |
42 GROUPOWNER= | |
43 elif test "x$enable_setgid" = "xyes" ; then | |
44 GROUPOWNER=games | |
45 elif test "x$enable_setgid" = "x" ; then | |
46 GROUPOWNER= | |
47 else | |
48 GROUPOWNER=$enable_setgid | |
49 fi | |
50 | |
51 if test "x$GROUPOWNER" != "x" ; then | |
52 AC_DEFINE_UNQUOTED([GROUPOWNER],[$GROUPOWNER], [Define to group owner of setgid executable]) | |
53 AC_MSG_RESULT([$GROUPOWNER]) | |
54 else | |
55 AC_MSG_RESULT([no]) | |
56 fi | |
57 | |
58 AC_SUBST(GROUPOWNER) | |
59 | |
60 AC_ARG_ENABLE([scorefile],[AC_HELP_STRING([--enable-scorefile=SCOREFILE], [enable scoreboard with given filename])],[],[]) | |
61 AC_MSG_CHECKING([for scoreboard file]) | |
62 if test "x$enable_scorefile" = "xno" ; then | |
63 SCOREFILE= | |
64 elif test "x$enable_scorefile" = "xyes" ; then | |
65 SCOREFILE=$progname.scr | |
66 elif test "x$enable_scorefile" = "x" ; then | |
67 SCOREFILE=$progname.scr | |
68 else | |
69 SCOREFILE=$enable_scorefile | |
70 fi | |
71 | |
72 if test "x$SCOREFILE" != "x" ; then | |
73 AC_DEFINE_UNQUOTED([SCOREFILE], ["$SCOREFILE"], [Define to file to use for scoreboard]) | |
74 AC_MSG_RESULT([$SCOREFILE]) | |
75 else | |
76 AC_MSG_RESULT([disabled]) | |
77 fi | |
78 | |
79 AC_SUBST(SCOREFILE) | |
80 | |
81 AC_ARG_ENABLE([logfile],[AC_HELP_STRING([--enable-logfile=LOGFILE], [enable logfile with given filename])],[],[]) | |
82 AC_MSG_CHECKING([for log file]) | |
83 if test "x$enable_logfile" = "xno" ; then | |
84 LOGFILE= | |
85 elif test "x$enable_logfile" = "xyes" ; then | |
86 LOGFILE=$progname.log | |
87 elif test "x$enable_logfile" = "x" ; then | |
88 LOGFILE=$progname.log | |
89 else | |
90 LOGFILE=$enable_logfile | |
91 fi | |