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 | |
Tomas Cejka | b4cd6dc | 2013-07-05 11:08:57 +0200 | [diff] [blame^] | 15 | USERNAME=`git config --get user.name` |
| 16 | USERMAIL=`git config --get user.email` |
| 17 | AC_SUBST(USERNAME) |
| 18 | AC_SUBST(USERMAIL) |
| 19 | |
| 20 | RELEASE=2 |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 21 | AC_SUBST(RELEASE) |
Tomas Cejka | d340dbf | 2013-03-24 20:36:57 +0100 | [diff] [blame] | 22 | LIBS="-lnetconf -ljson" |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 23 | |
Tomas Cejka | 689a104 | 2013-01-16 15:08:25 +0100 | [diff] [blame] | 24 | if test "`git show > /dev/null 2>&1;echo $?`" = "0"; then |
| 25 | RCSID="-DRCSID=\\\"\$(IDGIT)\\\"" |
| 26 | ARCSID="-DARCSID='\\\"\$(IDGIT)\\\"'" |
| 27 | else |
| 28 | RCSID="-DRCSID=\\\"\$(IDNOGIT)\\\"" |
| 29 | ARCSID="-DARCSID='\\\"\$(IDNOGIT)\\\"'" |
| 30 | fi |
| 31 | |
Tomas Cejka | b4cd6dc | 2013-07-05 11:08:57 +0200 | [diff] [blame^] | 32 | REQS="$REQS httpd json-c" |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 33 | BUILDREQS="$BUILDREQS json-c-devel httpd-devel" |
| 34 | |
| 35 | # Checks for libraries. |
Tomas Cejka | b3cc64f | 2013-05-03 19:44:54 +0200 | [diff] [blame] | 36 | # libnetconf |
| 37 | AC_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 Cejka | b4cd6dc | 2013-07-05 11:08:57 +0200 | [diff] [blame^] | 45 | BUILDREQS="$BUILDREQS libnetconf-devel"] |
Tomas Cejka | b3cc64f | 2013-05-03 19:44:54 +0200 | [diff] [blame] | 46 | ) |
Tomas Cejka | 23d4f34 | 2013-07-05 10:01:57 +0200 | [diff] [blame] | 47 | CFLAGS="$LIBNETCONF_CFLAGS" |
Tomas Cejka | b3cc64f | 2013-05-03 19:44:54 +0200 | [diff] [blame] | 48 | LIBS="$LIBS $LIBNETCONF_LIBS" |
| 49 | AC_SUBST([LIBNETCONF_LIBS]) |
| 50 | AC_SUBST([LIBNETCONF_CFLAGS]) |
| 51 | AC_SUBST([LIBNETCONF_WITH]) |
Tomas Cejka | b4cd6dc | 2013-07-05 11:08:57 +0200 | [diff] [blame^] | 52 | REQS="$REQS libnetconf" |
Tomas Cejka | b3cc64f | 2013-05-03 19:44:54 +0200 | [diff] [blame] | 53 | AC_CHECK_LIB([netconf], [ncds_new],[],AC_MSG_ERROR([libnetconf not found.])) |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 54 | |
| 55 | # Checks for header files. |
| 56 | AC_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 | |
| 62 | AC_SUBST(RPMBUILD) |
| 63 | if test -z "$RPMBUILD"; then |
| 64 | AC_MSG_WARN([Due to missing rpmbuild you will not able to generate RPM package.]) |
| 65 | fi |
| 66 | |
Tomas Cejka | d340dbf | 2013-03-24 20:36:57 +0100 | [diff] [blame] | 67 | |
| 68 | AC_ARG_WITH([notifications], |
Tomas Cejka | b3cc64f | 2013-05-03 19:44:54 +0200 | [diff] [blame] | 69 | [AC_HELP_STRING([--without-notifications], [Disable notifications])], |
| 70 | AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"], |
| 71 | [ CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS " |
Tomas Cejka | d340dbf | 2013-03-24 20:36:57 +0100 | [diff] [blame] | 72 | LIBS="-lwebsockets $LIBS" |
Tomas Cejka | b4cd6dc | 2013-07-05 11:08:57 +0200 | [diff] [blame^] | 73 | REQS="$REQS libwebsockets" |
| 74 | BUILDREQS="$BUILDREQS libwebsockets-devel" |
Tomas Cejka | b3cc64f | 2013-05-03 19:44:54 +0200 | [diff] [blame] | 75 | ]), |
| 76 | [ |
| 77 | CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS " |
| 78 | LIBS="-lwebsockets $LIBS" |
Tomas Cejka | b4cd6dc | 2013-07-05 11:08:57 +0200 | [diff] [blame^] | 79 | REQS="$REQS libwebsockets" |
| 80 | BUILDREQS="$BUILDREQS libwebsockets-devel" |
Tomas Cejka | b3cc64f | 2013-05-03 19:44:54 +0200 | [diff] [blame] | 81 | ] |
Tomas Cejka | d340dbf | 2013-03-24 20:36:57 +0100 | [diff] [blame] | 82 | ) |
| 83 | |
Tomas Cejka | 04a98cb | 2013-07-05 09:59:20 +0200 | [diff] [blame] | 84 | AC_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 Cejka | b3cc64f | 2013-05-03 19:44:54 +0200 | [diff] [blame] | 90 | CFLAGS="$CFLAGS -I/usr/include/json" |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 91 | AC_SUBST(REQS) |
| 92 | AC_SUBST(BUILDREQS) |
Tomas Cejka | b3cc64f | 2013-05-03 19:44:54 +0200 | [diff] [blame] | 93 | AC_SUBST(CFLAGS) |
Tomas Cejka | 689a104 | 2013-01-16 15:08:25 +0100 | [diff] [blame] | 94 | AC_SUBST(RCSID) |
| 95 | AC_SUBST(ARCSID) |
Tomas Cejka | d340dbf | 2013-03-24 20:36:57 +0100 | [diff] [blame] | 96 | AC_SUBST(LIBS) |
Tomas Cejka | 96f4e61 | 2012-12-10 00:03:32 +0100 | [diff] [blame] | 97 | |
| 98 | AC_CONFIG_FILES([Makefile]) |
| 99 | AC_CONFIG_FILES([mod_netconf.spec]) |
| 100 | AC_OUTPUT |