Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite build system using automake #6

Merged
merged 7 commits into from
Jul 2, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SUBDIRS = mount nfs portmap rquota lib include . $(MAYBE_EXAMPLES)

135 changes: 0 additions & 135 deletions Makefile.in

This file was deleted.

15 changes: 0 additions & 15 deletions autogen.sh

This file was deleted.

4 changes: 4 additions & 0 deletions bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

autoreconf -vif

22 changes: 0 additions & 22 deletions config.h.in

This file was deleted.

128 changes: 50 additions & 78 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -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
fi
# Work around stupid autoconf default cflags. pt 1
SAVE_CFLAGS="x${CFLAGS}"

is_solaris="no"
is_darwin="no"
install="/usr/bin/install"
ldconfig="ldconfig"
AC_PROG_CC
AC_PROG_LIBTOOL

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
AM_PROG_CC_C_O

if test "$ac_cv_prog_gcc" = yes; then
CFLAGS="$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings"
# Work around stupid autoconf default cflags. pt 2
if test "$SAVE_CFLAGS" = "x"; then
CFLAGS=""
fi

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
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_SUBST(LOGDIR)

AC_ARG_WITH([examples],
[ --without-examples Disable build of examples],
[ENABLE_EXAMPLES="no"],
[ENABLE_EXAMPLES="yes"]
)
AC_SUBST(ENABLE_EXAMPLES)
#option: examples
AC_ARG_ENABLE([examples],
[AC_HELP_STRING([--enable-examples],
[Build example programs])],
[ENABLE_EXAMPLES=$enableval],
[ENABLE_EXAMPLES="no"])

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'
if test x$ENABLE_EXAMPLES = xyes; then
MAYBE_EXAMPLES="examples"
fi
AC_SUBST(MAYBE_EXAMPLES)

AC_CONFIG_HEADER(config.h)

EXTRA_OBJ=""
case $host in
*darwin*)
RPCGENFLAGS=-DU_INT64_PLATTFORM_TYPE="u_int64_t"
;;
*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

#AC_CHECK_HEADERS(sched.h)
#AC_CHECK_FUNCS(mlockall)
AC_SUBST(RPCGENFLAGS)

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)
#output
AC_CONFIG_FILES([Makefile]
[include/Makefile]
[lib/Makefile]
[mount/Makefile]
[nfs/Makefile]
[portmap/Makefile]
[rquota/Makefile]
[examples/Makefile]
)

AC_OUTPUT(Makefile)
AC_OUTPUT
24 changes: 24 additions & 0 deletions examples/Makefile.am
Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 0 deletions include/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
nfscdir = $(includedir)/nfsc
dist_nfsc_HEADERS = \
libnfs.h \
libnfs-private.h \
libnfs-raw.h \
slist.h
Loading