Add initial autoconf support to make it easier to get ported to

other platforms
This commit is contained in:
Ronnie Sahlberg
2010-12-05 13:31:11 +11:00
parent 709d85c4da
commit d7a1103e13
3 changed files with 75 additions and 0 deletions

15
autogen.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
rm -rf autom4te.cache
rm -f configure config.h.in ctdb.pc
IPATHS="-I ./include -I ../include"
autoheader $IPATHS || exit 1
autoconf $IPATHS || exit 1
rm -rf autom4te.cache
echo "Now run ./configure and then make."
exit 0

60
configure.ac Normal file
View File

@@ -0,0 +1,60 @@
AC_PREREQ(2.50)
AC_INIT(libiscsi, m4_esyscmd([grep 'Version:' ./packaging/RPM/libiscsi.spec.in 2>/dev/null | head -1 | sed -e 's/[ \t]*Version:[ \t]*\([^ \t]*\)[ \t]*.*/\1/' | tr -d '\n']))
AC_CONFIG_SRCDIR([lib/init.c])
if test "${libdir}" = '${exec_prefix}/lib'; then
case `uname -m` in
x86_64|ppc64|powerpc64)
libdir='${exec_prefix}/lib64'
;;
*)
libdir='${exec_prefix}/lib'
;;
esac
fi
case `uname` in
Linux*)
;;
AIX*)
;;
*)
;;
esac
if test "$ac_cv_prog_gcc" = yes; then
CFLAGS="$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings"
fi
LOGDIR='${localstatedir}/log'
AC_ARG_WITH([logdir],
[ --with-logdir=DIR path to log directory [[LOCALSTATEDIR/log]]],
LOGDIR=$withval)
if test ! -z "$LOGDIR"; then
if test "$LOGDIR" = "yes" -o "$LOGDIR" = "no"; then
AC_MSG_ERROR([--with-logdir must specify a path])
fi
fi
AC_SUBST(LOGDIR)
AC_CONFIG_HEADER(config.h)
EXTRA_OBJ=""
#AC_CHECK_HEADERS(sched.h)
#AC_CHECK_FUNCS(mlockall)
AC_CACHE_CHECK([for sin_len in sock],libiscsi_cv_HAVE_SOCK_SIN_LEN,[
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>],
[struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
libiscsi_cv_HAVE_SOCK_SIN_LEN=yes,libiscsi_cv_HAVE_SOCK_SIN_LEN=no)])
if test x"$libiscsi_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property])
fi
AC_SUBST(EXTRA_OBJ)
#AC_SUBST(LIBISCSI_LDFLAGS)
AC_OUTPUT(Makefile)