Merge pull request #3 from Memphiz/originalnfs2
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Fri, 10 Jun 2011 22:04:51 +0000 (15:04 -0700)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Fri, 10 Jun 2011 22:04:51 +0000 (15:04 -0700)
"Last" pull ...

Makefile.in
configure.ac
nfs/nfs.x

index 06303e69adc3ba20ad15db7e87b5faf871b258e6..64f03d814c08bdbea36eae606a4b25950f6bf317 100644 (file)
@@ -3,16 +3,26 @@ exec_prefix = @exec_prefix@
 libdir = @libdir@
 bindir = @bindir@
 LIBS=@LIBS@
-
 INSTALLCMD = @install@ -c
+is_darwin=@is_darwin@
+ENABLE_EXAMPLES=@ENABLE_EXAMPLES@
 
-CC=gcc
-CFLAGS=-g -O0 -fPIC -Wall -W -I. -Iinclude -Imount -Infs -Iportmap -Irquota "-D_U_=__attribute__((unused))" -D_FILE_OFFSET_BITS=64
+CC=@CC@
+CFLAGS=@CFLAGS@ -g -O0 -fPIC -Wall -W -I. -Iinclude -Imount -Infs -Iportmap -Irquota "-D_U_=__attribute__((unused))" -D_FILE_OFFSET_BITS=64
 
 LIBNFS_A=lib/libnfs.a
-LIBNFS_SO_NAME=libnfs.so.1
 VERSION=1.0.0
-LIBNFS_SO=lib/libnfs.so.$(VERSION)
+
+ifeq ("$(is_darwin)","yes")
+       LIBNFS_SO_NAME=libnfs.1.dylib
+       LIBNFS_SO=lib/libnfs.$(VERSION).dylib
+       LDFLAGS+=@CFLAGS@ -dynamiclib
+       RPCGEN_DEF=-DU_INT64_PLATTFORM_TYPE="u_int64_t"
+else
+       LIBNFS_SO_NAME=libnfs.so.1
+       LIBNFS_SO=lib/libnfs.so.$(VERSION)
+       LDFLAGS+=@CFLAGS@ -shared -Wl,-soname=$(LIBNFS_SO_NAME)
+endif
 
 LIB_OBJS = lib/pdu.o lib/init.o lib/socket.o \
 lib/libnfs.o lib/libnfs-sync.o
@@ -23,7 +33,9 @@ portmap/libnfs-raw-portmap.o portmap/portmap.o \
 nfs/libnfs-raw-nfs.o nfs/nfs.o \
 rquota/libnfs-raw-rquota.o rquota/rquota.o
 
-EXAMPLES=bin/nfsclient-raw bin/nfsclient-async bin/nfsclient-sync
+ifeq ("$(ENABLE_EXAMPLES)","yes")
+       EXAMPLES=bin/nfsclient-raw bin/nfsclient-async bin/nfsclient-sync
+endif
 
 all: $(LIBNFS_SO) $(EXAMPLES)
 
@@ -46,15 +58,15 @@ $(LIBNFS_A): $(LIBNFS_OBJS) $(LIB_OBJS)
 
 $(LIBNFS_SO): $(LIBNFS_OBJS) $(LIB_OBJS)
        @echo Creating shared library $@
-       $(CC) -shared -Wl,-soname=$(LIBNFS_SO_NAME) -o $@ $(LIBNFS_OBJS) $(LIB_OBJS)
+       $(CC) $(LDFLAGS) -o $@ $(LIBNFS_OBJS) $(LIB_OBJS)
 
 portmap/libnfs-raw-portmap.h: portmap/portmap.x
        @echo Generating $@
-       rpcgen -h portmap/portmap.x > portmap/libnfs-raw-portmap.h
+       rpcgen $(RPCGEN_DEF) -h portmap/portmap.x > portmap/libnfs-raw-portmap.h
 
 portmap/libnfs-raw-portmap.c: portmap/portmap.x
        @echo Generating $@
-       rpcgen -c portmap/portmap.x | sed -e "s/#include \"portmap\/portmap.h\"/#include \"libnfs-raw-portmap.h\"/" > portmap/libnfs-raw-portmap.c
+       rpcgen $(RPCGEN_DEF) -c portmap/portmap.x | sed -e "s/#include \".*portmap.h\"/#include \"libnfs-raw-portmap.h\"/" > portmap/libnfs-raw-portmap.c
 
 portmap/libnfs-raw-portmap.o: portmap/libnfs-raw-portmap.c portmap/libnfs-raw-portmap.h
        @echo Compiling $@
@@ -62,11 +74,11 @@ portmap/libnfs-raw-portmap.o: portmap/libnfs-raw-portmap.c portmap/libnfs-raw-po
 
 mount/libnfs-raw-mount.h: mount/mount.x
        @echo Generating $@
-       rpcgen -h mount/mount.x > mount/libnfs-raw-mount.h
+       rpcgen $(RPCGEN_DEF) -h mount/mount.x > mount/libnfs-raw-mount.h
 
 mount/libnfs-raw-mount.c: mount/mount.x
        @echo Generating $@
-       rpcgen -c mount/mount.x | sed -e "s/#include \"mount\/mount.h\"/#include \"libnfs-raw-mount.h\"/" > mount/libnfs-raw-mount.c
+       rpcgen $(RPCGEN_DEF) -c mount/mount.x | sed -e "s/#include \".*mount.h\"/#include \"libnfs-raw-mount.h\"/" > mount/libnfs-raw-mount.c
 
 mount/libnfs-raw-mount.o: mount/libnfs-raw-mount.c mount/libnfs-raw-mount.h
        @echo Compiling $@
@@ -74,11 +86,11 @@ mount/libnfs-raw-mount.o: mount/libnfs-raw-mount.c mount/libnfs-raw-mount.h
 
 nfs/libnfs-raw-nfs.h: nfs/nfs.x
        @echo Generating $@
-       rpcgen -h nfs/nfs.x > nfs/libnfs-raw-nfs.h
+       rpcgen $(RPCGEN_DEF) -h nfs/nfs.x > nfs/libnfs-raw-nfs.h
 
 nfs/libnfs-raw-nfs.c: nfs/nfs.x
        @echo Generating $@
-       rpcgen -c nfs/nfs.x | sed -e "s/#include \"nfs\/nfs.h\"/#include \"libnfs-raw-nfs.h\"/" > nfs/libnfs-raw-nfs.c
+       rpcgen $(RPCGEN_DEF) -c nfs/nfs.x | sed -e "s/#include \".*nfs.h\"/#include \"libnfs-raw-nfs.h\"/" > nfs/libnfs-raw-nfs.c
 
 nfs/libnfs-raw-nfs.o: nfs/libnfs-raw-nfs.c nfs/libnfs-raw-nfs.h
        @echo Compiling $@
@@ -86,11 +98,11 @@ nfs/libnfs-raw-nfs.o: nfs/libnfs-raw-nfs.c nfs/libnfs-raw-nfs.h
 
 rquota/libnfs-raw-rquota.h: rquota/rquota.x
        @echo Generating $@
-       rpcgen -h rquota/rquota.x > rquota/libnfs-raw-rquota.h
+       rpcgen $(RPCGEN_DEF) -h rquota/rquota.x > rquota/libnfs-raw-rquota.h
 
 rquota/libnfs-raw-rquota.c: rquota/rquota.x
        @echo Generating $@
-       rpcgen -c rquota/rquota.x | sed -e "s/#include \"rquota\/rquota.h\"/#include \"libnfs-raw-rquota.h\"/" > rquota/libnfs-raw-rquota.c
+       rpcgen $(RPCGEN_DEF) -c rquota/rquota.x | sed -e "s/#include \".*rquota.h\"/#include \"libnfs-raw-rquota.h\"/" > rquota/libnfs-raw-rquota.c
 
 rquota/libnfs-raw-rquota.o: rquota/libnfs-raw-rquota.c rquota/libnfs-raw-rquota.h
        @echo Compiling $@
@@ -98,25 +110,28 @@ rquota/libnfs-raw-rquota.o: rquota/libnfs-raw-rquota.c rquota/libnfs-raw-rquota.
 
 install: $(LIBNFS_A) $(LIBNFS_SO)
 ifeq ("$(LIBDIR)x","x")
+       mkdir -p $(libdir)
        $(INSTALLCMD) -m 755 $(LIBNFS_SO) $(libdir)
        $(INSTALLCMD) -m 755 $(LIBNFS_A) $(libdir)
        @ldconfig@
 else
+       mkdir -p $(LIBDIR)
        $(INSTALLCMD) -m 755 $(LIBISCSI_SO) $(LIBDIR)
        $(INSTALLCMD) -m 755 $(LIBNFS_A) $(LIBDIR)
 endif
-       mkdir -p $(DESTDIR)/usr/include/nfsc
-       $(INSTALLCMD) -m 644 include/libnfs.h $(DESTDIR)/usr/include/nfsc
-       $(INSTALLCMD) -m 644 include/libnfs-private.h $(DESTDIR)/usr/include/nfsc
-       $(INSTALLCMD) -m 644 mount/libnfs-raw-mount.h $(DESTDIR)/usr/include/nfsc
-       $(INSTALLCMD) -m 644 nfs/libnfs-raw-nfs.h $(DESTDIR)/usr/include/nfsc
-       $(INSTALLCMD) -m 644 portmap/libnfs-raw-portmap.h $(DESTDIR)/usr/include/nfsc
+       mkdir -p $(prefix)/include/nfsc
+       $(INSTALLCMD) -m 644 include/libnfs.h $(prefix)/include/nfsc
+       $(INSTALLCMD) -m 644 include/libnfs-private.h $(prefix)/include/nfsc
+       $(INSTALLCMD) -m 644 mount/libnfs-raw-mount.h $(prefix)/include/nfsc
+       $(INSTALLCMD) -m 644 nfs/libnfs-raw-nfs.h $(prefix)/include/nfsc
+       $(INSTALLCMD) -m 644 portmap/libnfs-raw-portmap.h $(prefix)/include/nfsc
 
 distclean: clean
        rm -f config.h config.log config.status configure Makefile
 
 clean:
-       rm -f bin/* lib/*.o lib/*.a $(LIBNFS_SO)
+       rm -rf bin/* 
+       rm -f lib/*.o lib/*.a $(LIBNFS_SO)
        rm -f mount/*.o mount/libnfs-raw-mount.h mount/libnfs-raw-mount.c
        rm -f nfs/*.o nfs/libnfs-raw-nfs.h nfs/libnfs-raw-nfs.c
        rm -f portmap/*.o portmap/libnfs-raw-portmap.h portmap/libnfs-raw-portmap.c
index 4bdc5a5048f11b18d8ace43c53e37e5b337034fc..9973c92ad4a7044cbc5a66e1ca90063145c1a102 100644 (file)
@@ -14,6 +14,7 @@ if test "${libdir}" = '${exec_prefix}/lib'; then
 fi
 
 is_solaris="no"
+is_darwin="no"
 install="/usr/bin/install"
 ldconfig="ldconfig"
 
@@ -22,6 +23,8 @@ case `uname` in
     ;;
   Darwin*)
     libdir='${exec_prefix}/lib'
+    ldconfig='echo no ldconfig on darwin'
+    is_darwin="yes"
     ;;
   AIX*)
     ;;
@@ -50,6 +53,17 @@ if test ! -z "$LOGDIR"; then
 fi
 AC_SUBST(LOGDIR)
 
+AC_ARG_WITH([examples],
+              [  --without-examples  Disable build of examples],
+             [ENABLE_EXAMPLES="no"],
+             [ENABLE_EXAMPLES="yes"]
+             )
+AC_SUBST(ENABLE_EXAMPLES)
+
+AC_ARG_WITH([ldconfig],
+           [  --without-ldconfig  Disable call of ldconfig on make install],
+           [ldconfig='echo ldconfig disabled'])
+
 AC_CONFIG_HEADER(config.h)
 
 EXTRA_OBJ=""
@@ -69,6 +83,7 @@ fi
 AC_SUBST(libdir)
 AC_SUBST(install)
 AC_SUBST(ldconfig)
+AC_SUBST(is_darwin)
 #AC_SUBST(LIBNFS_LDFLAGS)
 
 AC_OUTPUT(Makefile)
index 58fc34e6a8452ee836dd39345d42fe8af6ca4477..abb4e461779f9edf89c2e93b259866287d90a079 100644 (file)
--- a/nfs/nfs.x
+++ b/nfs/nfs.x
@@ -7,7 +7,15 @@ const NFS3_COOKIEVERFSIZE = 8;
 
 typedef opaque cookieverf3[NFS3_COOKIEVERFSIZE];
 
-typedef unsigned hyper uint64;
+
+/*unsigned hyper can be overridden by giving rpcgen -DU_INT64_PLATTFORM_TYPE="foo" - for plattforms
+  where rpcgen doesn't know anything about hyper
+  default to unsigned hyper as of rfc 1813 */
+#ifndef U_INT64_PLATTFORM_TYPE
+#define U_INT64_PLATTFORM_TYPE unsigned hyper
+#endif/*U_INT64_PLATTFORM_TYPE*/
+
+typedef U_INT64_PLATTFORM_TYPE uint64;
 typedef uint64 cookie3;
 
 struct nfs_fh3 {