From: Trent Nelson Date: Fri, 24 Jun 2011 21:23:43 +0000 (-0400) Subject: Rewrite build system using automake X-Git-Tag: upstream/1.9.6^2~359^2~6 X-Git-Url: https://git.piment-noir.org/?p=deb_libnfs.git;a=commitdiff_plain;h=6c437065d363dee7f14296e80ae34877e4e1e78c Rewrite build system using automake Initial commit, only linux tested so far. --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c84187d --- /dev/null +++ b/.gitignore @@ -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 diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..653060d --- /dev/null +++ b/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS = mount nfs portmap rquota lib include . $(MAYBE_EXAMPLES) + diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index d86a1b7..0000000 --- a/Makefile.in +++ /dev/null @@ -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 - diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 579675a..0000000 --- a/autogen.sh +++ /dev/null @@ -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 - diff --git a/bootstrap b/bootstrap new file mode 100755 index 0000000..27c9413 --- /dev/null +++ b/bootstrap @@ -0,0 +1,4 @@ +#!/bin/bash + +autoreconf -vif + diff --git a/config.h.in b/config.h.in deleted file mode 100644 index fbe4d82..0000000 --- a/config.h.in +++ /dev/null @@ -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 diff --git a/configure.ac b/configure.ac index 363e671..ca6eead 100644 --- a/configure.ac +++ b/configure.ac @@ -1,93 +1,60 @@ 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], [1.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 -fi - -is_solaris="no" -is_darwin="no" -install="/usr/bin/install" -ldconfig="ldconfig" +# Work around stupid autoconf default cflags. pt 1 +SAVE_CFLAGS="x${CFLAGS}" -case `uname` in - Linux*) - ;; - 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" - ;; - *) - ;; -esac +AC_PROG_CC +AC_PROG_LIBTOOL -if test "$ac_cv_prog_gcc" = yes; then - CFLAGS="$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings" -fi +AM_PROG_CC_C_O -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 +# Work around stupid autoconf default cflags. pt 2 +if test "$SAVE_CFLAGS" = "x"; then + CFLAGS="" 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']) -if test x"$cross_compiling" = xyes; then - ldconfig='echo crosscompiling: ldconfig disabled' +AC_CHECK_PROG([HAVE_RPCGEN], [rpcgen], [yes], [no]) +if test x$HAVE_RPCGEN != xyes; then + AC_MSG_ERROR([Can not find required program]) 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 -#include -#include ], -[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) +# option: logdir +AC_ARG_WITH([logdir], + [AC_HELP_STRING([--with-logdir=DIR], + [path to log directory [[LOCALSTATEDIR/log]]])], + [LOGDIR=$withval], + [LOGDIR='${localstatedir}/log']) + +#if test ! -d "$LOGDIR"; then +# AC_MSG_ERROR([--with-logdir must specify a path]) +#fi +AC_SUBST(LOGDIR) -AC_OUTPUT(Makefile) +#option: examples +AC_ARG_ENABLE([examples], + [AC_HELP_STRING([--enable-examples], + [Build example programs])], + [ENABLE_EXAMPLES=$enableval], + [ENABLE_EXAMPLES="no"]) +AM_CONDITIONAL(EXAMPLES, [test x$ENABLE_EXAMPLES = xyes]) +AM_COND_IF(EXAMPLES, + [MAYBE_EXAMPLES="examples"] + [config_examples="examples/Makefile"]) +AC_SUBST(MAYBE_EXAMPLES) + +#output +AC_CONFIG_FILES([Makefile] + [include/Makefile] + [lib/Makefile] + [mount/Makefile] + [nfs/Makefile] + [portmap/Makefile] + [rquota/Makefile] + [examples/Makefile] + ) + +AC_OUTPUT diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..bbadbea --- /dev/null +++ b/examples/Makefile.am @@ -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 diff --git a/include/Makefile.am b/include/Makefile.am new file mode 100644 index 0000000..31fc37a --- /dev/null +++ b/include/Makefile.am @@ -0,0 +1,6 @@ +nfscdir = $(includedir)/nfsc +dist_nfsc_HEADERS = \ + libnfs.h \ + libnfs-private.h \ + libnfs-raw.h \ + slist.h diff --git a/lib/Makefile.am b/lib/Makefile.am new file mode 100644 index 0000000..499a155 --- /dev/null +++ b/lib/Makefile.am @@ -0,0 +1,22 @@ +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_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 + diff --git a/mount/Makefile.am b/mount/Makefile.am new file mode 100644 index 0000000..7e612b2 --- /dev/null +++ b/mount/Makefile.am @@ -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 $< > libnfs-raw-mount.h + rpcgen -c $< | sed -e "s/#include \".*mount.h\"/#include \"libnfs-raw-mount.h\"/" > libnfs-raw-mount.c + touch mount-stamp + diff --git a/nfs/Makefile.am b/nfs/Makefile.am new file mode 100644 index 0000000..c5d27ef --- /dev/null +++ b/nfs/Makefile.am @@ -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 $< > libnfs-raw-nfs.h + rpcgen -c $< | sed -e "s/#include \".*nfs.h\"/#include \"libnfs-raw-nfs.h\"/" > libnfs-raw-nfs.c + touch nfs-stamp + diff --git a/portmap/Makefile.am b/portmap/Makefile.am new file mode 100644 index 0000000..6c947fc --- /dev/null +++ b/portmap/Makefile.am @@ -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 $< > libnfs-raw-portmap.h + rpcgen -c $< | sed -e "s/#include \".*portmap.h\"/#include \"libnfs-raw-portmap.h\"/" > libnfs-raw-portmap.c + touch portmap-stamp + diff --git a/rquota/Makefile.am b/rquota/Makefile.am new file mode 100644 index 0000000..4f08798 --- /dev/null +++ b/rquota/Makefile.am @@ -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 $< > libnfs-raw-rquota.h + rpcgen -c $< | sed -e "s/#include \".*rquota.h\"/#include \"libnfs-raw-rquota.h\"/" > libnfs-raw-rquota.c + touch rquota-stamp +