--- Makefile.in.orig	Mon Feb  5 12:51:41 2001
+++ Makefile.in	Fri Sep 10 16:04:46 2004
@@ -14,8 +14,8 @@ prefix      =   @prefix@
 exec_prefix =   @exec_prefix@
 srcdir      =   @srcdir@
 BIN_PREFIX  =   @bindir@/
-INC_PREFIX  =   @includedir@/
-LIB_PREFIX  =   @libdir@/
+INC_PREFIX  =   @includedir@/libnet-1.0/
+LIB_PREFIX  =   @libdir@/libnet-1.0/
 MAN_PREFIX  =   @MAN_PREFIX@
 
 LIBNET      =   libnet
@@ -36,7 +36,7 @@ AR          =   @AR@
 LN          =   @LN@
 CC          =   @CC@
 ENSUREDIR   =   $(srcdir)/ensure-dir.sh
-INSTALL_DATA=   $(srcdir)/install-sh
+INSTALL_DATA=   @INSTALL@
 CFLAGS      =   @CFLAGS@
 CPPFLAGS    =   @CPPFLAGS@
 OBJECTS     =   src/libnet_resolve.o\
@@ -66,17 +66,28 @@ OBJECTS     =   src/libnet_resolve.o\
 		src/libnet_hex_dump.o\
 		src/libnet_if_addr.o\
 		src/libnet_port_list.o 
+SHOBJECTS=	$(OBJECTS:S/.o/.so/)
 
+PICFLAG= -fpic
+SHLIB= $(LIBNET).so.$(LIBnet_VERSION)
+
+.SUFFIXES: .o .so
+
 .c.o:
 	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFINES) -c $< -o $@
 
-all: libnet
+.c.so:
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFINES) $(PICFLAG) -DPIC -c $< -o $@
+
 supp: test example
 
 libnet: version.h $(OBJECTS)
 	$(AR) -cr $(LIB) $(OBJECTS)
 	$(RANLIB) $(LIB)
 
+$(SHLIB): version.h $(SHOBJECTS)
+	$(CC) -shared $(PICFLAG) -o $(SHLIB) $(SHOBJECTS)
+
 version.o: version.h
 version.h: ./VERSION
 	@rm -f $@
@@ -91,25 +102,34 @@ util:    libnet install
 example: libnet install
 	cd example; make
 
+.if defined(NO_SHARED_LIBS) && ${NO_SHARED_LIBS:L} == "yes"
+all: libnet
 install: libnet
+.else
+all: libnet $(SHLIB)
+install: libnet $(SHLIB)
+.endif
 	$(ENSUREDIR) $(DESTDIR)$(prefix) 755
 	$(ENSUREDIR) $(DESTDIR)$(LIB_PREFIX) 755
 	$(ENSUREDIR) $(DESTDIR)$(INC_PREFIX)$(LIBNET) 755
 	$(ENSUREDIR) $(DESTDIR)$(INC_PREFIX) 755
 	$(ENSUREDIR) $(DESTDIR)$(MAN_PREFIX) 755
 	$(ENSUREDIR) $(DESTDIR)$(BIN_PREFIX) 755
-	$(INSTALL_DATA) $(LIB) $(DESTDIR)$(LIB_PREFIX)
+	$(INSTALL_DATA) -m 0644 $(LIB) $(DESTDIR)$(LIB_PREFIX)
 	rm -f $(DESTDIR)$(LIB_PREFIX)$(LIBPWRITE).a
 	cd $(DESTDIR)$(LIB_PREFIX); $(LN) -f -s $(LIBNET).a $(LIBPWRITE).a
-	$(INSTALL_DATA) $(INCLUDE) $(DESTDIR)$(INC_PREFIX)
-	$(INSTALL_DATA) $(INCLUDE-H) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
-	$(INSTALL_DATA) $(INCLUDE-F) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
-	$(INSTALL_DATA) $(INCLUDE-S) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
-	$(INSTALL_DATA) $(INCLUDE-M) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
-	$(INSTALL_DATA) $(INCLUDE-A) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
-	$(INSTALL_DATA) $(INCLUDE-O) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
-	$(INSTALL_DATA) $(MAN) $(DESTDIR)$(MAN_PREFIX)
-	$(INSTALL_DATA) $(CONFIG) $(DESTDIR)$(BIN_PREFIX)
+	@if [ -f $(SHLIB) ]; then \
+	   $(INSTALL_DATA) -m 0644 $(SHLIB) $(DESTDIR)$(LIB_PREFIX) ;\
+	fi
+	$(INSTALL_DATA) -m 0644 $(INCLUDE) $(DESTDIR)$(INC_PREFIX)
+	$(INSTALL_DATA) -m 0644 $(INCLUDE-H) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
+	$(INSTALL_DATA) -m 0644 $(INCLUDE-F) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
+	$(INSTALL_DATA) -m 0644 $(INCLUDE-S) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
+	$(INSTALL_DATA) -m 0644 $(INCLUDE-M) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
+	$(INSTALL_DATA) -m 0644 $(INCLUDE-A) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
+	$(INSTALL_DATA) -m 0644 $(INCLUDE-O) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
+	$(INSTALL_DATA) -m 0644 $(MAN) $(DESTDIR)$(MAN_PREFIX)
+	$(INSTALL_DATA) -m 0755 $(CONFIG) $(DESTDIR)$(BIN_PREFIX)/libnet-config-1.0
 
 
 
