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