Add kFreeBSD support
[Samba.git] / ctdb / configure.ac
blob4fead5c199144c1e12a3b13f492aaddf568b50ab
1 AC_PREREQ(2.50)
2 AC_INIT(ctdb, m4_esyscmd([grep 'Version:' ./packaging/RPM/ctdb.spec 2>/dev/null | head -1 | sed -e 's/[ \t]*Version:[ \t]*\([^ \t]*\)[ \t]*.*/\1/' | tr -d '\n']))
3 AC_DEFUN([SMB_MODULE_DEFAULT], [echo -n ""])
4 AC_DEFUN([SMB_LIBRARY_ENABLE], [echo -n ""])
5 AC_DEFUN([SMB_EXT_LIB], [echo -n ""])
6 AC_DEFUN([SMB_ENABLE], [echo -n ""])
7 AC_CONFIG_SRCDIR([server/ctdbd.c])
9 if test "${libdir}" = '${exec_prefix}/lib'; then
10   case `uname -m` in
11     x86_64|ppc64|powerpc64)
12       libdir='${exec_prefix}/lib64'
13       ;;
14     *)
15       libdir='${exec_prefix}/lib'
16       ;;
17   esac
20 case `uname` in
21   Linux*)
22     CTDB_SYSTEM_OBJ=common/system_linux.o
23     CTDB_SCSI_IO=bin/scsi_io
24     CTDB_PCAP_LDFLAGS=
25     ;;
26   AIX*)
27     CTDB_SYSTEM_OBJ=common/system_aix.o
28     CTDB_SCSI_IO=
29     CTDB_PCAP_LDFLAGS=-lpcap
30     ;;
31   GNU/kFreeBSD)
32     CTDB_SYSTEM_OBJ=common/system_kfreebsd.o
33     CTDB_SCSI_IO=
34     CTDB_PCAP_LDFLAGS=-lpcap
35     ;;
36   GNU)
37     CTDB_SYSTEM_OBJ=common/system_gnu.o
38     CTDB_SCSI_IO=
39     CTDB_PCAP_LDFLAGS=-lpcap
40     ;;
41   *)
42     echo unknown system  cant configure
43     exit
44     ;;
45 esac
47 AC_LIBREPLACE_ALL_CHECKS
48 AC_LIBREPLACE_NETWORK_CHECKS
50 if test "$ac_cv_prog_gcc" = yes; then
51    CFLAGS="$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings"
54 LOGDIR='${localstatedir}/log'
55 AC_ARG_WITH([logdir],
56         [  --with-logdir=DIR       path to log directory [[LOCALSTATEDIR/log]]],
57         LOGDIR=$withval)
58 if test ! -z "$LOGDIR"; then
59   if test "$LOGDIR" = "yes" -o "$LOGDIR" = "no"; then
60     AC_MSG_ERROR([--with-logdir must specify a path])
61   fi
63 AC_SUBST(LOGDIR)
65 AC_CONFIG_HEADER(config.h)
67 EXTRA_OBJ=""
69 m4_include(libpopt.m4)
70 m4_include(libtalloc.m4)
71 m4_include(libtdb.m4)
72 m4_include(libtevent.m4)
73 m4_include(ib/config.m4)
74 m4_include(lib/util/signal.m4)
75 m4_include(lib/util/fault.m4)
76 m4_include(lib/socket_wrapper/config.m4)
78 AC_CHECK_HEADERS(sched.h)
79 AC_CHECK_HEADERS(pcp/pmapi.h pcp/impl.h pcp/pmda.h, [], [],
80 [[#ifdef HAVE_PCP_PMAPI_H
81 # include <pcp/pmapi.h>
82 #endif
83 #ifdef HAVE_PCP_IMPL_H
84 # include <pcp/impl.h>
85 #endif
86 ]])
88 AC_CHECK_FUNCS(sched_setscheduler)
89 AC_CHECK_FUNCS(mlockall)
91 AC_CACHE_CHECK([for sin_len in sock],ctdb_cv_HAVE_SOCK_SIN_LEN,[
92 AC_TRY_COMPILE([#include <sys/types.h>
93 #include <sys/socket.h>
94 #include <netinet/in.h>],
95 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
96 ctdb_cv_HAVE_SOCK_SIN_LEN=yes,ctdb_cv_HAVE_SOCK_SIN_LEN=no)])
97 if test x"$ctdb_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
98     AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property])
101 if test x"$ac_cv_header_pcp_pmda_h" = x"yes"; then
102     CTDB_PMDA=bin/pmdactdb
103     CTDB_PMDA_INSTALL=install_pmda
104 else
105     CTDB_PMDA=
106     CTDB_PMDA_INSTALL=
110 AC_SUBST(EXTRA_OBJ)
111 AC_SUBST(CTDB_SYSTEM_OBJ)
112 AC_SUBST(CTDB_SCSI_IO)
113 AC_SUBST(CTDB_PCAP_LDFLAGS)
114 AC_SUBST(CTDB_PMDA)
115 AC_SUBST(CTDB_PMDA_INSTALL)
117 AC_OUTPUT(Makefile ctdb.pc)