Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 1 | # -*- Autoconf -*- |
| 2 | # Process this file with autoconf to produce a configure script. |
| 3 | |
| 4 | AC_PREREQ([2.63]) |
Tomas Cejka | 5ab8ff2 | 2014-07-23 01:30:19 +0200 | [diff] [blame] | 5 | AC_INIT([mod_netconf], [1.0.2], [cejkat@cesnet.cz]) |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 6 | AM_INIT_AUTOMAKE([silent-rules]) |
| 7 | AM_SILENT_RULES([yes]) |
| 8 | |
| 9 | USERNAME=`git config --get user.name` |
| 10 | USERMAIL=`git config --get user.email` |
| 11 | AC_SUBST(USERNAME) |
| 12 | AC_SUBST(USERMAIL) |
| 13 | |
| 14 | RELEASE=1 |
| 15 | AC_SUBST(RELEASE) |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 16 | |
Tomas Cejka | 04e08f4 | 2014-03-27 19:52:34 +0100 | [diff] [blame] | 17 | AC_ARG_VAR(SU_USER, [Change UID of process according to username.]) |
| 18 | if test "x$SU_USER" == x; then |
| 19 | SU_USER="" |
| 20 | fi |
| 21 | AC_SUBST([SU_USER]) |
| 22 | |
| 23 | AC_ARG_VAR(SU_GROUP, [Change GID of process according to groupname.]) |
| 24 | if test "x$SU_GROUP" == x; then |
| 25 | SU_GROUP="" |
| 26 | fi |
| 27 | AC_SUBST([SU_GROUP]) |
| 28 | |
| 29 | AC_ARG_VAR(CHOWN_USER, [Use chown (user) on socket file.]) |
| 30 | if test "x$CHOWN_USER" == x; then |
| 31 | CHOWN_USER="" |
| 32 | fi |
| 33 | AC_SUBST([CHOWN_USER]) |
| 34 | |
| 35 | AC_ARG_VAR(CHOWN_GROUP, [Use chown (group) on socket file.]) |
| 36 | if test "x$CHOWN_GROUP" == x; then |
| 37 | CHOWN_GROUP="" |
| 38 | fi |
| 39 | AC_SUBST([CHOWN_GROUP]) |
| 40 | |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 41 | # Check for rpmbuild |
| 42 | AC_CHECK_PROG(RPMBUILD, [rpmbuild], [rpmbuild], [""]) |
| 43 | AC_CHECK_PROG(HTTPD, [httpd], [yes], [""]) |
| 44 | AC_PATH_PROGS(APACHECTL, apachectl apache2ctl, no, [$PATH:/usr/sbin]) |
| 45 | |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 46 | # Check for rpmbuild |
| 47 | AC_CHECK_PROG(RPMBUILD, rpmbuild, rpmbuild, [""]) |
| 48 | RPM_RELEASE=1 |
| 49 | AC_SUBST(RPM_RELEASE) |
| 50 | AM_CONDITIONAL(MAKE_RPMS, test x$RPMBUILD != x) |
| 51 | |
| 52 | # Checks for libraries. |
| 53 | # save clean LIBS and CFLAGS |
| 54 | SAVEDTEMP_LIBS=$LIBS |
| 55 | SAVEDTEMP_CFLAGS=$CFLAGS |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 56 | PKG_CHECK_MODULES([json], [json]) |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 57 | PKG_CHECK_MODULES([netconf], [libnetconf]) |
| 58 | PKG_CHECK_MODULES([xml], [libxml-2.0]) |
Michal Vasko | c314678 | 2015-11-04 14:46:41 +0100 | [diff] [blame] | 59 | AX_PTHREAD([CC="$PTHREAD_CC"], [AC_MSG_ERROR([pthread not found])]) |
| 60 | CFLAGS="-Wall -Wextra $json_CFLAGS $netconf_CFLAGS $xml_CFLAGS $PTHREAD_CFLAGS" |
| 61 | LIBS="$json_LIBS $netconf_LIBS $xml_LIBS $PTHREAD_LIBS" |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 62 | CPPFLAGS="$xml_CPPFLAGS" |
| 63 | |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 64 | AC_ARG_WITH([notifications], |
| 65 | [AC_HELP_STRING([--without-notifications], [Disable notifications])], |
Tomas Cejka | dc8f08d | 2015-04-29 11:08:24 +0200 | [diff] [blame] | 66 | [AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"], |
| 67 | [PKG_CHECK_MODULES([websockets], [libwebsockets], |
| 68 | [CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS" |
| 69 | LIBS="$LIBS $websockets_LIBS"])])], |
| 70 | [PKG_CHECK_MODULES([websockets], [libwebsockets], |
| 71 | [CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS" |
| 72 | LIBS="$LIBS $websockets_LIBS"])]) |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 73 | |
| 74 | # Checks for header files. |
| 75 | AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/socket.h sys/time.h unistd.h]) |
| 76 | |
| 77 | # Checks for typedefs, structures, and compiler characteristics. |
| 78 | AC_TYPE_INT64_T |
| 79 | AC_TYPE_SIZE_T |
| 80 | AC_TYPE_SSIZE_T |
| 81 | |
| 82 | # Checks for library functions. |
| 83 | AC_FUNC_MALLOC |
| 84 | AC_FUNC_REALLOC |
| 85 | AC_CHECK_FUNCS([getdelim gettimeofday memset socket strdup strerror]) |
| 86 | |
| 87 | AC_CONFIG_FILES([Makefile |
Tomas Cejka | 04e08f4 | 2014-03-27 19:52:34 +0100 | [diff] [blame] | 88 | config.h |
Tomas Cejka | 834004f | 2014-04-27 20:13:39 +0200 | [diff] [blame] | 89 | mod_netconf.spec |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 90 | src/Makefile |
| 91 | ]) |
| 92 | AC_OUTPUT |
| 93 | |
| 94 | echo |
| 95 | echo |
| 96 | echo "------------------------------------------------------------------------" |
| 97 | echo "$PACKAGE $VERSION" |
| 98 | echo "------------------------------------------------------------------------" |
| 99 | echo |
| 100 | echo |
| 101 | echo "Configuration Options Summary:" |
| 102 | echo |
| 103 | echo "Documentation..........: ${build_doc}" |
| 104 | echo |
| 105 | echo "Compilation............: make (or gmake)" |
Michal Vasko | c314678 | 2015-11-04 14:46:41 +0100 | [diff] [blame] | 106 | echo " CC...................: $CC" |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 107 | echo " LIBS.................: $LIBS" |
| 108 | echo " CFLAGS...............: $CFLAGS" |
| 109 | echo |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 110 | echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')" |
| 111 | echo " prefix...............: $prefix" |
| 112 | echo " python module dir....: $pyplugindir" |
| 113 | echo " webgui dir...........: $webguidir" |
| 114 | echo " webgui name..........: $webguiname" |
Tomas Cejka | 04e08f4 | 2014-03-27 19:52:34 +0100 | [diff] [blame] | 115 | echo "Su user for process:...............: $SU_USER" |
| 116 | echo "Su group for process:..............: $SU_GROUP" |
| 117 | echo "Chown user for sock file:...............: $CHOWN_USER" |
| 118 | echo "Chown group for sock file:..............: $CHOWN_GROUP" |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 119 | echo |
| 120 | |