blob: 50a5e2322345ee07e3795d08c04e337cf3c09c5f [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
Tomas Cejka50c076e2014-03-18 15:31:10 +010070# Check for rpmbuild
71AC_CHECK_PROG(RPMBUILD, rpmbuild, rpmbuild, [""])
72RPM_RELEASE=1
73AC_SUBST(RPM_RELEASE)
74AM_CONDITIONAL(MAKE_RPMS, test x$RPMBUILD != x)
75
76# Checks for libraries.
77# save clean LIBS and CFLAGS
78SAVEDTEMP_LIBS=$LIBS
79SAVEDTEMP_CFLAGS=$CFLAGS
Tomas Cejka50c076e2014-03-18 15:31:10 +010080PKG_CHECK_MODULES([json], [json])
Tomas Cejka50c076e2014-03-18 15:31:10 +010081PKG_CHECK_MODULES([apr], [apr-1])
82PKG_CHECK_MODULES([aprutil], [apr-util-1])
83PKG_CHECK_MODULES([netconf], [libnetconf])
84PKG_CHECK_MODULES([xml], [libxml-2.0])
Tomas Cejkadd96fc72015-03-07 00:11:33 +010085CFLAGS="$json_CFLAGS $netconf_CFLAGS $xml_CFLAGS"
86LIBS="$json_LIBS $netconf_LIBS $xml_LIBS"
Tomas Cejka50c076e2014-03-18 15:31:10 +010087CPPFLAGS="$xml_CPPFLAGS"
88
Tomas Cejka5b0e4752014-03-20 15:58:04 +010089AX_PTHREAD([CC="$PTHREAD_CC"],
90 [AC_MSG_ERROR([pthread not found])])
Tomas Cejka50c076e2014-03-18 15:31:10 +010091
92AC_ARG_WITH([notifications],
93[AC_HELP_STRING([--without-notifications], [Disable notifications])],
Tomas Cejkadc8f08d2015-04-29 11:08:24 +020094[AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"],
95[PKG_CHECK_MODULES([websockets], [libwebsockets],
96[CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS"
97LIBS="$LIBS $websockets_LIBS"])])],
98[PKG_CHECK_MODULES([websockets], [libwebsockets],
99[CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS"
100LIBS="$LIBS $websockets_LIBS"])])
Tomas Cejka50c076e2014-03-18 15:31:10 +0100101
102# Checks for header files.
103AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
104
105# Checks for typedefs, structures, and compiler characteristics.
106AC_TYPE_INT64_T
107AC_TYPE_SIZE_T
108AC_TYPE_SSIZE_T
109
110# Checks for library functions.
111AC_FUNC_MALLOC
112AC_FUNC_REALLOC
113AC_CHECK_FUNCS([getdelim gettimeofday memset socket strdup strerror])
114
115AC_CONFIG_FILES([Makefile
Tomas Cejka04e08f42014-03-27 19:52:34 +0100116 config.h
Tomas Cejka834004f2014-04-27 20:13:39 +0200117 mod_netconf.spec
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")"
Tomas Cejka04e08f42014-03-27 19:52:34 +0100146echo "Su user for process:...............: $SU_USER"
147echo "Su group for process:..............: $SU_GROUP"
148echo "Chown user for sock file:...............: $CHOWN_USER"
149echo "Chown group for sock file:..............: $CHOWN_GROUP"
Tomas Cejka50c076e2014-03-18 15:31:10 +0100150echo
151