blob: d8de51aa4dc71445f9939b6f2b8a00b887be4c59 [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
Tomas Cejka04e08f42014-03-27 19:52:34 +010017AC_ARG_VAR(SU_USER, [Change UID of process according to username.])
18if test "x$SU_USER" == x; then
19 SU_USER=""
20fi
21AC_SUBST([SU_USER])
22
23AC_ARG_VAR(SU_GROUP, [Change GID of process according to groupname.])
24if test "x$SU_GROUP" == x; then
25 SU_GROUP=""
26fi
27AC_SUBST([SU_GROUP])
28
29AC_ARG_VAR(CHOWN_USER, [Use chown (user) on socket file.])
30if test "x$CHOWN_USER" == x; then
31 CHOWN_USER=""
32fi
33AC_SUBST([CHOWN_USER])
34
35AC_ARG_VAR(CHOWN_GROUP, [Use chown (group) on socket file.])
36if test "x$CHOWN_GROUP" == x; then
37 CHOWN_GROUP=""
38fi
39AC_SUBST([CHOWN_GROUP])
40
Tomas Cejka50c076e2014-03-18 15:31:10 +010041AC_ARG_VAR(httpdmoduledir, [Installation directory for Apache module, leave unset to use Apache default.])
42AC_SUBST(httpdmoduledir)
43
44if test "x$httpdconfddir" == x; then
45 httpdconfddir="/etc/httpd/conf.d"
46fi
47AC_ARG_VAR(httpdconfddir, [Directory for Apache configuration files [/etc/httpd/conf.d]])
48AC_SUBST(httpdconfddir)
49
Tomas Cejka50c076e2014-03-18 15:31:10 +010050# Checks for programs.
51AC_ARG_WITH(apxs, AC_HELP_STRING([--with-apxs=NAME],[name of the apxs executable [[apxs]]]), [APXS="$with_apxs"])
52if test -z "${APXS}"; then
53AC_PATH_PROGS(APXS, [apxs2 apxs], [no], [$PATH:/usr/sbin:/usr/local/apache2/bin])
54else
55AC_MSG_ERROR([Apxs for Apache module compilation and installation was not found.])
56fi
57
Tomas Cejkaf02a9842014-03-20 15:54:56 +010058AM_CONDITIONAL([MANUAL_CONFD], [test -n "$with_apxs" ])
59
Tomas Cejka50c076e2014-03-18 15:31:10 +010060# Check for rpmbuild
61AC_CHECK_PROG(RPMBUILD, [rpmbuild], [rpmbuild], [""])
62AC_CHECK_PROG(HTTPD, [httpd], [yes], [""])
63AC_PATH_PROGS(APACHECTL, apachectl apache2ctl, no, [$PATH:/usr/sbin])
64
65if 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."])
68else
69AC_MSG_ERROR([apachectl was not found])
70fi
71
Tomas Cejka50c076e2014-03-18 15:31:10 +010072# Check for rpmbuild
73AC_CHECK_PROG(RPMBUILD, rpmbuild, rpmbuild, [""])
74RPM_RELEASE=1
75AC_SUBST(RPM_RELEASE)
76AM_CONDITIONAL(MAKE_RPMS, test x$RPMBUILD != x)
77
78# Checks for libraries.
79# save clean LIBS and CFLAGS
80SAVEDTEMP_LIBS=$LIBS
81SAVEDTEMP_CFLAGS=$CFLAGS
Tomas Cejka50c076e2014-03-18 15:31:10 +010082PKG_CHECK_MODULES([json], [json])
83PKG_CHECK_MODULES([websockets], [libwebsockets])
84PKG_CHECK_MODULES([apr], [apr-1])
85PKG_CHECK_MODULES([aprutil], [apr-util-1])
86PKG_CHECK_MODULES([netconf], [libnetconf])
87PKG_CHECK_MODULES([xml], [libxml-2.0])
Tomas Cejka50c076e2014-03-18 15:31:10 +010088CFLAGS="$json_CFLAGS $websockets_CFLAGS $netconf_CFLAGS $xml_CFLAGS"
89LIBS="$json_LIBS $websockets_LIBS $netconf_LIBS $xml_LIBS"
90CPPFLAGS="$xml_CPPFLAGS"
91
Tomas Cejka5b0e4752014-03-20 15:58:04 +010092AX_PTHREAD([CC="$PTHREAD_CC"],
93 [AC_MSG_ERROR([pthread not found])])
Tomas Cejka50c076e2014-03-18 15:31:10 +010094
95AC_ARG_WITH([notifications],
96[AC_HELP_STRING([--without-notifications], [Disable notifications])],
97AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"],
98[AC_CHECK_LIB([websockets], [libwebsocket_create_context])
99CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS"]),
100[AC_CHECK_LIB([websockets], [libwebsocket_create_context])
101CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS"])
102
103# Checks for header files.
104AC_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.
107AC_TYPE_INT64_T
108AC_TYPE_SIZE_T
109AC_TYPE_SSIZE_T
110
111# Checks for library functions.
112AC_FUNC_MALLOC
113AC_FUNC_REALLOC
114AC_CHECK_FUNCS([getdelim gettimeofday memset socket strdup strerror])
115
116AC_CONFIG_FILES([Makefile
Tomas Cejka04e08f42014-03-27 19:52:34 +0100117 config.h
Tomas Cejka5b0e4752014-03-20 15:58:04 +0100118 conf.d/Makefile
Tomas Cejka50c076e2014-03-18 15:31:10 +0100119 src/Makefile
120 ])
121AC_OUTPUT
122
123echo
124echo
125echo "------------------------------------------------------------------------"
126echo "$PACKAGE $VERSION"
127echo "------------------------------------------------------------------------"
128echo
129echo
130echo "Configuration Options Summary:"
131echo
132echo "Documentation..........: ${build_doc}"
133echo
134echo "Compilation............: make (or gmake)"
135echo " asxs.................: $ASXS"
136echo " LIBS.................: $LIBS"
137echo " CFLAGS...............: $CFLAGS"
138echo
Tomas Cejka50c076e2014-03-18 15:31:10 +0100139echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
140echo " prefix...............: $prefix"
141echo " python module dir....: $pyplugindir"
142echo " webgui dir...........: $webguidir"
143echo " webgui name..........: $webguiname"
144echo " httpdmoduledir.......: $(test -z "$httpdmoduledir" && echo "Apache default path" || echo "$httpdmoduledir")"
145echo " httpdconfddir........: $(test -z "$httpdconfddir" && echo "Apache default path" || echo "$httpdconfddir")"
146echo " run composer install.: $composerinstall"
Tomas Cejka04e08f42014-03-27 19:52:34 +0100147echo "Su user for process:...............: $SU_USER"
148echo "Su group for process:..............: $SU_GROUP"
149echo "Chown user for sock file:...............: $CHOWN_USER"
150echo "Chown group for sock file:..............: $CHOWN_GROUP"
Tomas Cejka50c076e2014-03-18 15:31:10 +0100151echo
152