rogue4, arogue5: improve portability.

Most changes merely prevent including header files that don't exist.

All games now build and run on MinGW, though bugs remain.
This commit is contained in:
John "Elwin" Edwards 2014-05-07 14:08:38 -07:00
parent 120beada5a
commit be61b1a69e
5 changed files with 46 additions and 40 deletions

View file

@ -7,7 +7,7 @@ with the dgamelaunch online play system. Some bugs have also been fixed, and
the build process slightly improved. The essential flavor of a codebase half the build process slightly improved. The essential flavor of a codebase half
as old as stored-program computing machinery remains unchanged. as old as stored-program computing machinery remains unchanged.
To install on Unix: To install on Unix (including OS X):
If you checked out the source from Mercurial, run 'autoreconf' first. If you checked out the source from Mercurial, run 'autoreconf' first.
@ -26,6 +26,17 @@ To install on Windows:
Use the included Visual Studio solution files. Warning: they have not been Use the included Visual Studio solution files. Warning: they have not been
tested recently. tested recently.
You can also build on Windows using MinGW. Make sure pdcurses is installed.
You will have to go into the '/lib' folder and copy 'libpdcurses.a' to
'libcurses.a', and 'libpdcurses.dll.a' to 'libcurses.dll.a'; this should get
fixed soon.
It is recommended to run 'configure' with the '--disable-logfile' option, and
'make' with the 'LDFLAGS=-static' option.
The games should all build with MinGW, but there are still bugs with arrow keys
and saving/restoring.
See the individual games' subdirectories for further documentation. Some of See the individual games' subdirectories for further documentation. Some of
the manpages may be outdated, but the guides to playing should be accurate. the manpages may be outdated, but the guides to playing should be accurate.

View file

@ -13,7 +13,7 @@ AC_PROG_CC
MP_WITH_CURSES MP_WITH_CURSES
# Checks for header files. # Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
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 term.h ncurses/term.h process.h]) 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])
# Checks for typedefs, structures, and compiler characteristics. # Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T AC_TYPE_SIZE_T

View file

@ -42,9 +42,15 @@
#undef MOUSE_MOVED #undef MOUSE_MOVED
#elif defined(__DJGPP__) #elif defined(__DJGPP__)
#include <process.h> #include <process.h>
#else #endif
#ifdef HAVE_PWD_H
#include <pwd.h> #include <pwd.h>
#endif
#ifdef HAVE_SYS_UTSNAME_H
#include <sys/utsname.h> #include <sys/utsname.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
@ -57,12 +63,10 @@
#include <curses.h> #include <curses.h>
#if defined(__INTERIX) || defined(__MSYS__) #if defined(HAVE_TERM_H)
#include <term.h> #include <term.h>
#elif defined(HAVE_NCURSES_TERM_H) #elif defined(HAVE_NCURSES_TERM_H)
#include <ncurses/term.h> #include <ncurses/term.h>
#else
#include <term.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
@ -93,14 +97,20 @@ md_init()
} }
int int
md_hasclreol() md_hasclreol(void)
{ {
#ifndef attron #if defined(clr_eol)
return(!CE); #ifdef NCURSES_VERSION
#elif !defined(__PDCURSES__) if (cur_term == NULL)
return(clr_eol != NULL); return(0);
#else if (cur_term->type.Strings == NULL)
return(0);
#endif
return((clr_eol != NULL) && (*clr_eol != 0));
#elif defined(__PDCURSES__)
return(TRUE); return(TRUE);
#else
return((CE != NULL) && (*CE != 0));
#endif #endif
} }

View file

@ -14,9 +14,7 @@ AC_PROG_CC
MP_WITH_CURSES MP_WITH_CURSES
# Checks for header files. # Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h sys/utsname.h pwd.h fcntl.h limits.h nlist.h stdlib.h string.h sys/ioctl.h termios.h unistd.h utmp.h term.h ncurses/term.h process.h]) AC_CHECK_HEADERS([arpa/inet.h sys/utsname.h pwd.h fcntl.h limits.h nlist.h stdlib.h string.h sys/ioctl.h termios.h unistd.h utmpx.h term.h ncurses/term.h process.h])
# WARN: the sources often don't include the headers when needed. That is one
# reason why adding "-Wall" to CFLAGS produces 1246 lines of messages.
# Checks for typedefs, structures, and compiler characteristics. # Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_UID_T AC_TYPE_UID_T

View file

@ -29,6 +29,10 @@
SUCH DAMAGE. SUCH DAMAGE.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#if defined(_WIN32) #if defined(_WIN32)
#include <Windows.h> #include <Windows.h>
#include <Lmcons.h> #include <Lmcons.h>
@ -40,10 +44,15 @@
#undef MOUSE_MOVED #undef MOUSE_MOVED
#elif defined(__DJGPP__) #elif defined(__DJGPP__)
#include <process.h> #include <process.h>
#else #endif
#ifdef HAVE_PWD_H
#include <pwd.h> #include <pwd.h>
#include <sys/utsname.h> #endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif
#ifdef HAVE_UTMPX_H
#include <utmpx.h> #include <utmpx.h>
#endif #endif
@ -60,7 +69,7 @@ char *strdup(const char *s);
#endif #endif
#include <curses.h> #include <curses.h>
#if !defined(DJGPP) #ifdef HAVE_TERM_H
#include <term.h> #include <term.h>
#endif #endif
@ -657,28 +666,6 @@ md_memused()
#endif #endif
} }
char *
md_gethostname()
{
static char nodename[80];
char *n = NULL;
#if !defined(_WIN32) && !defined(__DJGPP__)
struct utsname ourname;
if (uname(&ourname) == 0)
n = ourname.nodename;
#endif
if ((n == NULL) || (*n == '\0'))
if ( (n = getenv("COMPUTERNAME")) == NULL)
if ( (n = getenv("HOSTNAME")) == NULL)
n = "localhost";
strncpy(nodename, n, 80);
nodename[79] = 0;
return(nodename);
}
int int
md_erasechar() md_erasechar()
{ {