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