From 032e06fa6424fe591c2a18185ddd7442bdfb3996 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 27 Sep 2014 16:59:49 +0200
Subject: gcc2 fixes.


diff --git a/configure.ac b/configure.ac
index a51415f..d9c42ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,7 +88,7 @@ CFLAGS="$CFLAGS -DHAVE_CONFIG_H"
 CPPFLAGS="$CPPFLAGS -I." 
 
 if test "$GCC" = "yes"; then
-	CFLAGS="$CFLAGS -W -Wall -Wextra -Wno-unused-parameter -pedantic"
+	CFLAGS="$CFLAGS -W -Wall"
 	AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
 	_gcc_cflags_save=$CFLAGS
 	CFLAGS="-Wno-missing-field-initializers"
@@ -293,9 +293,6 @@ if test "$enable_sdl_mixer" = "yes"; then
 fi
 
 
-LIBS="${LIBS} -lm"
-
-
 dnl Test checking
 if test "$enable_test" = "yes"; then
 	AC_DEFINE(USE_TEST, 1, [Define to 1 to build the test frontend])
diff --git a/src/Makefile b/src/Makefile
index 69ced53..da13f16 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -13,7 +13,7 @@ ifneq (${VERSION},)
 	CFLAGS += -DBUILD_ID=${VERSION}
 endif
 
-CFLAGS += -I. -std=c99 -Wdeclaration-after-statement -O0
+CFLAGS += -I. -std=c9x -O0
 
 # gcov intermediate data
 GCOBJS = $(OBJECTS:.o=.gcno) $(OBJECTS:.o=.gcda)
@@ -24,15 +24,15 @@ DISTCLEAN = autoconf.h
 
 export CFLAGS LDFLAGS LIBS
 
-$(PROG): angband.o $(MAINFILES)
-	$(CC) -o $@ angband.o $(MAINFILES) $(LDFLAGS) $(LDADD) $(LIBS)
+$(PROG): angband.a $(MAINFILES)
+	$(CC) -o $@ $(MAINFILES) angband.a $(LDFLAGS) $(LDADD) $(LIBS)
 	@printf "%10s %-20s\n" LINK $@
 
 win/angband.res: win/angband.rc
 	$(RC) $< -O coff -o $@
 
-angband.o: $(OBJECTS)
-	$(LD) -nostdlib -Wl,-r -o $@ $(OBJECTS)
+angband.a: $(OBJECTS)
+	ar cru $@ $(OBJECTS)
 	@printf "%10s %-20s\n" LINK $@
 
 tests: angband.o
diff --git a/src/z-form.h b/src/z-form.h
index 46c26dc..47c74cf 100644
--- a/src/z-form.h
+++ b/src/z-form.h
@@ -16,7 +16,7 @@
 
 /* MSVC doesn't have va_copy (which is C99) or an alternative, so we'll just
  * copy the SRC pointer. In other cases we'll use va_copy() as we should. */
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || __GNUC__ < 3
 #define VA_COPY(DST, SRC) (DST) = (SRC)
 #else
 #define VA_COPY(DST, SRC) va_copy(DST, SRC)
diff --git a/src/z-rand.c b/src/z-rand.c
index 8965456..9383e99 100644
--- a/src/z-rand.c
+++ b/src/z-rand.c
@@ -468,8 +468,6 @@ void rand_fix(u32b val) {
 	rand_fixval = val;
 }
 
-int getpid(void);
-
 /**
  * Another simple RNG that does not use any of the above state
  * (so can be used without disturbing the game's RNG state)
-- 
1.8.3.4

