blob: 53975e3eaa6ae57ecdd508c09a556d3849d2e812 [file] [log] [blame]
Tomas Cejka50c076e2014-03-18 15:31:10 +01001# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.63])
5AC_INIT([mod_netconf], [1.0.0], [cejkat@cesnet.cz])
6AM_INIT_AUTOMAKE([silent-rules])
7AM_SILENT_RULES([yes])
8
9USERNAME=`git config --get user.name`
10USERMAIL=`git config --get user.email`
11AC_SUBST(USERNAME)
12AC_SUBST(USERMAIL)
13
14RELEASE=1
15AC_SUBST(RELEASE)
Tomas Cejka50c076e2014-03-18 15:31:10 +010016
17AC_ARG_VAR(httpdmoduledir, [Installation directory for Apache module, leave unset to use Apache default.])
18AC_SUBST(httpdmoduledir)
19
20if test "x$httpdconfddir" == x; then
21 httpdconfddir="/etc/httpd/conf.d"
22fi
23AC_ARG_VAR(httpdconfddir, [Directory for Apache configuration files [/etc/httpd/conf.d]])
24AC_SUBST(httpdconfddir)
25
Tomas Cejka50c076e2014-03-18 15:31:10 +010026# Checks for programs.
27AC_ARG_WITH(apxs, AC_HELP_STRING([--with-apxs=NAME],[name of the apxs executable [[apxs]]]), [APXS="$with_apxs"])
28if test -z "${APXS}"; then
29AC_PATH_PROGS(APXS, [apxs2 apxs], [no], [$PATH:/usr/sbin:/usr/local/apache2/bin])
30else
31AC_MSG_ERROR([Apxs for Apache module compilation and installation was not found.])
32fi
33
Tomas Cejkaf02a9842014-03-20 15:54:56 +010034AM_CONDITIONAL([MANUAL_CONFD], [test -n "$with_apxs" ])
35
Tomas Cejka50c076e2014-03-18 15:31:10 +010036# Check for rpmbuild
37AC_CHECK_PROG(RPMBUILD, [rpmbuild], [rpmbuild], [""])
38AC_CHECK_PROG(HTTPD, [httpd], [yes], [""])
39AC_PATH_PROGS(APACHECTL, apachectl apache2ctl, no, [$PATH:/usr/sbin])
40
41if 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."])
44else
45AC_MSG_ERROR([apachectl was not found])
46fi
47
Tomas Cejka50c076e2014-03-18 15:31:10 +010048# Check for rpmbuild
49AC_CHECK_PROG(RPMBUILD, rpmbuild, rpmbuild, [""])
50RPM_RELEASE=1
51AC_SUBST(RPM_RELEASE)
52AM_CONDITIONAL(MAKE_RPMS, test x$RPMBUILD != x)
53
54# Checks for libraries.
55# save clean LIBS and CFLAGS
56SAVEDTEMP_LIBS=$LIBS
57SAVEDTEMP_CFLAGS=$CFLAGS
Tomas Cejka50c076e2014-03-18 15:31:10 +010058PKG_CHECK_MODULES([json], [json])
59PKG_CHECK_MODULES([websockets], [libwebsockets])
60PKG_CHECK_MODULES([apr], [apr-1])
61PKG_CHECK_MODULES([aprutil], [apr-util-1])
62PKG_CHECK_MODULES([netconf], [libnetconf])
63PKG_CHECK_MODULES([xml], [libxml-2.0])
Tomas Cejka50c076e2014-03-18 15:31:10 +010064CFLAGS="$json_CFLAGS $websockets_CFLAGS $netconf_CFLAGS $xml_CFLAGS"
65LIBS="$json_LIBS $websockets_LIBS $netconf_LIBS $xml_LIBS"
66CPPFLAGS="$xml_CPPFLAGS"
67
Tomas Cejka5b0e4752014-03-20 15:58:04 +010068AX_PTHREAD([CC="$PTHREAD_CC"],
69 [AC_MSG_ERROR([pthread not found])])
Tomas Cejka50c076e2014-03-18 15:31:10 +010070
71AC_ARG_WITH([notifications],
72[AC_HELP_STRING([--without-notifications], [Disable notifications])],
73AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"],
74[AC_CHECK_LIB([websockets], [libwebsocket_create_context])
75CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS"]),
76[AC_CHECK_LIB([websockets], [libwebsocket_create_context])
77CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS"])
78
79# Checks for header files.
80AC_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.
83AC_TYPE_INT64_T
84AC_TYPE_SIZE_T
85AC_TYPE_SSIZE_T
86
87# Checks for library functions.
88AC_FUNC_MALLOC
89AC_FUNC_REALLOC
90AC_CHECK_FUNCS([getdelim gettimeofday memset socket strdup strerror])
91
92AC_CONFIG_FILES([Makefile
Tomas Cejka5b0e4752014-03-20 15:58:04 +010093 conf.d/Makefile
Tomas Cejka50c076e2014-03-18 15:31:10 +010094 src/Makefile
95 ])
96AC_OUTPUT
97
98echo
99echo
100echo "------------------------------------------------------------------------"
101echo "$PACKAGE $VERSION"
102echo "------------------------------------------------------------------------"
103echo
104echo
105echo "Configuration Options Summary:"
106echo
107echo "Documentation..........: ${build_doc}"
108echo
109echo "Compilation............: make (or gmake)"
110echo " asxs.................: $ASXS"
111echo " LIBS.................: $LIBS"
112echo " CFLAGS...............: $CFLAGS"
113echo
114echo "Components"
115echo " mod_netconf..........: $with_modnetconf"
116echo " webgui frontend......: $with_webgui"
117echo " pyang plugins........: $with_pyang"
118echo
119echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
120echo " prefix...............: $prefix"
121echo " python module dir....: $pyplugindir"
122echo " webgui dir...........: $webguidir"
123echo " webgui name..........: $webguiname"
124echo " httpdmoduledir.......: $(test -z "$httpdmoduledir" && echo "Apache default path" || echo "$httpdmoduledir")"
125echo " httpdconfddir........: $(test -z "$httpdconfddir" && echo "Apache default path" || echo "$httpdconfddir")"
126echo " run composer install.: $composerinstall"
127echo
128