| 1 | AC_PREREQ(2.50) |
| 2 | 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'])) |
| 3 | AC_CONFIG_SRCDIR([lib/init.c]) |
| 4 | |
| 5 | if test "${libdir}" = '${exec_prefix}/lib'; then |
| 6 | case `uname -m` in |
| 7 | x86_64|ppc64|powerpc64) |
| 8 | libdir='${exec_prefix}/lib64' |
| 9 | ;; |
| 10 | *) |
| 11 | libdir='${exec_prefix}/lib' |
| 12 | ;; |
| 13 | esac |
| 14 | fi |
| 15 | |
| 16 | is_solaris="no" |
| 17 | is_darwin="no" |
| 18 | install="/usr/bin/install" |
| 19 | ldconfig="ldconfig" |
| 20 | |
| 21 | case `uname` in |
| 22 | Linux*) |
| 23 | ;; |
| 24 | Darwin*) |
| 25 | libdir='${exec_prefix}/lib' |
| 26 | ldconfig='echo no ldconfig on darwin' |
| 27 | is_darwin="yes" |
| 28 | ;; |
| 29 | AIX*) |
| 30 | ;; |
| 31 | SunOS) |
| 32 | is_solaris="yes" |
| 33 | install="ginstall" |
| 34 | ldconfig="echo no ldconfig on solaris" |
| 35 | LIBS="$LIBS -lsocket -lnsl" |
| 36 | ;; |
| 37 | *) |
| 38 | ;; |
| 39 | esac |
| 40 | |
| 41 | if test "$ac_cv_prog_gcc" = yes; then |
| 42 | CFLAGS="$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings" |
| 43 | fi |
| 44 | |
| 45 | LOGDIR='${localstatedir}/log' |
| 46 | AC_ARG_WITH([logdir], |
| 47 | [ --with-logdir=DIR path to log directory [[LOCALSTATEDIR/log]]], |
| 48 | LOGDIR=$withval) |
| 49 | if test ! -z "$LOGDIR"; then |
| 50 | if test "$LOGDIR" = "yes" -o "$LOGDIR" = "no"; then |
| 51 | AC_MSG_ERROR([--with-logdir must specify a path]) |
| 52 | fi |
| 53 | fi |
| 54 | AC_SUBST(LOGDIR) |
| 55 | |
| 56 | AC_ARG_WITH([examples], |
| 57 | [ --without-examples Disable build of examples], |
| 58 | [ENABLE_EXAMPLES="no"], |
| 59 | [ENABLE_EXAMPLES="yes"] |
| 60 | ) |
| 61 | AC_SUBST(ENABLE_EXAMPLES) |
| 62 | |
| 63 | AC_CONFIG_HEADER(config.h) |
| 64 | |
| 65 | EXTRA_OBJ="" |
| 66 | |
| 67 | #AC_CHECK_HEADERS(sched.h) |
| 68 | #AC_CHECK_FUNCS(mlockall) |
| 69 | |
| 70 | AC_CACHE_CHECK([for sin_len in sock],libnfs_cv_HAVE_SOCK_SIN_LEN,[ |
| 71 | AC_TRY_COMPILE([#include <sys/types.h> |
| 72 | #include <sys/socket.h> |
| 73 | #include <netinet/in.h>], |
| 74 | [struct sockaddr_in sock; sock.sin_len = sizeof(sock);], |
| 75 | libnfs_cv_HAVE_SOCK_SIN_LEN=yes,libnfs_cv_HAVE_SOCK_SIN_LEN=no)]) |
| 76 | if test x"$libnfs_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then |
| 77 | AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property]) |
| 78 | fi |
| 79 | AC_SUBST(libdir) |
| 80 | AC_SUBST(install) |
| 81 | AC_SUBST(ldconfig) |
| 82 | AC_SUBST(is_darwin) |
| 83 | #AC_SUBST(LIBNFS_LDFLAGS) |
| 84 | |
| 85 | AC_OUTPUT(Makefile) |