blob: 4fabcaacb7c5aa04853c3d0bb544be8b71d3cab5 [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 +010041# Check for rpmbuild
42AC_CHECK_PROG(RPMBUILD, [rpmbuild], [rpmbuild], [""])
43AC_CHECK_PROG(HTTPD, [httpd], [yes], [""])
44AC_PATH_PROGS(APACHECTL, apachectl apache2ctl, no, [$PATH:/usr/sbin])
45
Tomas Cejka50c076e2014-03-18 15:31:10 +010046# Check for rpmbuild
47AC_CHECK_PROG(RPMBUILD, rpmbuild, rpmbuild, [""])
48RPM_RELEASE=1
49AC_SUBST(RPM_RELEASE)
50AM_CONDITIONAL(MAKE_RPMS, test x$RPMBUILD != x)
51
52# Checks for libraries.
53# save clean LIBS and CFLAGS
54SAVEDTEMP_LIBS=$LIBS
55SAVEDTEMP_CFLAGS=$CFLAGS
Tomas Cejka50c076e2014-03-18 15:31:10 +010056PKG_CHECK_MODULES([json], [json])
Tomas Cejka50c076e2014-03-18 15:31:10 +010057PKG_CHECK_MODULES([netconf], [libnetconf])
58PKG_CHECK_MODULES([xml], [libxml-2.0])
Michal Vaskoc3146782015-11-04 14:46:41 +010059AX_PTHREAD([CC="$PTHREAD_CC"], [AC_MSG_ERROR([pthread not found])])
60CFLAGS="-Wall -Wextra $json_CFLAGS $netconf_CFLAGS $xml_CFLAGS $PTHREAD_CFLAGS"
61LIBS="$json_LIBS $netconf_LIBS $xml_LIBS $PTHREAD_LIBS"
Tomas Cejka50c076e2014-03-18 15:31:10 +010062CPPFLAGS="$xml_CPPFLAGS"
63
Tomas Cejka50c076e2014-03-18 15:31:10 +010064AC_ARG_WITH([notifications],
65[AC_HELP_STRING([--without-notifications], [Disable notifications])],
Tomas Cejkadc8f08d2015-04-29 11:08:24 +020066[AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"],
67[PKG_CHECK_MODULES([websockets], [libwebsockets],
68[CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS"
69LIBS="$LIBS $websockets_LIBS"])])],
70[PKG_CHECK_MODULES([websockets], [libwebsockets],
71[CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS"
72LIBS="$LIBS $websockets_LIBS"])])
Tomas Cejka50c076e2014-03-18 15:31:10 +010073
74# Checks for header files.
75AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
76
77# Checks for typedefs, structures, and compiler characteristics.
78AC_TYPE_INT64_T
79AC_TYPE_SIZE_T
80AC_TYPE_SSIZE_T
81
82# Checks for library functions.
83AC_FUNC_MALLOC
84AC_FUNC_REALLOC
85AC_CHECK_FUNCS([getdelim gettimeofday memset socket strdup strerror])
86
87AC_CONFIG_FILES([Makefile
Tomas Cejka04e08f42014-03-27 19:52:34 +010088 config.h
Tomas Cejka834004f2014-04-27 20:13:39 +020089 mod_netconf.spec
Tomas Cejka50c076e2014-03-18 15:31:10 +010090 src/Makefile
91 ])
92AC_OUTPUT
93
94echo
95echo
96echo "------------------------------------------------------------------------"
97echo "$PACKAGE $VERSION"
98echo "------------------------------------------------------------------------"
99echo
100echo
101echo "Configuration Options Summary:"
102echo
103echo "Documentation..........: ${build_doc}"
104echo
105echo "Compilation............: make (or gmake)"
Michal Vaskoc3146782015-11-04 14:46:41 +0100106echo " CC...................: $CC"
Tomas Cejka50c076e2014-03-18 15:31:10 +0100107echo " LIBS.................: $LIBS"
108echo " CFLAGS...............: $CFLAGS"
109echo
Tomas Cejka50c076e2014-03-18 15:31:10 +0100110echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
111echo " prefix...............: $prefix"
112echo " python module dir....: $pyplugindir"
113echo " webgui dir...........: $webguidir"
114echo " webgui name..........: $webguiname"
Tomas Cejka04e08f42014-03-27 19:52:34 +0100115echo "Su user for process:...............: $SU_USER"
116echo "Su group for process:..............: $SU_GROUP"
117echo "Chown user for sock file:...............: $CHOWN_USER"
118echo "Chown group for sock file:..............: $CHOWN_GROUP"
Tomas Cejka50c076e2014-03-18 15:31:10 +0100119echo
120