mirror of
https://github.com/fwbuilder/fwbuilder
synced 2025-10-16 23:47:46 +02:00
472 lines
12 KiB
Plaintext
472 lines
12 KiB
Plaintext
dnl $Id: configure.in 1046 2007-10-21 20:27:01Z vk $
|
|
|
|
AC_INIT(src/fwbuilder/FWObject.cpp)
|
|
|
|
AC_CANONICAL_SYSTEM
|
|
AC_CONFIG_HEADER(src/fwbuilder/libfwbuilder-config.h)
|
|
|
|
AC_PROG_INSTALL
|
|
|
|
dnl
|
|
dnl all version numbers are defined in the file VERSION
|
|
dnl
|
|
. ./VERSION
|
|
|
|
AC_SUBST(LIBMAJOR)
|
|
AC_SUBST(RELEASE_NUM)
|
|
AC_SUBST(LIBFWBUILDER_SO_VERSION)
|
|
AC_SUBST(LIBFWBUILDER_SOLIB_VERSION)
|
|
AC_SUBST(LIBFWBUILDER_VERSION)
|
|
AC_SUBST(LIBFWBUILDER_LIB_VER)
|
|
AC_SUBST(LIBFWBUILDER_SOLIB_SYMLINK1_VERSION)
|
|
AC_SUBST(LIBFWBUILDER_SOLIB_SYMLINK2_VERSION)
|
|
AC_SUBST(FWBUILDER_XML_VERSION)
|
|
|
|
if test -z ${RELEASE_NUM}; then
|
|
RPMRELEASE="1"
|
|
else
|
|
RPMRELEASE=${RELEASE_NUM};
|
|
fi
|
|
AC_SUBST(RPMRELEASE)
|
|
|
|
echo "Creating libfwbuilder-version.h file..."
|
|
|
|
echo "#define LIBFWBUILDER_VERSION \"$LIBFWBUILDER_VERSION\"" > src/fwbuilder/libfwbuilder-version.h
|
|
echo "#define LIBFWBUILDER_FORMAT_VERSION \"$FWBUILDER_XML_VERSION\"" >> src/fwbuilder/libfwbuilder-version.h
|
|
|
|
dnl try to find QT
|
|
dnl
|
|
AC_ARG_WITH(qtdir,[ --with-qtdir=DIR Specify directory path for QT ])
|
|
|
|
if test -n "$with_qtdir"; then
|
|
AC_MSG_CHECKING(Using QT in )
|
|
QTDIR="$with_qtdir";
|
|
export QTDIR
|
|
AC_MSG_RESULT($QTDIR)
|
|
fi
|
|
|
|
EXTENDED_PATH="/usr/local/bin:$PATH"
|
|
|
|
AC_ARG_WITH(qmake, [ --with-qmake=qmake Specify the qmake to be used (debian qmake-qt4) ])
|
|
if test -n "$with_qmake"; then
|
|
AC_PATH_PROG(QMAKE, $with_qmake, ,[$EXTENDED_PATH])
|
|
if test -z "$QMAKE"; then
|
|
AC_MSG_ERROR("Could not find qmake")
|
|
fi
|
|
else
|
|
AC_PATH_PROG(QMAKE, qmake, ,[$EXTENDED_PATH])
|
|
if test -z "$QMAKE"; then
|
|
AC_PATH_PROG(QMAKE, qmake-qt4, ,[$EXTENDED_PATH])
|
|
if test -z "$QMAKE"; then
|
|
AC_MSG_ERROR("Could not find qmake")
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
AC_MSG_CHECKING(checking version of QT this qmake is part of)
|
|
qmake_version=`$QMAKE -v 2>&1 | awk '/Using Qt version/ { print $4;}'`
|
|
case $qmake_version in
|
|
4*) AC_MSG_RESULT( $qmake_version ) ;;
|
|
*) AC_MSG_ERROR( $qmake_version ) ;;
|
|
esac
|
|
|
|
dnl
|
|
dnl we do not want to build .a libraries. We could supply "--disable-static" option
|
|
dnl to the call for configure, but it requires changes in the package configuration
|
|
dnl files for all OS and that is just too much to remember.
|
|
dnl
|
|
enable_static=no
|
|
|
|
LIBFWBUILDER_FORMAT_VERSION="${LIBFWBUILDER_VERSION}"
|
|
|
|
AC_DEFINE_UNQUOTED(LIBFWBUILDER_FORMAT_VERSION, "${LIBFWBUILDER_FORMAT_VERSION}")
|
|
|
|
AC_ARG_WITH(templatedir,[ --with-templatedir=DIR Specify directory path for libfwbuilder
|
|
template files ])
|
|
|
|
AC_ARG_WITH(docdir,[ --with-docdir=DIR Specify directory path for libfwbuilder
|
|
documentation files ])
|
|
|
|
AC_ARG_WITH(lwres, [ --with-lwres use lightweight resolver library (needs bind 9) (default is NO)])
|
|
|
|
AC_ISC_POSIX
|
|
AC_PROG_CC
|
|
AC_HEADER_STDC
|
|
AC_PROG_CPP
|
|
AC_PROG_CXX
|
|
AC_PROG_CXXCPP
|
|
|
|
AC_C_BIGENDIAN(AC_DEFINE(WORDS_BIGENDIAN),
|
|
AC_DEFINE(WORDS_LITTLEENDIAN),
|
|
AC_MSG_ERROR(Failed to determine endianness!!))
|
|
|
|
|
|
dnl standard LIBTOOL fragment
|
|
dnl
|
|
dnl AC_LIBTOOL_DLOPEN
|
|
dnl AC_PROG_LIBTOOL
|
|
dnl AC_SUBST(LIBTOOL_DEPS)
|
|
|
|
|
|
AC_PROG_MAKE_SET
|
|
|
|
LIBFWBUILDER_LIBDIR='-L${libdir}'
|
|
|
|
dnl some basic functions check
|
|
|
|
AC_CHECK_FUNCS(strtok_r)
|
|
AC_CHECK_HEADERS(endian.h)
|
|
AC_CHECK_HEADERS(getopt.h)
|
|
|
|
dnl Check for GNU make
|
|
dnl
|
|
AC_MSG_CHECKING(whether make is GNU Make)
|
|
if ${MAKE-make} -q --version 2>/dev/null | grep '^GNU Make ' >/dev/null ; then
|
|
AC_MSG_RESULT(yes)
|
|
else
|
|
AC_MSG_RESULT(no)
|
|
if test "$host_vendor" = "sun" ; then
|
|
AC_MSG_ERROR("SUN make does not work for building libfwbuilder. Please install GNU make")
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
dnl Some OS have stuff installed in various local directories
|
|
dnl
|
|
case "$build_os" in
|
|
freebsd*|openbsd*|solaris*)
|
|
CPPFLAGS="-I/usr/local/include ${CFLAGS}"
|
|
CFLAGS="-I/usr/local/include ${CFLAGS}"
|
|
LIBS="-L/usr/local/lib ${LIBS}"
|
|
;;
|
|
|
|
*darwin*)
|
|
if test -d /sw/include; then
|
|
CFLAGS="-I/sw/include ${CFLAGS}"
|
|
LDFLAGS="-flat_namespace"
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
|
|
dnl check for pthreads
|
|
ACX_PTHREAD([
|
|
#
|
|
# Somehow, standard macro tries -lpthreads, while pthread library really
|
|
# is "libpthread" on Linux. Thus only test using -pthread suceeds, but
|
|
# PTHREAD_LIBS macro ends up empty.
|
|
#
|
|
test -z "$PTHREAD_LIBS" && test "$PTHREAD_CFLAGS" = "-pthread" && PTHREAD_LIBS="-pthread"
|
|
|
|
echo "Found pthread library:"
|
|
echo "PTHREAD_CFLAGS="$PTHREAD_CFLAGS
|
|
echo "PTHREAD_LIBS="$PTHREAD_LIBS
|
|
|
|
] , [
|
|
AC_MSG_ERROR([POSIX threads library not present or not configured])
|
|
])
|
|
|
|
dnl check for XML library
|
|
|
|
AC_PATH_PROG(XML2_CONFIG, xml2-config, ,[$EXTENDED_PATH])
|
|
|
|
if test x$XML2_CONFIG = x ; then
|
|
AC_MSG_ERROR([libxml2 not present or not configured])
|
|
else
|
|
XML_CFLAGS="`$XML2_CONFIG --cflags`"
|
|
XML_LIBS="`$XML2_CONFIG --libs`"
|
|
fi
|
|
XML_CFLAGS=`echo $XML_CFLAGS | sed 's/-I\/usr\/include //'`
|
|
AC_SUBST(XML_CFLAGS)
|
|
AC_SUBST(XML_LIBS)
|
|
|
|
SAVE_LIBS=${LIBS}
|
|
LIBS="$XML_LIBS $LIBS"
|
|
AC_CHECK_FUNCS(xmlSaveFormatFileEnc)
|
|
LIBS=${SAVE_LIBS}
|
|
|
|
dnl check for XSLT library
|
|
|
|
AC_PATH_PROG(XSLT_CONFIG, xslt-config, ,[$EXTENDED_PATH])
|
|
|
|
if test x$XSLT_CONFIG = x ; then
|
|
AC_MSG_ERROR([libxslt not present or not configured])
|
|
else
|
|
XSLT_CFLAGS="`$XSLT_CONFIG --cflags`"
|
|
XSLT_LIBS="`$XSLT_CONFIG --libs`"
|
|
fi
|
|
XSLT_CFLAGS=`echo $XSLT_CFLAGS | sed 's/-I\/usr\/include //'`
|
|
|
|
dnl
|
|
dnl purely aestetical: xslt-config often reports the same flags as
|
|
dnl xml2-config
|
|
dnl
|
|
ac_xslt_var=""
|
|
for w in ${XSLT_CFLAGS}; do
|
|
case " ${XML_CFLAGS} " in
|
|
*\ $w\ *) ;;
|
|
*) ac_xslt_var="$ac_xslt_var $w" ;;
|
|
esac
|
|
done
|
|
XSLT_CFLAGS=$ac_xslt_var
|
|
|
|
ac_xslt_var=""
|
|
for w in ${XSLT_LIBS}; do
|
|
case " ${XML_LIBS} " in
|
|
*\ $w\ *) ;;
|
|
*) ac_xslt_var="$ac_xslt_var $w" ;;
|
|
esac
|
|
done
|
|
XSLT_LIBS=$ac_xslt_var
|
|
|
|
AC_SUBST(XSLT_CFLAGS)
|
|
AC_SUBST(XSLT_LIBS)
|
|
|
|
dnl libXslt header libxslt/xsltconfig.h only present in newew version of libxslt
|
|
dnl for instance it is not part of 1.0.1 but present in 1.0.7.
|
|
AC_CHECK_HEADERS(libxslt/xsltconfig.h)
|
|
|
|
dnl
|
|
dnl We also support "--with-ucdsnmp=no" and "--without-ucdsnmp"
|
|
dnl By default we assume user wants snmp support, provided script
|
|
dnl can find the library
|
|
dnl
|
|
dnl Just in case we support both --with-ucdsnmp and --with-ucd-snmp
|
|
dnl --vk
|
|
dnl
|
|
|
|
check_for_ucdsnmp=yes
|
|
if test x$with_ucdsnmp = xno ; then
|
|
check_for_ucdsnmp=no
|
|
fi
|
|
|
|
if test x$with_ucd_snmp = xno ; then
|
|
check_for_ucdsnmp=no
|
|
fi
|
|
|
|
if test $check_for_ucdsnmp = yes ; then
|
|
|
|
dnl
|
|
dnl net-snmp library includes script net-snmp-config which I use to determine cflags
|
|
dnl and libs. Unfortunately even if this script is there and is used flags,
|
|
dnl the program may still not link with the library. Currently having this problem on
|
|
dnl FreeBSD 4.7 - after upgrade of openssl, code using net-snmp stopped linking. That
|
|
dnl is why I still try to do linking test even if script is present.
|
|
dnl
|
|
dnl Testing for presence of includes and doing linking test assures that -devel
|
|
dnl package is indeed installed (primitive test program could link with libsnmp.so
|
|
dnl even if -devel package is not installed and headers are not there).
|
|
dnl
|
|
AC_PATH_PROG(NET_SNMP_CONFIG, net-snmp-config, ,[$EXTENDED_PATH])
|
|
if test x$NET_SNMP_CONFIG != x ; then
|
|
ac_LIBSNMP_LIBS="`$NET_SNMP_CONFIG --libs`"
|
|
ac_LIBSNMP_CFLAGS="`$NET_SNMP_CONFIG --cflags`"
|
|
AC_CHECK_LIB(netsnmp, init_snmp,
|
|
[
|
|
HAVE_LIBSNMP="1"
|
|
AC_DEFINE(HAVE_LIBSNMP)
|
|
NET_SNMP="1"
|
|
AC_DEFINE(NET_SNMP)
|
|
LIBSNMP_LIBS=$ac_LIBSNMP_LIBS
|
|
LIBSNMP_CFLAGS=$ac_LIBSNMP_CFLAGS
|
|
AC_CHECK_LIB(netsnmp, snprint_objid, [
|
|
AC_DEFINE(HAVE_SNPRINT_OBJID)
|
|
], ,$ac_LIBSNMP_LIBS)
|
|
], ,$ac_LIBSNMP_LIBS)
|
|
else
|
|
AC_CHECK_HEADERS([ucd-snmp/asn1.h], [
|
|
AC_CHECK_HEADER(ucd-snmp/snmp.h, [
|
|
AC_CHECK_LIBSNMP( snmp )
|
|
if test "Z$HAVE_LIBSNMP" != "Z"; then
|
|
UCD_SNMP="1"
|
|
AC_DEFINE(UCD_SNMP)
|
|
save_LIBS=$LIBS
|
|
LIBS="$LIBSNMP_LIBS $LIBS"
|
|
AC_CHECK_LIB(snmp, snprint_objid, [
|
|
AC_DEFINE(HAVE_SNPRINT_OBJID)
|
|
])
|
|
LIBS=$save_LIBS
|
|
fi
|
|
], ,[
|
|
#include <sys/types.h>
|
|
#include <ucd-snmp/asn1.h>
|
|
])
|
|
])
|
|
fi
|
|
|
|
LIBS="${LIBSNMP_LIBS} ${LIBS}"
|
|
|
|
fi
|
|
AC_SUBST(LIBSNMP_LIBS)
|
|
|
|
AC_CHECK_LIB(c, inet_net_ntop, [
|
|
AC_DEFINE_UNQUOTED(HAVE_INET_NET_NTOP, 1, [inet_net_ntop])
|
|
],[
|
|
AC_CHECK_LIB(bind, inet_net_ntop, [
|
|
AC_DEFINE_UNQUOTED(HAVE_INET_NET_NTOP, 1, [inet_net_ntop])
|
|
LIBS="-lbind $LIBS"
|
|
])
|
|
],[])
|
|
|
|
|
|
|
|
AC_LANG_CPLUSPLUS
|
|
|
|
|
|
|
|
dnl Check for bind specific headers and libraries
|
|
dnl if they are present, use them, rather than ones
|
|
dnl coming with libc.
|
|
|
|
AC_CHECK_HEADER(bind/resolv.h, [
|
|
CPPFLAGS="$CPPFLAGS -I/usr/include/bind"
|
|
HAVE_RESOLV_H=yes
|
|
] , [ AC_CHECK_HEADER(/usr/local/bind/include/resolv.h, [
|
|
CPPFLAGS="$CPPFLAGS -I/usr/local/bind/include/"
|
|
HAVE_RESOLV_H=yes
|
|
], [
|
|
AC_CHECK_HEADERS([resolv.h], [ HAVE_RESOLV_H=yes ], [], [
|
|
#include <sys/types.h>
|
|
#include <netinet/in.h>
|
|
] )
|
|
] )
|
|
], [
|
|
#include <netinet/in.h>
|
|
] )
|
|
|
|
LIB_RESOLV=""
|
|
HAVE_RES_NQUERY=""
|
|
AC_SUBST(LIB_RESOLV)
|
|
|
|
|
|
dnl
|
|
dnl prepare equivalents of *_CFLAGS variables for qmake
|
|
dnl qmake requires these to be without "-I"
|
|
dnl
|
|
XML_CFLAGS_Q=`echo ${XML_CFLAGS} | sed 's/-I//g'`
|
|
XSLT_CFLAGS_Q=`echo ${XSLT_CFLAGS} | sed 's/-I//g'`
|
|
PTHREAD_CFLAGS_Q=`echo ${PTHREAD_CFLAGS} | sed 's/-I//g'`
|
|
LIBS_Q=`echo ${LIBS} | sed 's/-I//g'`
|
|
|
|
AC_SUBST(XML_CFLAGS_Q)
|
|
AC_SUBST(XSLT_CFLAGS_Q)
|
|
AC_SUBST(PTHREAD_CFLAGS_Q)
|
|
AC_SUBST(LIBS_Q)
|
|
|
|
|
|
AC_ARG_WITH(stlport, [ --with-stlport use STLport library (default is NO)])
|
|
|
|
if test "X$with_stlport" = "Xyes" ; then
|
|
STL_CFLAGS="-nostdinc++ -I/usr/local/include/stlport -D_STLP_USE_STATIC_LIB"
|
|
STL_LIBS="${LIBS} /usr/local/lib/libstlport_gcc.a"
|
|
STL_LDFLAGS="-nodefaultlibs -lgcc"
|
|
fi
|
|
AC_SUBST(STL_CFLAGS)
|
|
AC_SUBST(STL_LIBS)
|
|
AC_SUBST(STL_LDFLAGS)
|
|
|
|
|
|
dnl AC_LANG_CPLUSPLUS
|
|
|
|
|
|
dnl
|
|
dnl Determine init dir and add definition to config.h
|
|
dnl
|
|
|
|
PREFIX=$ac_default_prefix
|
|
|
|
if test "x$prefix" != "xNONE"; then
|
|
PREFIX=$prefix
|
|
fi
|
|
|
|
dnl prefix has bogus value while building RPM. Since program
|
|
dnl should incrorporate full path to the templates directory into
|
|
dnl the code via config.h file, we need to keep track of
|
|
dnl this directory twice: TEMPLATE_DIR is what goes to config.h, while
|
|
dnl "install" Makefile targets will use $(prefix) to build install
|
|
dnl path
|
|
|
|
if test "x$with_templatedir" != "x"; then
|
|
TEMPLATE_DIR="${with_templatedir}"
|
|
else
|
|
TEMPLATE_DIR="${PREFIX}/share/libfwbuilder-${LIBFWBUILDER_VERSION}"
|
|
fi
|
|
AC_DEFINE_UNQUOTED(LIBFWBUILDER_TEMPLATE_DIR, "${TEMPLATE_DIR}")
|
|
AC_SUBST(TEMPLATE_DIR)
|
|
|
|
AC_DEFINE_UNQUOTED(VERSION, "$LIBFWBUILDER_VERSION")
|
|
|
|
AC_PATH_PROG(MD5, md5, ,[$EXTENDED_PATH])
|
|
if test x$MD5 = x ; then
|
|
AC_PATH_PROG(MD5, md5sum, ,[$EXTENDED_PATH])
|
|
fi
|
|
AC_SUBST(MD5)
|
|
|
|
|
|
|
|
dnl Check for doc++ which is used to build online API reference
|
|
|
|
AC_CHECK_PROG(DOCPP, doc++, doc++)
|
|
|
|
IS_WIN32_PLATFORM=no
|
|
|
|
case ${host} in
|
|
*-*-mingw32*)
|
|
IS_WIN32_PLATFORM=yes
|
|
;;
|
|
*-*-solaris*)
|
|
LIBFWBUILDER_LIBDIR="${LIBFWBUILDER_LIBDIR} -R${libdir}"
|
|
;;
|
|
esac
|
|
|
|
AC_SUBST(LIBFWBUILDER_LIBDIR)
|
|
AC_SUBST(IS_WIN32_PLATFORM)
|
|
|
|
AC_MSG_CHECKING(where to install documentation)
|
|
if test "x$with_docdir" != "x"; then
|
|
DOCDIR="${with_docdir}"
|
|
else
|
|
DOCDIR="${PREFIX}/share/doc/libfwbuilder-${LIBFWBUILDER_VERSION}"
|
|
fi
|
|
AC_MSG_RESULT($DOCDIR)
|
|
|
|
AC_SUBST(DOCDIR)
|
|
AC_DEFINE_UNQUOTED(DOCDIR, "${DOCDIR}")
|
|
|
|
AC_PATH_PROG(CCACHE, ccache, , )
|
|
|
|
|
|
|
|
|
|
|
|
# qmake does not understand syntax ${var}, but configure defines
|
|
# libdir as ${exec_prefix}/lib. Convert it to $$exec_prefix/lib for qmake
|
|
#
|
|
LIBDIR=`echo $libdir|sed 's/{//; s/}//; s/\\$/$$/'`
|
|
AC_SUBST(LIBDIR)
|
|
|
|
# the same goes for exec_prefix - configure defines it as '${prefix}'
|
|
# if it was not specified on the command line via --exec_prefix argument
|
|
# We do essentially the same thing as configure does, except use
|
|
# syntax qmake can understand.
|
|
#
|
|
EXEC_PREFIX="$exec_prefix"
|
|
if test "x$EXEC_PREFIX" = xNONE
|
|
then
|
|
EXEC_PREFIX='$$prefix'
|
|
else
|
|
EXEC_PREFIX=`echo $EXEC_PREFIX|sed 's/{//; s/}//; s/\\$/$$/'`
|
|
fi
|
|
AC_SUBST(EXEC_PREFIX)
|
|
|
|
AC_OUTPUT(qmake.inc
|
|
src/confscript/libfwbuilder-config-3
|
|
etc/fwbuilder.dtd )
|
|
|
|
dnl qmake just copies the file; we need to make it executable before that
|
|
dnl
|
|
chmod a+x src/confscript/libfwbuilder-config-3
|
|
|
|
QMAKE=$QMAKE CCACHE=$CCACHE ./runqmake.sh
|