blob: 6b91bf3e81f4b9d69bc76925db91f5da21925913 [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
15RELEASE=1
16AC_SUBST(RELEASE)
Tomas Cejkad340dbf2013-03-24 20:36:57 +010017LIBS="-lnetconf -ljson"
Tomas Cejka96f4e612012-12-10 00:03:32 +010018
Tomas Cejka689a1042013-01-16 15:08:25 +010019if test "`git show > /dev/null 2>&1;echo $?`" = "0"; then
20 RCSID="-DRCSID=\\\"\$(IDGIT)\\\""
21 ARCSID="-DARCSID='\\\"\$(IDGIT)\\\"'"
22else
23 RCSID="-DRCSID=\\\"\$(IDNOGIT)\\\""
24 ARCSID="-DARCSID='\\\"\$(IDNOGIT)\\\"'"
25fi
26
Tomas Cejka96f4e612012-12-10 00:03:32 +010027REQS="$REQS httpd php json-c"
28BUILDREQS="$BUILDREQS json-c-devel httpd-devel"
29
30# Checks for libraries.
Tomas Cejkab3cc64f2013-05-03 19:44:54 +020031# libnetconf
32AC_ARG_WITH([libnetconf],
33 AC_HELP_STRING([--with-libnetconf=PATH],[Set the path to libnetconf (usually local GIT repository)]),
34 [# local copy of libnetconf GIT repo with headers and binaries
35 LIBNETCONF_CFLAGS="-I`cd $withval;pwd`"
36 LIBNETCONF_LIBS="-L`cd $withval;pwd` -lnetconf"
37 LIBNETCONF_WITH=" --with-libnetconf=$withval"],
38 [# get info from pkg-config about installed package
39 PKG_CHECK_MODULES(LIBNETCONF, libnetconf)
40 BUILDREQS="$BUILDREQS ,libnetconf-devel"]
41)
42CFLAGS="$CFLAGS $LIBNETCONF_CFLAGS"
43LIBS="$LIBS $LIBNETCONF_LIBS"
44AC_SUBST([LIBNETCONF_LIBS])
45AC_SUBST([LIBNETCONF_CFLAGS])
46AC_SUBST([LIBNETCONF_WITH])
47REQS="$REQS , libnetconf"
48AC_CHECK_LIB([netconf], [ncds_new],[],AC_MSG_ERROR([libnetconf not found.]))
Tomas Cejka96f4e612012-12-10 00:03:32 +010049
50# Checks for header files.
51AC_CHECK_HEADER([libnetconf.h], ,AC_MSG_ERROR([libnetconf.h not found!]))
52
53# Checks for typedefs, structures, and compiler characteristics.
54
55# Checks for library functions.
56
57AC_SUBST(RPMBUILD)
58if test -z "$RPMBUILD"; then
59 AC_MSG_WARN([Due to missing rpmbuild you will not able to generate RPM package.])
60fi
61
Tomas Cejkad340dbf2013-03-24 20:36:57 +010062
63AC_ARG_WITH([notifications],
Tomas Cejkab3cc64f2013-05-03 19:44:54 +020064 [AC_HELP_STRING([--without-notifications], [Disable notifications])],
65 AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"],
66 [ CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS "
Tomas Cejkad340dbf2013-03-24 20:36:57 +010067 LIBS="-lwebsockets $LIBS"
Tomas Cejkab3cc64f2013-05-03 19:44:54 +020068 ]),
69 [
70 CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS "
71 LIBS="-lwebsockets $LIBS"
72 ]
Tomas Cejkad340dbf2013-03-24 20:36:57 +010073)
74
Tomas Cejkab3cc64f2013-05-03 19:44:54 +020075CFLAGS="$CFLAGS -I/usr/include/json"
Tomas Cejka96f4e612012-12-10 00:03:32 +010076AC_SUBST(REQS)
77AC_SUBST(BUILDREQS)
Tomas Cejkab3cc64f2013-05-03 19:44:54 +020078AC_SUBST(CFLAGS)
Tomas Cejka689a1042013-01-16 15:08:25 +010079AC_SUBST(RCSID)
80AC_SUBST(ARCSID)
Tomas Cejkad340dbf2013-03-24 20:36:57 +010081AC_SUBST(LIBS)
Tomas Cejka96f4e612012-12-10 00:03:32 +010082
83AC_CONFIG_FILES([Makefile])
84AC_CONFIG_FILES([mod_netconf.spec])
85AC_OUTPUT