File nethack-gcc15-1.patch of Package nethack-367
Index: NetHack-3.6.7/include/system.h
===================================================================
--- NetHack-3.6.7.orig/include/system.h
+++ NetHack-3.6.7/include/system.h
@@ -60,9 +60,13 @@ typedef long off_t;
#endif
#ifndef SIG_RET_TYPE
#if defined(NHSTDC) || defined(POSIX_TYPES) || defined(OS2) || defined(__DECC)
+#if defined(LINUX) && defined(__GNUC__)
+#define SIG_RET_TYPE __sighandler_t
+#else
#define SIG_RET_TYPE void (*)()
#endif
#endif
+#endif
#ifndef SIG_RET_TYPE
#if defined(ULTRIX) || defined(SUNOS4) || defined(SVR3) || defined(SVR4)
/* SVR3 is defined automatically by some systems */
@@ -95,8 +99,10 @@ E int FDECL(srandom, (unsigned int));
E long NDECL(lrand48);
E void FDECL(srand48, (long));
#else
+#ifndef LINUX
E long lrand48();
E void srand48();
+#endif
#endif /* MACOSX */
#endif /* BSD || ULTRIX || RANDOM */
@@ -351,6 +357,7 @@ E char *FDECL(memset, (char *, int, int)
#endif /* TOS */
#endif /* MICRO */
+#ifndef LINUX
#if defined(BSD) && defined(ultrix) /* i.e., old versions of Ultrix */
E void sleep();
#endif
@@ -360,6 +367,7 @@ E unsigned sleep();
#if defined(HPUX)
E unsigned int FDECL(sleep, (unsigned int));
#endif
+#endif
#ifdef VMS
E int FDECL(sleep, (unsigned));
#endif
@@ -519,7 +527,11 @@ E char *FDECL(tgoto, (const char *, int,
#else
#if !(defined(HPUX) && defined(_POSIX_SOURCE))
E int FDECL(tgetent, (char *, const char *));
+#if !(defined(LINUX) && defined(__GNUC__))
E void FDECL(tputs, (const char *, int, int (*)()));
+#else
+E int tputs(const char *, int, int (*)(int));
+#endif
#endif
E int FDECL(tgetnum, (const char *));
E int FDECL(tgetflag, (const char *));
Index: NetHack-3.6.7/sys/unix/hints/linux
===================================================================
--- NetHack-3.6.7.orig/sys/unix/hints/linux
+++ NetHack-3.6.7/sys/unix/hints/linux
@@ -34,6 +34,21 @@ CFLAGS+=-DCURSES_GRAPHICS
#CFLAGS+=-DSCORE_ON_BOTL
#CFLAGS+=-DMSGHANDLER
#CFLAGS+=-DTTY_TILES_ESCCODES
+#detection of clang vs gcc
+CCISCLANG := $(shell echo `$(CC) --version` | grep clang)
+ifneq "$(CCISCLANG)" ""
+# clang-specific follows
+CLANGGTEQ18 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 18)
+ifeq "$(CLANGGTEQ18)" "1"
+# clang-specific starts here
+CFLAGS+=-Wno-deprecated-non-prototype
+endif
+# clang-specific ends here
+else
+# gcc-specific starts here
+CFLAGS+=-Wno-old-style-definition -Wno-unused-result -Wno-format-overflow
+# gcc-specific ends here
+endif # clang-specific or gcc-specific ends here
LINK=$(CC)
# Only needed for GLIBC stack trace: