blob: e965e1222e92de4ed6d2da97949fac9e13e84c62 [file] [log] [blame]
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT([mod_netconf], [1.0])
AC_CONFIG_SRCDIR([mod_netconf.c])
# Checks for programs.
#AC_PROG_CC
AC_PROG_INSTALL
# Check for rpmbuil
AC_CHECK_PROG(RPMBUILD, rpmbuild, rpmbuild)
USERNAME=`git config --get user.name`
USERMAIL=`git config --get user.email`
AC_SUBST(USERNAME)
AC_SUBST(USERMAIL)
RELEASE=2
AC_SUBST(RELEASE)
LIBS="-lnetconf -ljson"
if test "`git show > /dev/null 2>&1;echo $?`" = "0"; then
RCSID="-DRCSID=\\\"\$(IDGIT)\\\""
ARCSID="-DARCSID='\\\"\$(IDGIT)\\\"'"
else
RCSID="-DRCSID=\\\"\$(IDNOGIT)\\\""
ARCSID="-DARCSID='\\\"\$(IDNOGIT)\\\"'"
fi
REQS="$REQS httpd json-c"
BUILDREQS="$BUILDREQS json-c-devel httpd-devel"
# Checks for libraries.
# libnetconf
AC_ARG_WITH([libnetconf],
AC_HELP_STRING([--with-libnetconf=PATH],[Set the path to libnetconf (usually local GIT repository)]),
[# local copy of libnetconf GIT repo with headers and binaries
LIBNETCONF_CFLAGS="-I`cd $withval;pwd`"
LIBNETCONF_LIBS="-L`cd $withval;pwd` -lnetconf"
LIBNETCONF_WITH=" --with-libnetconf=$withval"],
[# get info from pkg-config about installed package
PKG_CHECK_MODULES(LIBNETCONF, libnetconf)
BUILDREQS="$BUILDREQS libnetconf-devel"]
)
CFLAGS="$LIBNETCONF_CFLAGS"
LIBS="$LIBS $LIBNETCONF_LIBS"
AC_SUBST([LIBNETCONF_LIBS])
AC_SUBST([LIBNETCONF_CFLAGS])
AC_SUBST([LIBNETCONF_WITH])
REQS="$REQS libnetconf"
AC_CHECK_LIB([netconf], [ncds_new],[],AC_MSG_ERROR([libnetconf not found.]))
# Checks for header files.
AC_CHECK_HEADER([libnetconf.h], ,AC_MSG_ERROR([libnetconf.h not found!]))
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_SUBST(RPMBUILD)
if test -z "$RPMBUILD"; then
AC_MSG_WARN([Due to missing rpmbuild you will not able to generate RPM package.])
fi
AC_ARG_WITH([notifications],
[AC_HELP_STRING([--without-notifications], [Disable notifications])],
AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"],
[ CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS "
LIBS="-lwebsockets $LIBS"
REQS="$REQS libwebsockets"
BUILDREQS="$BUILDREQS libwebsockets-devel"
]),
[
CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS "
LIBS="-lwebsockets $LIBS"
REQS="$REQS libwebsockets"
BUILDREQS="$BUILDREQS libwebsockets-devel"
]
)
AC_ARG_WITH([notifport],
[AC_HELP_STRING([--with-notifport=PORT], [Set TCP port of websocket notification server.])],
[CFLAGS="$CFLAGS -DNOTIFICATION_SERVER_PORT=$with_notifport"],
[CFLAGS="$CFLAGS"]
)
CFLAGS="$CFLAGS -I/usr/include/json"
AC_SUBST(REQS)
AC_SUBST(BUILDREQS)
AC_SUBST(CFLAGS)
AC_SUBST(RCSID)
AC_SUBST(ARCSID)
AC_SUBST(LIBS)
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([mod_netconf.spec])
AC_OUTPUT