| 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 | install="/usr/bin/install" |
| 18 | ldconfig="ldconfig" |
| 19 | |
| 20 | case `uname` in |
| 21 | Linux*) |
| 22 | ;; |
| 23 | AIX*) |
| 24 | ;; |
| 25 | SunOS) |
| 26 | is_solaris="yes" |
| 27 | install="ginstall" |
| 28 | ldconfig="echo no ldconfig on solaris" |
| 29 | LIBS="$LIBS -lsocket -lnsl" |
| 30 | ;; |
| 31 | *) |
| 32 | ;; |
| 33 | esac |
| 34 | |
| 35 | if test "$ac_cv_prog_gcc" = yes; then |
| 36 | CFLAGS="$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings" |
| 37 | fi |
| 38 | |
| 39 | LOGDIR='${localstatedir}/log' |
| 40 | AC_ARG_WITH([logdir], |
| 41 | [ --with-logdir=DIR path to log directory [[LOCALSTATEDIR/log]]], |
| 42 | LOGDIR=$withval) |
| 43 | if test ! -z "$LOGDIR"; then |
| 44 | if test "$LOGDIR" = "yes" -o "$LOGDIR" = "no"; then |
| 45 | AC_MSG_ERROR([--with-logdir must specify a path]) |
| 46 | fi |
| 47 | fi |
| 48 | AC_SUBST(LOGDIR) |
| 49 | |
| 50 | AC_CONFIG_HEADER(config.h) |
| 51 | |
| 52 | EXTRA_OBJ="" |
| 53 | |
| 54 | #AC_CHECK_HEADERS(sched.h) |
| 55 | #AC_CHECK_FUNCS(mlockall) |
| 56 | |
| 57 | AC_CACHE_CHECK([for sin_len in sock],libnfs_cv_HAVE_SOCK_SIN_LEN,[ |
| 58 | AC_TRY_COMPILE([#include <sys/types.h> |
| 59 | #include <sys/socket.h> |
| 60 | #include <netinet/in.h>], |
| 61 | [struct sockaddr_in sock; sock.sin_len = sizeof(sock);], |
| 62 | libnfs_cv_HAVE_SOCK_SIN_LEN=yes,libnfs_cv_HAVE_SOCK_SIN_LEN=no)]) |
| 63 | if test x"$libnfs_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then |
| 64 | AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property]) |
| 65 | fi |
| 66 | |
| 67 | AC_MSG_CHECKING(whether libpopt is available) |
| 68 | ac_save_CFLAGS="$CFLAGS" |
| 69 | ac_save_LIBS="$LIBS" |
| 70 | CFLAGS="$CFLAGS $GLIB_CFLAGS" |
| 71 | LIBS="$GLIB_LIBS $LIBS -lpopt" |
| 72 | AC_TRY_RUN([ |
| 73 | /* |
| 74 | * Just see if we can compile/link with popt |
| 75 | */ |
| 76 | #include <popt.h> |
| 77 | |
| 78 | int main(int argc, const char *argv[]) |
| 79 | { |
| 80 | struct poptOption popt_options[] = { |
| 81 | POPT_TABLEEND |
| 82 | }; |
| 83 | poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST); |
| 84 | |
| 85 | return 0; |
| 86 | } |
| 87 | ], ac_cv_have_popt=yes, ac_cv_have_popt=no, |
| 88 | [echo $ac_n "compile with POPT. Assuming OK... $ac_c" |
| 89 | ac_cv_have_popt=yes]) |
| 90 | CFLAGS="$ac_save_CFLAGS" |
| 91 | LIBS="$ac_save_LIBS" |
| 92 | if test "$ac_cv_have_popt" = yes ; then |
| 93 | AC_MSG_RESULT(yes) |
| 94 | else |
| 95 | AC_MSG_RESULT(no) |
| 96 | AC_MSG_NOTICE(You need libpopt to compile libnfs. Install the libpopt-dev package.) |
| 97 | exit |
| 98 | fi |
| 99 | |
| 100 | AC_SUBST(libdir) |
| 101 | AC_SUBST(install) |
| 102 | AC_SUBST(ldconfig) |
| 103 | #AC_SUBST(LIBNFS_LDFLAGS) |
| 104 | |
| 105 | AC_OUTPUT(Makefile) |