Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 1 | # -*- Autoconf -*- |
| 2 | # Process this file with autoconf to produce a configure script. |
| 3 | |
| 4 | AC_PREREQ([2.63]) |
| 5 | AC_INIT([mod_netconf], [1.0]) |
| 6 | AC_CONFIG_SRCDIR([mod_netconf.c]) |
| 7 | |
| 8 | # Checks for programs. |
| 9 | #AC_PROG_CC |
| 10 | AC_PROG_INSTALL |
| 11 | |
| 12 | # Check for rpmbuil |
| 13 | AC_CHECK_PROG(RPMBUILD, rpmbuild, rpmbuild) |
| 14 | |
| 15 | RELEASE=1 |
| 16 | AC_SUBST(RELEASE) |
Tomas Cejka | d340dbf | 2013-03-24 20:36:57 +0100 | [diff] [blame] | 17 | LIBS="-lnetconf -ljson" |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 18 | |
Tomas Cejka | 689a104 | 2013-01-16 15:08:25 +0100 | [diff] [blame] | 19 | if test "`git show > /dev/null 2>&1;echo $?`" = "0"; then |
| 20 | RCSID="-DRCSID=\\\"\$(IDGIT)\\\"" |
| 21 | ARCSID="-DARCSID='\\\"\$(IDGIT)\\\"'" |
| 22 | else |
| 23 | RCSID="-DRCSID=\\\"\$(IDNOGIT)\\\"" |
| 24 | ARCSID="-DARCSID='\\\"\$(IDNOGIT)\\\"'" |
| 25 | fi |
| 26 | |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 27 | REQS="$REQS httpd php json-c" |
| 28 | BUILDREQS="$BUILDREQS json-c-devel httpd-devel" |
| 29 | |
| 30 | # Checks for libraries. |
Tomas Cejka | b3cc64f | 2013-05-03 19:44:54 +0200 | [diff] [blame] | 31 | # libnetconf |
| 32 | AC_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 | ) |
Tomas Cejka | 23d4f34 | 2013-07-05 10:01:57 +0200 | [diff] [blame] | 42 | CFLAGS="$LIBNETCONF_CFLAGS" |
Tomas Cejka | b3cc64f | 2013-05-03 19:44:54 +0200 | [diff] [blame] | 43 | LIBS="$LIBS $LIBNETCONF_LIBS" |
| 44 | AC_SUBST([LIBNETCONF_LIBS]) |
| 45 | AC_SUBST([LIBNETCONF_CFLAGS]) |
| 46 | AC_SUBST([LIBNETCONF_WITH]) |
| 47 | REQS="$REQS , libnetconf" |
| 48 | AC_CHECK_LIB([netconf], [ncds_new],[],AC_MSG_ERROR([libnetconf not found.])) |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 49 | |
| 50 | # Checks for header files. |
| 51 | AC_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 | |
| 57 | AC_SUBST(RPMBUILD) |
| 58 | if test -z "$RPMBUILD"; then |
| 59 | AC_MSG_WARN([Due to missing rpmbuild you will not able to generate RPM package.]) |
| 60 | fi |
| 61 | |
Tomas Cejka | d340dbf | 2013-03-24 20:36:57 +0100 | [diff] [blame] | 62 | |
| 63 | AC_ARG_WITH([notifications], |
Tomas Cejka | b3cc64f | 2013-05-03 19:44:54 +0200 | [diff] [blame] | 64 | [AC_HELP_STRING([--without-notifications], [Disable notifications])], |
| 65 | AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"], |
| 66 | [ CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS " |
Tomas Cejka | d340dbf | 2013-03-24 20:36:57 +0100 | [diff] [blame] | 67 | LIBS="-lwebsockets $LIBS" |
Tomas Cejka | b3cc64f | 2013-05-03 19:44:54 +0200 | [diff] [blame] | 68 | ]), |
| 69 | [ |
| 70 | CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS " |
| 71 | LIBS="-lwebsockets $LIBS" |
| 72 | ] |
Tomas Cejka | d340dbf | 2013-03-24 20:36:57 +0100 | [diff] [blame] | 73 | ) |
| 74 | |
Tomas Cejka | 04a98cb | 2013-07-05 09:59:20 +0200 | [diff] [blame] | 75 | AC_ARG_WITH([notifport], |
| 76 | [AC_HELP_STRING([--with-notifport=PORT], [Set TCP port of websocket notification server.])], |
| 77 | [CFLAGS="$CFLAGS -DNOTIFICATION_SERVER_PORT=$with_notifport"], |
| 78 | [CFLAGS="$CFLAGS"] |
| 79 | ) |
| 80 | |
Tomas Cejka | b3cc64f | 2013-05-03 19:44:54 +0200 | [diff] [blame] | 81 | CFLAGS="$CFLAGS -I/usr/include/json" |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 82 | AC_SUBST(REQS) |
| 83 | AC_SUBST(BUILDREQS) |
Tomas Cejka | b3cc64f | 2013-05-03 19:44:54 +0200 | [diff] [blame] | 84 | AC_SUBST(CFLAGS) |
Tomas Cejka | 689a104 | 2013-01-16 15:08:25 +0100 | [diff] [blame] | 85 | AC_SUBST(RCSID) |
| 86 | AC_SUBST(ARCSID) |
Tomas Cejka | d340dbf | 2013-03-24 20:36:57 +0100 | [diff] [blame] | 87 | AC_SUBST(LIBS) |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 88 | |
| 89 | AC_CONFIG_FILES([Makefile]) |
| 90 | AC_CONFIG_FILES([mod_netconf.spec]) |
| 91 | AC_OUTPUT |