blob: e965e1222e92de4ed6d2da97949fac9e13e84c62 [file] [log] [blame]
Tomas Cejka96f4e612012-12-10 00:03:32 +01001# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.63])
5AC_INIT([mod_netconf], [1.0])
6AC_CONFIG_SRCDIR([mod_netconf.c])
7
8# Checks for programs.
9#AC_PROG_CC
10AC_PROG_INSTALL
11
12# Check for rpmbuil
13AC_CHECK_PROG(RPMBUILD, rpmbuild, rpmbuild)
14
Tomas Cejkab4cd6dc2013-07-05 11:08:57 +020015USERNAME=`git config --get user.name`
16USERMAIL=`git config --get user.email`
17AC_SUBST(USERNAME)
18AC_SUBST(USERMAIL)
19
20RELEASE=2
Tomas Cejka96f4e612012-12-10 00:03:32 +010021AC_SUBST(RELEASE)
Tomas Cejkad340dbf2013-03-24 20:36:57 +010022LIBS="-lnetconf -ljson"
Tomas Cejka96f4e612012-12-10 00:03:32 +010023
Tomas Cejka689a1042013-01-16 15:08:25 +010024if test "`git show > /dev/null 2>&1;echo $?`" = "0"; then
25 RCSID="-DRCSID=\\\"\$(IDGIT)\\\""
26 ARCSID="-DARCSID='\\\"\$(IDGIT)\\\"'"
27else
28 RCSID="-DRCSID=\\\"\$(IDNOGIT)\\\""
29 ARCSID="-DARCSID='\\\"\$(IDNOGIT)\\\"'"
30fi
31
Tomas Cejkab4cd6dc2013-07-05 11:08:57 +020032REQS="$REQS httpd json-c"
Tomas Cejka96f4e612012-12-10 00:03:32 +010033BUILDREQS="$BUILDREQS json-c-devel httpd-devel"
34
35# Checks for libraries.
Tomas Cejkab3cc64f2013-05-03 19:44:54 +020036# libnetconf
37AC_ARG_WITH([libnetconf],
38 AC_HELP_STRING([--with-libnetconf=PATH],[Set the path to libnetconf (usually local GIT repository)]),
39 [# local copy of libnetconf GIT repo with headers and binaries
40 LIBNETCONF_CFLAGS="-I`cd $withval;pwd`"
41 LIBNETCONF_LIBS="-L`cd $withval;pwd` -lnetconf"
42 LIBNETCONF_WITH=" --with-libnetconf=$withval"],
43 [# get info from pkg-config about installed package
44 PKG_CHECK_MODULES(LIBNETCONF, libnetconf)
Tomas Cejkab4cd6dc2013-07-05 11:08:57 +020045 BUILDREQS="$BUILDREQS libnetconf-devel"]
Tomas Cejkab3cc64f2013-05-03 19:44:54 +020046)
Tomas Cejka23d4f342013-07-05 10:01:57 +020047CFLAGS="$LIBNETCONF_CFLAGS"
Tomas Cejkab3cc64f2013-05-03 19:44:54 +020048LIBS="$LIBS $LIBNETCONF_LIBS"
49AC_SUBST([LIBNETCONF_LIBS])
50AC_SUBST([LIBNETCONF_CFLAGS])
51AC_SUBST([LIBNETCONF_WITH])
Tomas Cejkab4cd6dc2013-07-05 11:08:57 +020052REQS="$REQS libnetconf"
Tomas Cejkab3cc64f2013-05-03 19:44:54 +020053AC_CHECK_LIB([netconf], [ncds_new],[],AC_MSG_ERROR([libnetconf not found.]))
Tomas Cejka96f4e612012-12-10 00:03:32 +010054
55# Checks for header files.
56AC_CHECK_HEADER([libnetconf.h], ,AC_MSG_ERROR([libnetconf.h not found!]))
57
58# Checks for typedefs, structures, and compiler characteristics.
59
60# Checks for library functions.
61
62AC_SUBST(RPMBUILD)
63if test -z "$RPMBUILD"; then
64 AC_MSG_WARN([Due to missing rpmbuild you will not able to generate RPM package.])
65fi
66
Tomas Cejkad340dbf2013-03-24 20:36:57 +010067
68AC_ARG_WITH([notifications],
Tomas Cejkab3cc64f2013-05-03 19:44:54 +020069 [AC_HELP_STRING([--without-notifications], [Disable notifications])],
70 AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"],
71 [ CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS "
Tomas Cejkad340dbf2013-03-24 20:36:57 +010072 LIBS="-lwebsockets $LIBS"
Tomas Cejkab4cd6dc2013-07-05 11:08:57 +020073 REQS="$REQS libwebsockets"
74 BUILDREQS="$BUILDREQS libwebsockets-devel"
Tomas Cejkab3cc64f2013-05-03 19:44:54 +020075 ]),
76 [
77 CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS "
78 LIBS="-lwebsockets $LIBS"
Tomas Cejkab4cd6dc2013-07-05 11:08:57 +020079 REQS="$REQS libwebsockets"
80 BUILDREQS="$BUILDREQS libwebsockets-devel"
Tomas Cejkab3cc64f2013-05-03 19:44:54 +020081 ]
Tomas Cejkad340dbf2013-03-24 20:36:57 +010082)
83
Tomas Cejka04a98cb2013-07-05 09:59:20 +020084AC_ARG_WITH([notifport],
85 [AC_HELP_STRING([--with-notifport=PORT], [Set TCP port of websocket notification server.])],
86 [CFLAGS="$CFLAGS -DNOTIFICATION_SERVER_PORT=$with_notifport"],
87 [CFLAGS="$CFLAGS"]
88)
89
Tomas Cejkab3cc64f2013-05-03 19:44:54 +020090CFLAGS="$CFLAGS -I/usr/include/json"
Tomas Cejka96f4e612012-12-10 00:03:32 +010091AC_SUBST(REQS)
92AC_SUBST(BUILDREQS)
Tomas Cejkab3cc64f2013-05-03 19:44:54 +020093AC_SUBST(CFLAGS)
Tomas Cejka689a1042013-01-16 15:08:25 +010094AC_SUBST(RCSID)
95AC_SUBST(ARCSID)
Tomas Cejkad340dbf2013-03-24 20:36:57 +010096AC_SUBST(LIBS)
Tomas Cejka96f4e612012-12-10 00:03:32 +010097
98AC_CONFIG_FILES([Makefile])
99AC_CONFIG_FILES([mod_netconf.spec])
100AC_OUTPUT