From d7a1103e136b9cfeabb13f31d19b0f6eee3dbebb Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sun, 5 Dec 2010 13:31:11 +1100 Subject: [PATCH] Add initial autoconf support to make it easier to get ported to other platforms --- Makefile => Makefile.in | 0 autogen.sh | 15 +++++++++++ configure.ac | 60 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) rename Makefile => Makefile.in (100%) create mode 100755 autogen.sh create mode 100644 configure.ac diff --git a/Makefile b/Makefile.in similarity index 100% rename from Makefile rename to Makefile.in diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..7f086cd --- /dev/null +++ b/autogen.sh @@ -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 + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..c6cdd44 --- /dev/null +++ b/configure.ac @@ -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 +#include +#include ], +[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)