annotate srogue/acinclude.m4 @ 114:a5433ba4cabf

arogue5: fix some daemon-related pointer/int casting. Daemons and fuses take a single argument, nominally an int but either ignored or unsafely cast to a pointer. Its type has now been changed to void*. The save/restore code no longer tries to store this argument in the savefile. For doctor(), this is not a problem, because player is the only argument it is ever given as a daemon. However, alchemy() will fail to do anything when passed NULL. Fixing this would be complicated but possible. Summary: the code is slightly safer, but alchemy jugs are guaranteed to stop working after save and restore, instead of just extremely likely.
author John "Elwin" Edwards
date Fri, 28 Mar 2014 10:57:03 -0700
parents 15f8229f38c1
children 029c1f5c5588
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
101
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
1 AC_DEFUN([MP_WITH_CURSES],
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
2 [AC_ARG_WITH(ncurses, [ --with-ncurses Force the use of ncurses over curses],,)
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
3 mp_save_LIBS="$LIBS"
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
4 CURSES_LIB=""
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
5 if test "$with_ncurses" != yes
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
6 then
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
7 AC_CACHE_CHECK([for working curses], mp_cv_curses,
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
8 [LIBS="$LIBS -lcurses"
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
9 AC_TRY_LINK(
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
10 [#include <curses.h>],
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
11 [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
12 mp_cv_curses=yes, mp_cv_curses=no)])
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
13 if test "$mp_cv_curses" = yes
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
14 then
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
15 AC_DEFINE(HAVE_CURSES_H, 1, [Define to 1 if libcurses is requested])
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
16 #AC_DEFINE(HAVE_CURSES_H)
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
17 CURSES_LIB="-lcurses"
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
18 fi
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
19 fi
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
20 if test ! "$CURSES_LIB"
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
21 then
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
22 AC_CACHE_CHECK([for working ncurses], mp_cv_ncurses,
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
23 [LIBS="$mp_save_LIBS -lncurses"
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
24 AC_TRY_LINK(
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
25 [#include <ncurses.h>],
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
26 [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
27 mp_cv_ncurses=yes, mp_cv_ncurses=no)])
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
28 if test "$mp_cv_ncurses" = yes
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
29 then
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
30 AC_DEFINE(HAVE_NCURSES_H, 1, [Define to 1 if libncurses is requested])
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
31 CURSES_LIB="-lncurses"
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
32 fi
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
33 fi
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
34 if test ! "$CURSES_LIB"
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
35 then
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
36 AC_CACHE_CHECK([for working pdcurses], mp_cv_pdcurses,
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
37 [LIBS="$mp_save_LIBS -lpdcurses"
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
38 AC_TRY_LINK(
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
39 [#include <curses.h>],
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
40 [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
41 mp_cv_pdcurses=yes, mp_cv_pdcurses=no)])
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
42 if test "$mp_cv_pdcurses" = yes
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
43 then
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
44 AC_DEFINE(HAVE_CURSES_H, 1, [Define to 1 if libcurses is requested])
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
45 CURSES_LIB="-lpdcurses"
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
46 fi
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
47 fi
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
48 if test ! "$CURSES_LIB"
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
49 then
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
50 AC_CACHE_CHECK([for working pdcur], mp_cv_pdcur,
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
51 [LIBS="$mp_save_LIBS -lpdcur"
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
52 AC_TRY_LINK(
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
53 [#include <curses.h>],
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
54 [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
55 mp_cv_pdcur=yes, mp_cv_pdcur=no)])
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
56 if test "$mp_cv_pdcur" = yes
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
57 then
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
58 AC_DEFINE(HAVE_CURSES_H, 1, [Define to 1 if libcurses is requested])
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
59 CURSES_LIB="-lpdcur"
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
60 fi
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
61 fi
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
62 if test ! "$CURSES_LIB"
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
63 then
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
64 AC_CACHE_CHECK([for working peer pdcurses], mp_cv_lpdcurses,
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
65 [LIBS="$mp_save_LIBS ../pdcurses/pdcurses.a"
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
66 AC_TRY_LINK(
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
67 [#include "../pdcurses/curses.h"],
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
68 [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ],
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
69 mp_cv_lpdcurses=yes, mp_cv_lpdcurses=no)])
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
70 if test "$mp_cv_lpdcurses" = yes
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
71 then
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
72 AC_DEFINE(HAVE_CURSES_H, 1, [Define to 1 if libcurses is requested])
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
73 CURSES_LIB="../pdcurses/pdcurses.a"
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
74 RF_ADDTO(CPPFLAGS,"-I../pdcurses")
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
75 fi
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
76 fi
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
77 AC_CACHE_CHECK([for ESCDELAY variable],
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
78 [mc_cv_ncurses_escdelay],
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
79 [AC_TRY_LINK([], [
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
80 extern int ESCDELAY;
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
81 ESCDELAY = 0;
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
82 ],
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
83 [mc_cv_ncurses_escdelay=yes],
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
84 [mc_cv_ncurses_escdelay=no])
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
85 ])
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
86 if test "$mc_cv_ncurses_escdelay" = yes; then
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
87 AC_DEFINE(HAVE_ESCDELAY, 1,
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
88 [Define if ncurses has ESCDELAY variable])
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
89 fi
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
90 if test ! "$CURSES_LIB" ; then
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
91 LIBS="$mp_save_LIBS"
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
92 fi
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
93 ])dnl
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards
parents:
diff changeset
94
15f8229f38c1 srogue: begin porting to autoconf.
John "Elwin" Edwards