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