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

@ -14,9 +14,7 @@ AC_PROG_CC
MP_WITH_CURSES
# Checks for header files.
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])
# 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.
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])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_UID_T

View file

@ -29,6 +29,10 @@
SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#if defined(_WIN32)
#include <Windows.h>
#include <Lmcons.h>
@ -40,10 +44,15 @@
#undef MOUSE_MOVED
#elif defined(__DJGPP__)
#include <process.h>
#else
#endif
#ifdef HAVE_PWD_H
#include <pwd.h>
#include <sys/utsname.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_UTMPX_H
#include <utmpx.h>
#endif
@ -60,7 +69,7 @@ char *strdup(const char *s);
#endif
#include <curses.h>
#if !defined(DJGPP)
#ifdef HAVE_TERM_H
#include <term.h>
#endif
@ -657,28 +666,6 @@ md_memused()
#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
md_erasechar()
{