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