initial libnfs checkin
[deb_libnfs.git] / configure.ac
CommitLineData
84004dbf
RS
1AC_PREREQ(2.50)
2AC_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']))
3AC_CONFIG_SRCDIR([lib/init.c])
4
5if 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
14fi
15
16is_solaris="no"
17install="/usr/bin/install"
18ldconfig="ldconfig"
19
20case `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 ;;
33esac
34
35if test "$ac_cv_prog_gcc" = yes; then
36 CFLAGS="$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings"
37fi
38
39LOGDIR='${localstatedir}/log'
40AC_ARG_WITH([logdir],
41 [ --with-logdir=DIR path to log directory [[LOCALSTATEDIR/log]]],
42 LOGDIR=$withval)
43if 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
47fi
48AC_SUBST(LOGDIR)
49
50AC_CONFIG_HEADER(config.h)
51
52EXTRA_OBJ=""
53
54#AC_CHECK_HEADERS(sched.h)
55#AC_CHECK_FUNCS(mlockall)
56
57AC_CACHE_CHECK([for sin_len in sock],libnfs_cv_HAVE_SOCK_SIN_LEN,[
58AC_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);],
62libnfs_cv_HAVE_SOCK_SIN_LEN=yes,libnfs_cv_HAVE_SOCK_SIN_LEN=no)])
63if 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])
65fi
66
67AC_MSG_CHECKING(whether libpopt is available)
68ac_save_CFLAGS="$CFLAGS"
69ac_save_LIBS="$LIBS"
70CFLAGS="$CFLAGS $GLIB_CFLAGS"
71LIBS="$GLIB_LIBS $LIBS -lpopt"
72AC_TRY_RUN([
73/*
74 * Just see if we can compile/link with popt
75 */
76#include <popt.h>
77
78int 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])
90CFLAGS="$ac_save_CFLAGS"
91LIBS="$ac_save_LIBS"
92if test "$ac_cv_have_popt" = yes ; then
93 AC_MSG_RESULT(yes)
94else
95 AC_MSG_RESULT(no)
96 AC_MSG_NOTICE(You need libpopt to compile libnfs. Install the libpopt-dev package.)
97 exit
98fi
99
100AC_SUBST(libdir)
101AC_SUBST(install)
102AC_SUBST(ldconfig)
103#AC_SUBST(LIBNFS_LDFLAGS)
104
105AC_OUTPUT(Makefile)