Merge pull request #3 from Memphiz/originalnfs2
[deb_libnfs.git] / configure.ac
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_ARG_WITH([ldconfig],
64 [ --without-ldconfig Disable call of ldconfig on make install],
65 [ldconfig='echo ldconfig disabled'])
66
67 AC_CONFIG_HEADER(config.h)
68
69 EXTRA_OBJ=""
70
71 #AC_CHECK_HEADERS(sched.h)
72 #AC_CHECK_FUNCS(mlockall)
73
74 AC_CACHE_CHECK([for sin_len in sock],libnfs_cv_HAVE_SOCK_SIN_LEN,[
75 AC_TRY_COMPILE([#include <sys/types.h>
76 #include <sys/socket.h>
77 #include <netinet/in.h>],
78 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
79 libnfs_cv_HAVE_SOCK_SIN_LEN=yes,libnfs_cv_HAVE_SOCK_SIN_LEN=no)])
80 if test x"$libnfs_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
81 AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property])
82 fi
83 AC_SUBST(libdir)
84 AC_SUBST(install)
85 AC_SUBST(ldconfig)
86 AC_SUBST(is_darwin)
87 #AC_SUBST(LIBNFS_LDFLAGS)
88
89 AC_OUTPUT(Makefile)