dnl dnl dnl ProLinga-Web dnl dnl Copyright (C) 2002-2009 Xobas Software. dnl All rights reserved. dnl dnl This file is part of ProLinga-Web. dnl dnl ProLinga-Web is free software: you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation, either version 3 of the License, or dnl (at your option) any later version. dnl dnl ProLinga-Web is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with ProLinga-Web. If not, see . dnl dnl More information is available at the following addresses: dnl dnl Website : http://www.prolinga.org dnl dnl Email : prolinga-list@prolinga.org dnl dnl dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.57) AC_INIT(ProLinga-Web,0.0.3,prolinga-list@prolinga.org,prolinga-web) AC_CONFIG_SRCDIR(src/WebCgi.cpp) AC_CONFIG_AUX_DIR(config) AC_CONFIG_MACRO_DIR([m4]) AC_LANG(C++) AM_CONFIG_HEADER(src/config.h:src/config-h.in) AM_INIT_AUTOMAKE dnl set host/node name HOST_NODE_NAME=`(hostname || uname -n) 2>/dev/null | sed 1q` AC_SUBST(HOST_NODE_NAME) dnl set home dir HOME_DIR=`echo $HOME` AC_SUBST(HOME_DIR) dnl set required 3rd party versions PKG_CONFIG_REQUIRED_VERSION=0.7.0 LIBXML_REQUIRED_VERSION=2.6.5 LIBXSLT_REQUIRED_VERSION=1.0.33 PROLINGASOAP_PACKAGE="prolinga-soapclient" PROLINGASOAP_REQUIRED_VERSION=0.0.1 FASTCGI_REQUIRED_VERSION=2.40.0 PROLINGARUN_PACKAGE="prolinga-run" PROLINGARUN_REQUIRED_VERSION=0.0.1 dnl Set default pkg search path PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/lib64/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig" dnl Enable debugging mode AC_ARG_ENABLE(debug, [ --enable-debug Enable debug messages], CFLAGS="$CFLAGS -DDEBUG -O0 -g" CXXFLAGS="$CFLAGS -DDEBUG -O0 -g") AC_ARG_ENABLE(gprof, [ --enable-gprof Enable profiling with gprof], CFLAGS="$CFLAGS -pg" CXXFLAGS="$CFLAGS -pg" LDFLAGS="$LDFLAGS -pg" ) dnl Enable stripped and optimized release builds AC_ARG_ENABLE(final, [ --enable-final Build release executables (GCC only)], if test "x$GCC" != xyes; then CFLAGS="$CFLAGS -DNDEBUG -Os -s -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS" CXXFLAGS="$CXXFLAGS -DNDEBUG -Os -s -fno-exceptions -fno-check-new -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS" fi) dnl Enable compiler warnings AC_ARG_ENABLE(warnings, [ --enable-warnings Enable compiler warnings (GCC only)], if test "x$GCC" != xyes; then CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wmissing-declarations -Wparentheses -Wpointer-arith" CXXFLAGS="$CXXFLAGS -Wall -Wparentheses -Wpointer-arith" fi) dnl Enable local run AC_ARG_ENABLE(local-run, [ --enable-local-run Enable local run by linking with prolinga-run], ENABLE_LOCAL_RUN="yes") dnl Checks for programs. AC_PROG_CC AC_PROG_CPP AC_PROG_CXX AC_PROG_CXXCPP AC_PROG_INSTALL dnl AC_PROG_RANLIB AC_PROG_LIBTOOL dnl Checks for libraries. dnl Checks for header files. AC_HEADER_STDC dnl Checks for typedefs, structures and compiler characteristics. AC_C_CONST dnl Checks for library functions. AC_FUNC_MALLOC AC_FUNC_REALLOC AC_CHECK_FUNCS(strcasecmp strchr strdup) dnl dnl Check 3rd party products dnl dnl dnl If pkg-config available use it, otherwise ignore dnl Not sure how widely accepted/available pkg-config is dnl AC_PATH_PROG(PKG_CONFIG, pkg-config, no) dnl test if pkg-config is available and if so if correct version if test "x$PKG_CONFIG" = "xno" then AC_MSG_NOTICE([Could not find pkg-config anywhere (optional). It is recommended to have pkg-config available for library compile/link flag detections during configure. Check http://www.freedesktop.org/software/pkgconfig/ for details.]) else AC_MSG_CHECKING(for pkg-config >= $PKG_CONFIG_REQUIRED_VERSION) if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_REQUIRED_VERSION then AC_MSG_RESULT(yes) else PKG_CONFIG_VERS=`$PKG_CONFIG --version` AC_MSG_RESULT(Version $PKG_CONFIG_VERS found. You need at least pkg-config $PKG_CONFIG_REQUIRED_VERSION for this version of ProLinga-Web) PKG_CONFIG="no" fi fi dnl dnl specify location of libxml2 dnl LIBXML_CONFIG_PREFIX="" LIBXML_CFLAGS="" LIBXML_LIBS="" AC_ARG_WITH(libxml-prefix, [ --with-libxml-prefix=[PFX] Specify location of libxml config], LIBXML_CONFIG_PREFIX=$withval ) AC_ARG_WITH(libxml-include-prefix, [ --with-libxml-include-prefix=[PFX] Specify location of libxml headers], LIBXML_CFLAGS="-I$withval" ) AC_ARG_WITH(libxml-libs-prefix, [ --with-libxml-libs-prefix=[PFX] Specify location of libxml libs], LIBXML_LIBS="-L$withval" ) dnl where is xml2-config AC_SUBST(LIBXML_REQUIRED_VERSION) AC_MSG_CHECKING(for libxml libraries >= $LIBXML_REQUIRED_VERSION) if test "x$LIBXML_CONFIG_PREFIX" != "x" then XML_CONFIG=${LIBXML_CONFIG_PREFIX}/bin/xml2-config else XML_CONFIG=xml2-config fi dnl check version number AC_DEFUN([VERSION_TO_NUMBER], [`$1 | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`]) if ${XML_CONFIG} --libs print > /dev/null 2>&1 then XMLVERS=`$XML_CONFIG --version` if test VERSION_TO_NUMBER(echo $XMLVERS) -ge VERSION_TO_NUMBER(echo $LIBXML_REQUIRED_VERSION) then LIBXML_LIBS="$LIBXML_LIBS `$XML_CONFIG --libs`" LIBXML_CFLAGS="$LIBXML_CFLAGS `$XML_CONFIG --cflags`" AC_MSG_RESULT($XMLVERS found) else AC_MSG_ERROR(Version $XMLVERS found. You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of ProLinga-Web) fi else AC_MSG_ERROR([Could not find libxml2 anywhere, check http://xmlsoft.org/.]) fi AC_SUBST(XML_CONFIG) AC_SUBST(LIBXML_LIBS) AC_SUBST(LIBXML_CFLAGS) dnl dnl specify location of libxslt dnl LIBXSLT_CONFIG_PREFIX="" LIBXSLT_CFLAGS="" LIBXSLT_LIBS="" AC_ARG_WITH(libxslt-prefix, [ --with-libxslt-prefix=[PFX] Specify location of libxslt config], LIBXSLT_CONFIG_PREFIX=$withval ) AC_ARG_WITH(libxslt-include-prefix, [ --with-libxslt-include-prefix=[PFX] Specify location of libxslt headers], LIBXSLT_CFLAGS="-I$withval" ) AC_ARG_WITH(libxslt-libs-prefix, [ --with-libxslt-libs-prefix=[PFX] Specify location of libxslt libs], LIBXSLT_LIBS="-L$withval" ) dnl where is xslt-config AC_SUBST(LIBXSLT_REQUIRED_VERSION) AC_MSG_CHECKING(for libxslt libraries >= $LIBXSLT_REQUIRED_VERSION) if test "x$LIBXSLT_CONFIG_PREFIX" != "x" then XSLT_CONFIG=${LIBXSLT_CONFIG_PREFIX}/bin/xslt-config else XSLT_CONFIG=xslt-config fi dnl check version number AC_DEFUN([VERSION_TO_NUMBER], [`$1 | sed -e 's/libxslt //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`]) if ${XSLT_CONFIG} --libs print > /dev/null 2>&1 then XSLTVERS=`$XSLT_CONFIG --version` if test VERSION_TO_NUMBER(echo $XSLTVERS) -ge VERSION_TO_NUMBER(echo $LIBXSLT_REQUIRED_VERSION) then LIBXSLT_LIBS="$LIBXSLT_LIBS `$XSLT_CONFIG --libs`" LIBXSLT_CFLAGS="$LIBXSLT_CFLAGS `$XSLT_CONFIG --cflags`" AC_MSG_RESULT($XSLTVERS found) else AC_MSG_ERROR(Version $XSLTVERS found. You need at least libxslt $LIBXSLT_REQUIRED_VERSION for this version of ProLinga-Web) fi else AC_MSG_ERROR([Could not find libxslt anywhere, check http://xmlsoft.org/.]) fi AC_SUBST(XSLT_CONFIG) AC_SUBST(LIBXSLT_LIBS) AC_SUBST(LIBXSLT_CFLAGS) dnl dnl Optional location of ProLinga-Soap dnl PROLINGASOAP_PREFIX="" PROLINGASOAP_CXXFLAGS="" PROLINGASOAP_LIBS="" dnl dnl specify location of ProLinga-Soap dnl AC_ARG_WITH(prolingasoap-prefix, [ --with-prolingasoap-prefix=[PFX] Specify location of ProLinga-Soap], PROLINGASOAP_PREFIX=$withval ) AC_ARG_WITH(prolingasoap-include-prefix, [ --with-prolingasoap-include-prefix=[PFX] Specify location of ProLinga-Soap headers], PROLINGASOAP_CXXFLAGS="-I$withval" ) AC_ARG_WITH(prolingasoap-libs-prefix, [ --with-prolingasoap-libs-prefix=[PFX] Specify location of ProLinga-Soap libs], PROLINGASOAP_LIBS="-L$withval" ) dnl dnl use pkg-config if available dnl if test "x$PKG_CONFIG" != "xno" then dnl use pkg-config for version check and compile/link flag detection. AC_MSG_CHECKING(for ProLinga-Soap libraries >= $PROLINGASOAP_REQUIRED_VERSION) dnl create pkg-config search path PKG_CONFIG_SEARCH="/usr/lib64/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig" if test $PROLINGASOAP_PREFIX then PKG_CONFIG_SEARCH="$PROLINGASOAP_PREFIX/lib64/pkgconfig:$PROLINGASOAP_PREFIX/lib/pkgconfig:$PKG_CONFIG_SEARCH" fi if test $PROLINGASOAP_LIBS then SEARCH_LIB=`echo $PROLINGASOAP_LIBS | sed -e 's/-L//'` PKG_CONFIG_SEARCH="$PKG_CONFIG_SEARCH:$SEARCH_LIB/pkgconfig" fi dnl check version PKG_CONFIG_PATH="$PKG_CONFIG_SEARCH:$PKG_CONFIG_PATH" if `export PKG_CONFIG_PATH; $PKG_CONFIG --modversion $PROLINGASOAP_PACKAGE >/dev/null 2>&1` then SOAPVERS=`export PKG_CONFIG_PATH; $PKG_CONFIG --modversion $PROLINGASOAP_PACKAGE` if `export PKG_CONFIG_PATH; $PKG_CONFIG --atleast-version=$PROLINGASOAP_REQUIRED_VERSION $PROLINGASOAP_PACKAGE` then PROLINGASOAP_CXXFLAGS="$PROLINGASOAP_CXXFLAGS `export PKG_CONFIG_PATH; $PKG_CONFIG --cflags $PROLINGASOAP_PACKAGE`" PROLINGASOAP_LIBS="$PROLINGASOAP_LIBS `export PKG_CONFIG_PATH; $PKG_CONFIG --libs $PROLINGASOAP_PACKAGE`" AC_MSG_RESULT($SOAPVERS found) else AC_MSG_ERROR(Version $SOAPVERS found. You need at least ProLinga-Soap $PROLINGASOAP_REQUIRED_VERSION for this version of ProLinga-Web) fi else AC_MSG_ERROR([Could not find ProLinga-Soap anywhere, check http://www.prolinga.org/.]) fi else dnl check if libraries are there AC_MSG_CHECKING(for ProLinga-Soap libraries ) if test -f `echo $PROLINGASOAP_LIBS | sed -e 's/-L//'`/libprolingasoapclient.la || test -f $PROLINGASOAP_PREFIX/lib/libprolingasoapclient.la \ || test -f /usr/lib64/libprolingasoapclient.la || test -f /usr/local/lib64/libprolingasoapclient.la \ || test -f /usr/lib/libprolingasoapclient.la || test -f /usr/local/lib/libprolingasoapclient.la then AC_MSG_RESULT(found) else AC_MSG_ERROR([Could not find ProLinga-Soap anywhere, check http://www.prolinga.org/.]) fi if test $PROLINGASOAP_PREFIX then PROLINGASOAP_CXXFLAGS="$PROLINGASOAP_CXXFLAGS -I$PROLINGASOAP_PREFIX/include" PROLINGASOAP_LIBS="$PROLINGASOAP_LIBS -L$PROLINGASOAP_PREFIX/lib -lprolingasoapclient" fi fi dnl export values AC_SUBST(PROLINGASOAP_LIBS) AC_SUBST(PROLINGASOAP_CXXFLAGS) dnl dnl Optional location of ProLinga-Run dnl PROLINGARUN_PREFIX="" PROLINGARUN_CXXFLAGS="" PROLINGARUN_LIBS="" if test "x$ENABLE_LOCAL_RUN" = xyes then dnl dnl specify location of ProLinga-Run dnl AC_ARG_WITH(prolingarun-prefix, [ --with-prolingarun-prefix=[PFX] Specify location of ProLinga-Run (Required for local run-engine)], PROLINGARUN_PREFIX=$withval ) AC_ARG_WITH(prolingarun-include-prefix, [ --with-prolingarun-include-prefix=[PFX] Specify location of ProLinga-Run headers (Required for local run-engine)], PROLINGARUN_CXXFLAGS="-I$withval" ) AC_ARG_WITH(prolingarun-libs-prefix, [ --with-prolingarun-libs-prefix=[PFX] Specify location of ProLinga-Run libs (Required for local run-engine)], PROLINGADATA_LIBS="-L$withval" ) dnl dnl use pkg-config if available dnl if test "x$PKG_CONFIG" != "xno" then dnl use pkg-config for version check and compile/link flag detection. AC_MSG_CHECKING(for ProLinga-Run libraries >= $PROLINGARUN_REQUIRED_VERSION) dnl create pkg-config search path PKG_CONFIG_SEARCH="/usr/lib64/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig" if test $PROLINGARUN_PREFIX then PKG_CONFIG_SEARCH="$PROLINGARUN_PREFIX/lib64/pkgconfig:$PROLINGARUN_PREFIX/lib/pkgconfig:$PKG_CONFIG_SEARCH" fi if test $PROLINGARUN_LIBS then SEARCH_LIB=`echo $PROLINGARUN_LIBS | sed -e 's/-L//'` PKG_CONFIG_SEARCH="$PKG_CONFIG_SEARCH:$SEARCH_LIB/pkgconfig" fi PKG_CONFIG_PATH="$PKG_CONFIG_SEARCH:$PKG_CONFIG_PATH" dnl check version if `export PKG_CONFIG_PATH; $PKG_CONFIG --modversion $PROLINGARUN_PACKAGE >/dev/null 2>&1` then RUNVERS=`export PKG_CONFIG_PATH; $PKG_CONFIG --modversion $PROLINGARUN_PACKAGE` if `export PKG_CONFIG_PATH; $PKG_CONFIG --atleast-version=$PROLINGARUN_REQUIRED_VERSION $PROLINGARUN_PACKAGE` then PROLINGARUN_CXXFLAGS="$PROLINGARUN_CXXFLAGS `export PKG_CONFIG_PATH; $PKG_CONFIG --cflags $PROLINGARUN_PACKAGE`" PROLINGARUN_LIBS="$PROLINGARUN_LIBS `export PKG_CONFIG_PATH; $PKG_CONFIG --libs $PROLINGARUN_PACKAGE`" AC_MSG_RESULT($RUNVERS found) else AC_MSG_ERROR(Version $RUNVERS found. You need at least ProLinga-Run $PROLINGARUN_REQUIRED_VERSION for this version of ProLinga-Web) fi else `export PKG_CONFIG_PATH; $PKG_CONFIG --modversion $PROLINGARUN_PACKAGE` AC_MSG_ERROR([Could not find ProLinga-Run or one of its dependencies. Check that PKG_CONFIG_PATH contains the correct package settings. Check http://www.prolinga.org/ for more info.]) fi else dnl check if libraries are there AC_MSG_CHECKING(for ProLinga-Run libraries ) if test -f `echo $PROLINGARUN_LIBS | sed -e 's/-L//'`/libprolingarun.la || test -f $PROLINGARUN_PREFIX/lib/libprolingarun.la \ || test -f /usr/lib64/libprolingarun.la || test -f /usr/local/lib64/libprolingarun.la \ || test -f /usr/lib/libprolingarun.la || test -f /usr/local/lib/libprolingarun.la then AC_MSG_RESULT(found) else AC_MSG_ERROR([Could not find ProLinga-Run anywhere, check http://www.prolinga.org/.]) fi if test $PROLINGARUN_PREFIX then PROLINGARUN_CXXFLAGS="$PROLINGARUN_CXXFLAGS -I$PROLINGARUN_PREFIX/include" PROLINGARUN_LIBS="$PROLINGARUN_LIBS -L$PROLINGARUN_PREFIX/lib" fi fi DEFINE_BUILD_RUN="-DBUILD_RUN" AC_SUBST(DEFINE_BUILD_RUN) fi dnl export values AC_SUBST(PROLINGARUN_LIBS) AC_SUBST(PROLINGARUN_CXXFLAGS) dnl dnl specify location of FastCGI dnl FASTCGI_PREFIX="" FASTCGI_CXXFLAGS="" FASTCGI_LIBS="" BUILD_FASTCGI="no" dnl Check if to build FastCGI or Traditional CGI. AC_ARG_ENABLE(fastcgi, [ --disable-fastcgi build Traditional rather than Fast CGI executables], BUILD_FASTCGI="no") if test "x$BUILD_FASTCGI" == "xyes" then AC_ARG_WITH(fastcgi-prefix, [ --with-fastcgi-prefix=[PFX] Specify location of FastCGI], FASTCGI_PREFIX=$withval ) AC_ARG_WITH(fastcgi-include-prefix, [ --with-fastcgi-include-prefix=[PFX] Specify location of FastCGI headers], FASTCGI_CXXFLAGS="-I$withval" ) AC_ARG_WITH(fastcgi-libs-prefix, [ --with-fastcgi-libs-prefix=[PFX] Specify location of FastCGI libs], FASTCGI_LIBS="-L$withval" ) dnl check if libraries are there AC_MSG_CHECKING(for FastCGI libraries ) if test -f `echo $FASTCGI_LIBS | sed -e 's/-L//'`/libfcgi.la || test -f $FASTCGI_PREFIX/lib/libfcgi.la \ || test -f /usr/lib64/libfcgi.la || test -f /usr/local/lib64/libfcgi.la \ || test -f /usr/lib/libfcgi.la || test -f /usr/local/lib/libfcgi.la then AC_MSG_RESULT(found) else AC_MSG_ERROR([Could not find FastCGI anywhere, check http://www.fastcgi.com/.]) fi if test $FASTCGI_PREFIX then FASTCGI_CXXFLAGS="$FASTCGI_CXXFLAGS -I$FASTCGI_PREFIX/include" FASTCGI_LIBS="$FASTCGI_LIBS -L$FASTCGI_PREFIX/lib -lfcgi" fi DEFINE_BUILD_FASTCGI="-DBUILD_FASTCGI" AC_SUBST(DEFINE_BUILD_FASTCGI) fi dnl export values AC_SUBST(FASTCGI_LIBS) AC_SUBST(FASTCGI_CXXFLAGS) dnl set output AC_OUTPUT(Makefile html/Makefile src/Makefile prolinga/prolingawebsvc.xml prolinga/Makefile doc/Makefile doc/version.txt)