$NetBSD: patch-aa,v 1.26 2003/09/07 17:22:16 jschauma Exp $

--- Makefile.config.in.orig	Tue Oct 15 10:17:21 2002
+++ Makefile.config.in	Sun Sep  7 12:39:12 2003
@@ -33,7 +33,7 @@
 #CC = gcc
 # Note that 'cc' is usually an alias for whatever is the main compiler
 # on a system, e.g. the GNU Compiler on Linux.
-CC = cc
+#CC = cc
 
 # The linker.
 LD = $(CC)
@@ -52,7 +52,7 @@
 
 # MAKE is set automatically by Make to what was used to invoke Make.
 
-INSTALL = $(SRCDIR)/buildtools/install.sh
+#INSTALL = $(SRCDIR)/buildtools/install.sh
 #Solaris:
 #INSTALL = /usr/ucb/install
 #Tru64:
@@ -64,7 +64,7 @@
 
 # STRIPFLAG is the option you pass to the above install program to make it
 # strip unnecessary information out of binaries.
-STRIPFLAG = -s
+#STRIPFLAG = -s
 # If you don't want to strip the binaries, just leave it null:
 #STRIPFLAG = 
 
@@ -83,7 +83,9 @@
 AR = ar
 RANLIB = ranlib
 # IRIX, SCO don't have Ranlib:
-#RANLIB = true
+ifeq ($(OPSYS),IRIX)
+RANLIB = ar rs
+endif
 LEX = flex
 # Solaris:
 # LEX = flex -e
@@ -131,7 +133,7 @@
 # Solaris, SunOS, NetBSD:
 #NEED_RUNTIME_PATH = Y
 
-LDFLAGS =
+#LDFLAGS =
 # Eunice users may want to use -noshare so that the executables can
 # run standalone:
 #LDFLAGS = -noshare
@@ -171,6 +173,14 @@
 #AIX:
 #LDSHLIB = ???
 
+ifeq ($(OPSYS),SunOS)
+LDSHLIB = -Wl,-B,dynamic,-G,-h,$(SONAME) 
+endif
+
+ifeq ($(OPSYS),Darwin)
+LDSHLIB = -dynamiclib -install_name $(NETPBM_RUNTIME_PATH)/libnetpbm.$(MAJ).dylib
+endif
+
 # On older systems, you have to make shared libraries out of position
 # independent code, so you need -fpic or fPIC here.  (The rule is: if
 # -fpic works, use it.  If it bombs, go to fPIC).  On newer systems,
@@ -188,11 +198,19 @@
 CFLAGS_SHLIB = 
 # Solaris or SunOS with gcc, and NetBSD:
 #CFLAGS_SHLIB = -fpic
-#CFLAGS_SHLIB = -fPIC
+CFLAGS_SHLIB = -fPIC
 # Sun compiler:
 #CFLAGS_SHLIB = -Kpic
 #CFLAGS_SHLIB = -KPIC
 
+ifeq ($(OPSYS),Darwin)
+CFLAGS_SHLIB = -fno-common
+endif
+
+ifeq ($(OPSYS),IRIX)
+CFLAGS_SHLIB = -KPIC
+endif
+
 # SHLIB_CLIB is the link option to include the C library in a shared library,
 # normally "-lc".  On typical systems, this serves no purpose.  On some,
 # though, it causes information about which C library to use to be recorded
@@ -244,8 +262,8 @@
 #TIFFLIB = libtiff.so
 #TIFFHDR_DIR = /usr/include/libtiff
 #NetBSD:
-#TIFFLIB = $(LOCALBASE)/lib/libtiff.so
-#TIFFHDR_DIR = $(LOCALBASE)/include
+TIFFLIB = $(BUILDLINK_DIR)/lib/libtiff.so
+TIFFHDR_DIR = $(BUILDLINK_DIR)/include
 # OSF, Tru64:
 #TIFFLIB = /usr/local1/DEC/lib/libtiff.so
 #TIFFHDR_DIR = /usr/local1/DEC/include
@@ -273,8 +291,8 @@
 #JPEGLIB = libjpeg.so
 #JPEGHDR_DIR = /usr/include/jpeg
 # Netbsd:
-#JPEGLIB = ${LOCALBASE}/lib/libjpeg.so
-#JPEGHDR_DIR = ${LOCALBASE}/include
+JPEGLIB = ${BUILDLINK_DIR}/lib/libjpeg.so
+JPEGHDR_DIR = ${BUILDLINK_DIR}/include
 # OSF, Tru64:
 #JPEGLIB = /usr/local1/DEC/libjpeg.so
 #JPEGHDR_DIR = /usr/local1/DEC/include
@@ -297,8 +315,8 @@
 #PNGLIB = libpng$(PNGVER).so
 #PNGHDR_DIR = /usr/include/libpng$(PNGVER)
 # NetBSD:
-#PNGLIB = $(LOCALBASE)/lib/libpng$(PNGVER).so
-#PNGHDR_DIR = $(LOCALBASE)/include
+PNGLIB = $(BUILDLINK_DIR)/lib/libpng$(PNGVER).so
+PNGHDR_DIR = $(BUILDLINK_DIR)/include
 # OSF/Tru64:
 #PNGLIB = /usr/local1/DEC/lib/libpng$(PNGVER).so
 #PNGHDR_DIR = /usr/local1/DEC/include
@@ -308,8 +326,8 @@
 # NONE for the PNG library, it doesn't matter what you specify here --
 # it won't get used.
 
-ZLIB = NONE
-ZHDR_DIR = 
+ZLIB = $(BUILDLINK_DIR)/lib/libz.so
+ZHDR_DIR = $(BUILDLINK_DIR)/include
 #ZLIB = libz.so
 
 # The JBIG lossless image compression library (aka JBIG-KIT):
@@ -337,7 +355,7 @@
 # network functions is the option in ppmtompeg to run it on multiple
 # computers simultaneously.
 
-NETWORKLD = 
+#NETWORKLD = 
 # Solaris, SunOS:
 #NETWORKLD = -lsocket -lnsl
 # SCO:
