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 | AC_ARG_VAR(httpdmoduledir, [Installation directory for Apache module, leave unset to use Apache default.]) |
Tomas Cejka | 834004f | 2014-04-27 20:13:39 +0200 | [diff] [blame] | 42 | if test "x$httpdmoduledir" != x; then |
| 43 | httpdmoduledir="${prefix}/${httpdmoduledir}" |
| 44 | fi |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 45 | AC_SUBST(httpdmoduledir) |
| 46 | |
Tomas Cejka | 834004f | 2014-04-27 20:13:39 +0200 | [diff] [blame] | 47 | AM_CONDITIONAL([MANUAL_CONFD], [test "x$httpdconfddir" != x]) |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 48 | if test "x$httpdconfddir" == x; then |
| 49 | httpdconfddir="/etc/httpd/conf.d" |
Tomas Cejka | 834004f | 2014-04-27 20:13:39 +0200 | [diff] [blame] | 50 | else |
| 51 | httpdconfddir="${prefix}/${httpdconfddir}" |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 52 | fi |
| 53 | AC_ARG_VAR(httpdconfddir, [Directory for Apache configuration files [/etc/httpd/conf.d]]) |
| 54 | AC_SUBST(httpdconfddir) |
| 55 | |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 56 | # Checks for programs. |
| 57 | AC_ARG_WITH(apxs, AC_HELP_STRING([--with-apxs=NAME],[name of the apxs executable [[apxs]]]), [APXS="$with_apxs"]) |
| 58 | if test -z "${APXS}"; then |
| 59 | AC_PATH_PROGS(APXS, [apxs2 apxs], [no], [$PATH:/usr/sbin:/usr/local/apache2/bin]) |
| 60 | else |
| 61 | AC_MSG_ERROR([Apxs for Apache module compilation and installation was not found.]) |
| 62 | fi |
| 63 | |
Tomas Cejka | f02a984 | 2014-03-20 15:54:56 +0100 | [diff] [blame] | 64 | |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 65 | # Check for rpmbuild |
| 66 | AC_CHECK_PROG(RPMBUILD, [rpmbuild], [rpmbuild], [""]) |
| 67 | AC_CHECK_PROG(HTTPD, [httpd], [yes], [""]) |
| 68 | AC_PATH_PROGS(APACHECTL, apachectl apache2ctl, no, [$PATH:/usr/sbin]) |
| 69 | |
| 70 | if test "x$APACHECTL" != xno; then |
| 71 | AC_MSG_CHECKING([for php5_module in apache]) |
| 72 | $APACHECTL -M 2> /dev/null | grep php5_module > /dev/null && AC_MSG_RESULT([yes]) || AC_MSG_ERROR(["php5_module was not found."]) |
| 73 | else |
| 74 | AC_MSG_ERROR([apachectl was not found]) |
| 75 | fi |
| 76 | |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 77 | # Check for rpmbuild |
| 78 | AC_CHECK_PROG(RPMBUILD, rpmbuild, rpmbuild, [""]) |
| 79 | RPM_RELEASE=1 |
| 80 | AC_SUBST(RPM_RELEASE) |
| 81 | AM_CONDITIONAL(MAKE_RPMS, test x$RPMBUILD != x) |
| 82 | |
| 83 | # Checks for libraries. |
| 84 | # save clean LIBS and CFLAGS |
| 85 | SAVEDTEMP_LIBS=$LIBS |
| 86 | SAVEDTEMP_CFLAGS=$CFLAGS |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 87 | PKG_CHECK_MODULES([json], [json]) |
| 88 | PKG_CHECK_MODULES([websockets], [libwebsockets]) |
| 89 | PKG_CHECK_MODULES([apr], [apr-1]) |
| 90 | PKG_CHECK_MODULES([aprutil], [apr-util-1]) |
| 91 | PKG_CHECK_MODULES([netconf], [libnetconf]) |
| 92 | PKG_CHECK_MODULES([xml], [libxml-2.0]) |
Tomas Cejka | dd96fc7 | 2015-03-07 00:11:33 +0100 | [diff] [blame] | 93 | CFLAGS="$json_CFLAGS $netconf_CFLAGS $xml_CFLAGS" |
| 94 | LIBS="$json_LIBS $netconf_LIBS $xml_LIBS" |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 95 | CPPFLAGS="$xml_CPPFLAGS" |
| 96 | |
Tomas Cejka | 5b0e475 | 2014-03-20 15:58:04 +0100 | [diff] [blame] | 97 | AX_PTHREAD([CC="$PTHREAD_CC"], |
| 98 | [AC_MSG_ERROR([pthread not found])]) |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 99 | |
| 100 | AC_ARG_WITH([notifications], |
| 101 | [AC_HELP_STRING([--without-notifications], [Disable notifications])], |
| 102 | AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"], |
| 103 | [AC_CHECK_LIB([websockets], [libwebsocket_create_context]) |
Tomas Cejka | dd96fc7 | 2015-03-07 00:11:33 +0100 | [diff] [blame] | 104 | CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS" |
| 105 | LIBS="$LIBS $websockets_LIBS"]), |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 106 | [AC_CHECK_LIB([websockets], [libwebsocket_create_context]) |
Tomas Cejka | dd96fc7 | 2015-03-07 00:11:33 +0100 | [diff] [blame] | 107 | CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS" |
| 108 | LIBS="$LIBS $websockets_LIBS"]) |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 109 | |
| 110 | # Checks for header files. |
| 111 | AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/socket.h sys/time.h unistd.h]) |
| 112 | |
| 113 | # Checks for typedefs, structures, and compiler characteristics. |
| 114 | AC_TYPE_INT64_T |
| 115 | AC_TYPE_SIZE_T |
| 116 | AC_TYPE_SSIZE_T |
| 117 | |
| 118 | # Checks for library functions. |
| 119 | AC_FUNC_MALLOC |
| 120 | AC_FUNC_REALLOC |
| 121 | AC_CHECK_FUNCS([getdelim gettimeofday memset socket strdup strerror]) |
| 122 | |
| 123 | AC_CONFIG_FILES([Makefile |
Tomas Cejka | 04e08f4 | 2014-03-27 19:52:34 +0100 | [diff] [blame] | 124 | config.h |
Tomas Cejka | 834004f | 2014-04-27 20:13:39 +0200 | [diff] [blame] | 125 | mod_netconf.spec |
Tomas Cejka | 5b0e475 | 2014-03-20 15:58:04 +0100 | [diff] [blame] | 126 | conf.d/Makefile |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 127 | src/Makefile |
| 128 | ]) |
| 129 | AC_OUTPUT |
| 130 | |
| 131 | echo |
| 132 | echo |
| 133 | echo "------------------------------------------------------------------------" |
| 134 | echo "$PACKAGE $VERSION" |
| 135 | echo "------------------------------------------------------------------------" |
| 136 | echo |
| 137 | echo |
| 138 | echo "Configuration Options Summary:" |
| 139 | echo |
| 140 | echo "Documentation..........: ${build_doc}" |
| 141 | echo |
| 142 | echo "Compilation............: make (or gmake)" |
| 143 | echo " asxs.................: $ASXS" |
| 144 | echo " LIBS.................: $LIBS" |
| 145 | echo " CFLAGS...............: $CFLAGS" |
| 146 | echo |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 147 | echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')" |
| 148 | echo " prefix...............: $prefix" |
| 149 | echo " python module dir....: $pyplugindir" |
| 150 | echo " webgui dir...........: $webguidir" |
| 151 | echo " webgui name..........: $webguiname" |
| 152 | echo " httpdmoduledir.......: $(test -z "$httpdmoduledir" && echo "Apache default path" || echo "$httpdmoduledir")" |
| 153 | echo " httpdconfddir........: $(test -z "$httpdconfddir" && echo "Apache default path" || echo "$httpdconfddir")" |
Tomas Cejka | 04e08f4 | 2014-03-27 19:52:34 +0100 | [diff] [blame] | 154 | echo "Su user for process:...............: $SU_USER" |
| 155 | echo "Su group for process:..............: $SU_GROUP" |
| 156 | echo "Chown user for sock file:...............: $CHOWN_USER" |
| 157 | echo "Chown group for sock file:..............: $CHOWN_GROUP" |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 158 | echo |
| 159 | |