Index: converter/other/jpeg2000/jpeg2ktopam.c
--- converter/other/jpeg2000/jpeg2ktopam.c.orig	2005-05-19 17:29:47 +0200
+++ converter/other/jpeg2000/jpeg2ktopam.c	2006-10-24 08:07:49 +0200
@@ -9,7 +9,6 @@
 *****************************************************************************/
 
 #define _BSD_SOURCE 1      /* Make sure strdup() is in string.h */
-#define _XOPEN_SOURCE 500  /* Make sure strdup() is in string.h */
 #include <string.h>
 
 #include "pam.h"
Index: converter/other/jpeg2000/pamtojpeg2k.c
--- converter/other/jpeg2000/pamtojpeg2k.c.orig	2005-02-21 04:56:41 +0100
+++ converter/other/jpeg2000/pamtojpeg2k.c	2006-10-24 08:07:49 +0200
@@ -9,7 +9,6 @@
 *****************************************************************************/
 
 #define _BSD_SOURCE 1    /* Make sure strdup() is in string.h */
-#define _XOPEN_SOURCE 500  /* Make sure strdup() is in string.h */
 #include <string.h>
 
 #include "pam.h"
Index: lib/libpm.c
--- lib/libpm.c.orig	2004-11-20 17:55:27 +0100
+++ lib/libpm.c	2006-10-24 08:07:49 +0200
@@ -617,7 +617,7 @@
 pm_openr(const char * const name) {
     FILE* f;
 
-    if (strcmp(name, "-") == 0)
+    if (name == NULL || strcmp(name, "-") == 0)
         f = stdin;
     else {
 #ifndef VMS
@@ -639,7 +639,7 @@
 pm_openw(const char * const name) {
     FILE* f;
 
-    if (strcmp(name, "-") == 0)
+    if (name == NULL || strcmp(name, "-") == 0)
         f = stdout;
     else {
 #ifndef VMS
Index: lib/pm_gamma.h
--- lib/pm_gamma.h.orig	2004-06-13 00:53:25 +0200
+++ lib/pm_gamma.h	2006-10-24 08:18:26 +0200
@@ -5,7 +5,7 @@
 
 #include <math.h>
 
-static __inline__ float
+static float
 pm_gamma709(float const intensity) {
 
     /* Here are parameters of the gamma transfer function
@@ -34,7 +34,7 @@
 
 
 
-static __inline__ float
+static float
 pm_ungamma709(float const brightness) {
 
     /* These are the same parameters as in pm_gamma, above */
Index: converter/other/Makefile
--- converter/other/Makefile.orig	2005-02-05 18:48:28.000000000 +0100
+++ converter/other/Makefile	2009-01-09 00:54:13.704466003 +0100
@@ -111,29 +111,29 @@
 endif
 
 tifftopnm pnmtotiff pnmtotiffcmyk: %: %.o $(NETPBMLIB) $(LIBOPT)
-	$(LD) $(LDFLAGS) -o $@ $@.o \
+	$(LD) -o $@ $@.o \
 	  `$(LIBOPT) $(NETPBMLIB) $(LIBOPTR) $(TIFFLIB) $(TIFFLIB_EXTRALIBS)` \
-	   $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD)
+	   $(LDFLAGS) $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD)
 
 pngtopnm: %: %.o $(NETPBMLIB) $(LIBOPT)
-	$(LD) $(LDFLAGS) -o $@ $@.o \
+	$(LD) -o $@ $@.o \
 	  `$(LIBOPT) $(NETPBMLIB) $(LIBOPTR) $(PNGLIB) $(ZLIB)` \
-	  $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD)
+	  $(LDFLAGS) $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD)
 
 pnmtopng: %: %.o pngtxt.o $(NETPBMLIB) $(LIBOPT)
-	$(LD) $(LDFLAGS) -o $@ $@.o pngtxt.o \
+	$(LD) -o $@ $@.o pngtxt.o \
 	  `$(LIBOPT) $(NETPBMLIB) $(LIBOPTR) $(PNGLIB) $(ZLIB)` \
-	  $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD)
+	  $(LDFLAGS) $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD)
 
 jpegtopnm: %: %.o jpegdatasource.o exif.o $(NETPBMLIB) $(LIBOPT)
-	$(LD) $(LDFLAGS) -o $@ $< jpegdatasource.o exif.o \
+	$(LD) -o $@ $< jpegdatasource.o exif.o \
 	  `$(LIBOPT) $(NETPBMLIB) $(LIBOPTR) $(JPEGLIB)` \
-	  $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD) 
+	  $(LDFLAGS) $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD) 
 
 pnmtojpeg: %: %.o $(NETPBMLIB) $(LIBOPT)
-	$(LD) $(LDFLAGS) -o $@ $@.o \
+	$(LD) -o $@ $@.o \
 	  `$(LIBOPT) $(NETPBMLIB) $(LIBOPTR) $(JPEGLIB)` \
-	  $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD)
+	  $(LDFLAGS) $(MATHLIB) $(LDLIBS) $(RPATH) $(LADD)
 
 # If URTLIB is BUNDLED_URTLIB, then we're responsible for building it, which
 # means it needs to be a dependency:
@@ -142,13 +142,13 @@
 endif
 
 rletopnm pnmtorle: %: %.o $(NETPBMLIB) $(URTLIBDEP) $(LIBOPT)
-	$(LD) $(LDFLAGS) -o $@ $@.o \
-	  `$(LIBOPT) $(NETPBMLIB) $(URTLIB)` $(MATHLIB) $(LDLIBS) \
+	$(LD) -o $@ $@.o \
+	  `$(LIBOPT) $(NETPBMLIB) $(URTLIB)` $(LDFLAGS) $(MATHLIB) $(LDLIBS) \
 	   $(RPATH) $(LADD)
 
 pnmtorast rasttopnm: %: %.o rast.o $(NETPBMLIB) $(LIBOPT)
-	$(LD) $(LDFLAGS) -o $@ $@.o rast.o \
-	  `$(LIBOPT) $(NETPBMLIB)` $(MATHLIB) $(LDLIBS) \
+	$(LD) -o $@ $@.o rast.o \
+	  `$(LIBOPT) $(NETPBMLIB)` $(LDFLAGS) $(MATHLIB) $(LDLIBS) \
 	   $(RPATH) $(LADD)
 
 install.bin: install.bin.local
