Merge remote branch 't-nelson/automake'

libnfs-4.0.0-vitalif
Ronnie Sahlberg 2011-07-02 11:10:36 +10:00
commit 2e4db0d145
15 changed files with 225 additions and 252 deletions

28
.gitignore vendored Normal file
View File

@ -0,0 +1,28 @@
.*
*.h
*.c
*.in
*.la
*.a
*.lo
*.o
*-stamp
Makefile
examples/nfsclient-raw
examples/nfsclient-sync
examples/nfsclient-async
aclocal.m4
autom4te.cache/
compile
config.guess
config.h.in~
config.log
config.status
config.sub
configure
depcomp
install-sh
libtool
ltmain.sh
missing
stamp-h1

2
Makefile.am Normal file
View File

@ -0,0 +1,2 @@
SUBDIRS = mount nfs portmap rquota lib include . $(MAYBE_EXAMPLES)

View File

@ -1,135 +0,0 @@
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
includedir = @includedir@
bindir = @bindir@
LIBS=@LIBS@
INSTALLCMD = @install@ -c
is_darwin=@is_darwin@
ENABLE_EXAMPLES=@ENABLE_EXAMPLES@
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
VERSION=1.0.0
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
LIBNFS_OBJS = \
mount/libnfs-raw-mount.o mount/mount.o \
portmap/libnfs-raw-portmap.o portmap/portmap.o \
nfs/libnfs-raw-nfs.o nfs/nfs.o \
rquota/libnfs-raw-rquota.o rquota/rquota.o
ifeq ("$(ENABLE_EXAMPLES)","yes")
EXAMPLES=bin/nfsclient-raw bin/nfsclient-async bin/nfsclient-sync
endif
all: $(LIBNFS_SO) $(EXAMPLES)
bin/nfsclient-async: examples/nfsclient-async.c $(LIBNFS_A)
mkdir -p bin
$(CC) $(CFLAGS) -o $@ examples/nfsclient-async.c $(LIBNFS_A) $(LIBS)
bin/nfsclient-sync: examples/nfsclient-sync.c $(LIBNFS_A)
mkdir -p bin
$(CC) $(CFLAGS) -o $@ examples/nfsclient-sync.c $(LIBNFS_A) $(LIBS)
bin/nfsclient-raw: examples/nfsclient-raw.c $(LIBNFS_A)
mkdir -p bin
$(CC) $(CFLAGS) -o $@ examples/nfsclient-raw.c $(LIBNFS_A) $(LIBS)
$(LIBNFS_A): $(LIBNFS_OBJS) $(LIB_OBJS)
@echo Creating library $@
ar r $(LIBNFS_A) $(LIBNFS_OBJS) $(LIB_OBJS)
ranlib $(LIBNFS_A)
$(LIBNFS_SO): $(LIBNFS_OBJS) $(LIB_OBJS)
@echo Creating shared library $@
$(CC) $(LDFLAGS) -o $@ $(LIBNFS_OBJS) $(LIB_OBJS)
portmap/libnfs-raw-portmap.h: portmap/portmap.x
@echo Generating $@
rpcgen $(RPCGEN_DEF) -h portmap/portmap.x > portmap/libnfs-raw-portmap.h
portmap/libnfs-raw-portmap.c: portmap/portmap.x
@echo Generating $@
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 $@
$(CC) $(CFLAGS) -c portmap/libnfs-raw-portmap.c -o $@
mount/libnfs-raw-mount.h: mount/mount.x
@echo Generating $@
rpcgen $(RPCGEN_DEF) -h mount/mount.x > mount/libnfs-raw-mount.h
mount/libnfs-raw-mount.c: mount/mount.x
@echo Generating $@
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 $@
$(CC) $(CFLAGS) -c mount/libnfs-raw-mount.c -o $@
nfs/libnfs-raw-nfs.h: nfs/nfs.x
@echo Generating $@
rpcgen $(RPCGEN_DEF) -h nfs/nfs.x > nfs/libnfs-raw-nfs.h
nfs/libnfs-raw-nfs.c: nfs/nfs.x
@echo Generating $@
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 $@
$(CC) $(CFLAGS) -c nfs/libnfs-raw-nfs.c -o $@
rquota/libnfs-raw-rquota.h: rquota/rquota.x
@echo Generating $@
rpcgen $(RPCGEN_DEF) -h rquota/rquota.x > rquota/libnfs-raw-rquota.h
rquota/libnfs-raw-rquota.c: rquota/rquota.x
@echo Generating $@
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 $@
$(CC) $(CFLAGS) -c rquota/libnfs-raw-rquota.c -o $@
install: $(LIBNFS_A) $(LIBNFS_SO)
mkdir -p $(DESTDIR)$(libdir)
$(INSTALLCMD) -m 755 $(LIBNFS_SO) $(DESTDIR)$(libdir)
$(INSTALLCMD) -m 755 $(LIBNFS_A) $(DESTDIR)$(libdir)
@ldconfig@
mkdir -p $(DESTDIR)$(includedir)/nfsc
$(INSTALLCMD) -m 644 include/libnfs.h $(DESTDIR)$(includedir)/nfsc
$(INSTALLCMD) -m 644 include/libnfs-private.h $(DESTDIR)$(includedir)/nfsc
$(INSTALLCMD) -m 644 mount/libnfs-raw-mount.h $(DESTDIR)$(includedir)/nfsc
$(INSTALLCMD) -m 644 nfs/libnfs-raw-nfs.h $(DESTDIR)$(includedir)/nfsc
$(INSTALLCMD) -m 644 portmap/libnfs-raw-portmap.h $(DESTDIR)$(includedir)/nfsc
distclean: clean
rm -f config.h config.log config.status configure Makefile
clean:
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
rm -f rquota/*.o rquota/libnfs-raw-rquota.h rquota/libnfs-raw-rquota.c
rm -f nfsclient-raw nfsclient-async nfsclient-sync

View File

@ -1,15 +0,0 @@
#!/bin/sh
rm -rf autom4te.cache
rm -f configure config.h.in libnfs.pc
IPATHS="-I ./include -I ../include -I ./include -I ./mount -I ./nfs -I ./portmap"
autoheader $IPATHS || exit 1
autoconf $IPATHS || exit 1
rm -rf autom4te.cache
echo "Now run ./configure and then make."
exit 0

4
bootstrap Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
autoreconf -vif

View File

@ -1,22 +0,0 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Whether the sockaddr_in struct has a sin_len property */
#undef HAVE_SOCK_SIN_LEN
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION

View File

@ -1,93 +1,65 @@
AC_PREREQ(2.50)
AC_INIT(libnfs, m4_esyscmd([grep 'Version:' ./packaging/RPM/libnfs.spec.in 2>/dev/null | head -1 | sed -e 's/[ \t]*Version:[ \t]*\([^ \t]*\)[ \t]*.*/\1/' | tr -d '\n']))
AC_CONFIG_SRCDIR([lib/init.c])
AC_INIT([libnfs], [0.0.0])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign])
AC_CANONICAL_HOST
if test "${libdir}" = '${exec_prefix}/lib'; then
case `uname -m` in
x86_64|ppc64|powerpc64)
libdir='${exec_prefix}/lib64'
;;
*)
libdir='${exec_prefix}/lib'
;;
esac
# Work around stupid autoconf default cflags. pt 1
SAVE_CFLAGS="x${CFLAGS}"
AC_PROG_CC
AC_PROG_LIBTOOL
AM_PROG_CC_C_O
# Work around stupid autoconf default cflags. pt 2
if test "$SAVE_CFLAGS" = "x"; then
CFLAGS=""
fi
is_solaris="no"
is_darwin="no"
install="/usr/bin/install"
ldconfig="ldconfig"
AC_CHECK_PROG([HAVE_RPCGEN], [rpcgen], [yes], [no])
if test x$HAVE_RPCGEN != xyes; then
AC_MSG_ERROR([Can not find required program])
fi
case `uname` in
Linux*)
#option: examples
AC_ARG_ENABLE([examples],
[AC_HELP_STRING([--enable-examples],
[Build example programs])],
[ENABLE_EXAMPLES=$enableval],
[ENABLE_EXAMPLES="no"])
if test x$ENABLE_EXAMPLES = xyes; then
MAYBE_EXAMPLES="examples"
fi
AC_SUBST(MAYBE_EXAMPLES)
case $host in
*darwin*)
RPCGENFLAGS=-DU_INT64_PLATTFORM_TYPE="u_int64_t"
;;
Darwin*)
libdir='${exec_prefix}/lib'
ldconfig='echo no ldconfig on darwin'
is_darwin="yes"
;;
AIX*)
;;
SunOS)
is_solaris="yes"
install="ginstall"
ldconfig="echo no ldconfig on solaris"
LIBS="$LIBS -lsocket -lnsl"
*solaris*)
AC_CHECK_HEADERS([sys/filio.h])
if test x$ENABLE_EXAMPLES = xyes; then
AC_CHECK_LIB([socket], [main], , [AC_MSG_ERROR([Can not find required library])])
AC_CHECK_LIB([nsl], [main], , [AC_MSG_ERROR([Can not find required library])])
fi
;;
*)
;;
esac
if test "$ac_cv_prog_gcc" = yes; then
CFLAGS="$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings"
fi
AC_SUBST(RPCGENFLAGS)
LOGDIR='${localstatedir}/log'
AC_ARG_WITH([logdir],
[ --with-logdir=DIR path to log directory [[LOCALSTATEDIR/log]]],
LOGDIR=$withval)
if test ! -z "$LOGDIR"; then
if test "$LOGDIR" = "yes" -o "$LOGDIR" = "no"; then
AC_MSG_ERROR([--with-logdir must specify a path])
fi
fi
AC_SUBST(LOGDIR)
#output
AC_CONFIG_FILES([Makefile]
[include/Makefile]
[lib/Makefile]
[mount/Makefile]
[nfs/Makefile]
[portmap/Makefile]
[rquota/Makefile]
[examples/Makefile]
)
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'])
if test x"$cross_compiling" = xyes; then
ldconfig='echo crosscompiling: ldconfig disabled'
fi
AC_CONFIG_HEADER(config.h)
EXTRA_OBJ=""
#AC_CHECK_HEADERS(sched.h)
#AC_CHECK_FUNCS(mlockall)
AC_CACHE_CHECK([for sin_len in sock],libnfs_cv_HAVE_SOCK_SIN_LEN,[
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>],
[struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
libnfs_cv_HAVE_SOCK_SIN_LEN=yes,libnfs_cv_HAVE_SOCK_SIN_LEN=no)])
if test x"$libnfs_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property])
fi
AC_SUBST(libdir)
AC_SUBST(install)
AC_SUBST(ldconfig)
AC_SUBST(is_darwin)
#AC_SUBST(LIBNFS_LDFLAGS)
AC_OUTPUT(Makefile)
AC_OUTPUT

24
examples/Makefile.am Normal file
View File

@ -0,0 +1,24 @@
noinst_PROGRAMS = nfsclient-async nfsclient-raw nfsclient-sync
nfsclient_async_CPPFLAGS = \
-I$(abs_top_srcdir)/include \
-I$(abs_top_srcdir)/mount \
"-D_U_=__attribute__((unused))"
nfsclient_async_SOURCES = nfsclient-async.c
nfsclient_async_LDADD = $(abs_top_srcdir)/lib/.libs/libnfs.la
nfsclient_raw_CPPFLAGS = \
-I$(abs_top_srcdir)/include \
-I$(abs_top_srcdir)/mount \
-I$(abs_top_srcdir)/nfs \
-I$(abs_top_srcdir)/rquota \
"-D_U_=__attribute__((unused))"
nfsclient_raw_SOURCES = nfsclient-raw.c
nfsclient_raw_LDADD = $(abs_top_srcdir)/lib/.libs/libnfs.la
nfsclient_sync_CPPFLAGS = \
-I$(abs_top_srcdir)/include \
-I$(abs_top_srcdir)/mount \
"-D_U_=__attribute__((unused))"
nfsclient_sync_SOURCES = nfsclient-sync.c
nfsclient_sync_LDADD = $(abs_top_srcdir)/lib/.libs/libnfs.la

6
include/Makefile.am Normal file
View File

@ -0,0 +1,6 @@
nfscdir = $(includedir)/nfsc
dist_nfsc_HEADERS = \
libnfs.h \
libnfs-private.h \
libnfs-raw.h \
slist.h

23
lib/Makefile.am Normal file
View File

@ -0,0 +1,23 @@
lib_LTLIBRARIES = libnfs.la
libnfs_la_CPPFLAGS = -I$(abs_top_srcdir)/include \
-I$(abs_top_srcdir)/mount \
-I$(abs_top_srcdir)/nfs \
-I$(abs_top_srcdir)/portmap \
-I$(abs_top_srcdir)/rquota \
"-D_U_=__attribute__((unused))"
libnfs_la_SOURCES = \
init.c \
libnfs.c \
libnfs-sync.c \
pdu.c \
socket.c
libnfs_la_LDFLAGS = -version-info 0:0:0
libnfs_la_LIBADD = \
$(abs_top_srcdir)/mount/libmount.la \
$(abs_top_srcdir)/nfs/libnfs.la \
$(abs_top_srcdir)/portmap/libportmap.la \
$(abs_top_srcdir)/rquota/librquota.la

View File

@ -15,6 +15,9 @@
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -25,6 +28,9 @@
#include <rpc/rpc.h>
#include <rpc/xdr.h>
#include <arpa/inet.h>
#ifdef HAVE_SYS_FILIO_H
#include <sys/filio.h>
#endif
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>

20
mount/Makefile.am Normal file
View File

@ -0,0 +1,20 @@
noinst_LTLIBRARIES = libmount.la
mount_SOURCES_GENERATED = libnfs-raw-mount.c
mount_HEADERS_GENERATED = libnfs-raw-mount.h
mount_GENERATED = $(mount_SOURCES_GENERATED) $(mount_HEADERS_GENERATED)
CLEANFILES = $(mount_GENERATED) mount-stamp
libmount_la_CPPFLAGS = -I$(abs_top_srcdir)/include
libmount_la_SOURCES = \
$(mount_SOURCES_GENERATED) \
mount.c
$(mount_GENERATED) : mount-stamp
mount-stamp : mount.x
rm -f $(mount_GENERATED)
rpcgen -h @RPCGENFLAGS@ $< > libnfs-raw-mount.h
rpcgen -c @RPCGENFLAGS@ $< | sed -e "s/#include \".*mount.h\"/#include \"libnfs-raw-mount.h\"/" > libnfs-raw-mount.c
touch mount-stamp

20
nfs/Makefile.am Normal file
View File

@ -0,0 +1,20 @@
noinst_LTLIBRARIES = libnfs.la
nfs_SOURCES_GENERATED = libnfs-raw-nfs.c
nfs_HEADERS_GENERATED = libnfs-raw-nfs.h
nfs_GENERATED = $(nfs_SOURCES_GENERATED) $(nfs_HEADERS_GENERATED)
CLEANFILES = $(nfs_GENERATED) nfs-stamp
libnfs_la_CPPFLAGS = -I$(abs_top_srcdir)/include
libnfs_la_SOURCES = \
$(nfs_SOURCES_GENERATED) \
nfs.c
$(nfs_GENERATED) : nfs-stamp
nfs-stamp : nfs.x
rm -f $(nfs_GENERATED)
rpcgen -h @RPCGENFLAGS@ $< > libnfs-raw-nfs.h
rpcgen -c @RPCGENFLAGS@ $< | sed -e "s/#include \".*nfs.h\"/#include \"libnfs-raw-nfs.h\"/" > libnfs-raw-nfs.c
touch nfs-stamp

20
portmap/Makefile.am Normal file
View File

@ -0,0 +1,20 @@
noinst_LTLIBRARIES = libportmap.la
portmap_SOURCES_GENERATED = libnfs-raw-portmap.c
portmap_HEADERS_GENERATED = libnfs-raw-portmap.h
portmap_GENERATED = $(portmap_SOURCES_GENERATED) $(portmap_HEADERS_GENERATED)
CLEANFILES = $(portmap_GENERATED) portmap-stamp
libportmap_la_CPPFLAGS = -I$(abs_top_srcdir)/include
libportmap_la_SOURCES = \
$(portmap_SOURCES_GENERATED) \
portmap.c
$(portmap_GENERATED) : portmap-stamp
portmap-stamp : portmap.x
rm -f $(portmap_GENERATED)
rpcgen -h @RPCGENFLAGS@ $< > libnfs-raw-portmap.h
rpcgen -c @RPCGENFLAGS@ $< | sed -e "s/#include \".*portmap.h\"/#include \"libnfs-raw-portmap.h\"/" > libnfs-raw-portmap.c
touch portmap-stamp

20
rquota/Makefile.am Normal file
View File

@ -0,0 +1,20 @@
noinst_LTLIBRARIES = librquota.la
rquota_SOURCES_GENERATED = libnfs-raw-rquota.c
rquota_HEADERS_GENERATED = libnfs-raw-rquota.h
rquota_GENERATED = $(rquota_SOURCES_GENERATED) $(rquota_HEADERS_GENERATED)
CLEANFILES = $(rquota_GENERATED) rquota-stamp
librquota_la_CPPFLAGS = -I$(abs_top_srcdir)/include
librquota_la_SOURCES = \
$(rquota_SOURCES_GENERATED) \
rquota.c
$(rquota_GENERATED) : rquota-stamp
rquota-stamp : rquota.x
rm -f $(rquota_GENERATED)
rpcgen -h @RPCGENFLAGS@ $< > libnfs-raw-rquota.h
rpcgen -c @RPCGENFLAGS@ $< | sed -e "s/#include \".*rquota.h\"/#include \"libnfs-raw-rquota.h\"/" > libnfs-raw-rquota.c
touch rquota-stamp