blob: 2a4a6cbcc6c7272312baf9fb8ffffff4c4082752 [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])
Michal Vaskoda0ab5c2015-11-13 13:24:51 +010058PKG_CHECK_MODULES([yang], [libyang])
Michal Vaskoc3146782015-11-04 14:46:41 +010059AX_PTHREAD([CC="$PTHREAD_CC"], [AC_MSG_ERROR([pthread not found])])
Michal Vaskoda0ab5c2015-11-13 13:24:51 +010060CFLAGS="-Wall -Wextra $json_CFLAGS $netconf_CFLAGS $yang_FLAGS $PTHREAD_CFLAGS"
61LIBS="$json_LIBS $netconf_LIBS $yang_LIBS $PTHREAD_LIBS"
Tomas Cejka50c076e2014-03-18 15:31:10 +010062
Tomas Cejka50c076e2014-03-18 15:31:10 +010063AC_ARG_WITH([notifications],
64[AC_HELP_STRING([--without-notifications], [Disable notifications])],
Tomas Cejkadc8f08d2015-04-29 11:08:24 +020065[AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"],
66[PKG_CHECK_MODULES([websockets], [libwebsockets],
67[CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS"
68LIBS="$LIBS $websockets_LIBS"])])],
69[PKG_CHECK_MODULES([websockets], [libwebsockets],
70[CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS"
71LIBS="$LIBS $websockets_LIBS"])])
Tomas Cejka50c076e2014-03-18 15:31:10 +010072
73# Checks for header files.
74AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
75
76# Checks for typedefs, structures, and compiler characteristics.
77AC_TYPE_INT64_T
78AC_TYPE_SIZE_T
79AC_TYPE_SSIZE_T
80
81# Checks for library functions.
82AC_FUNC_MALLOC
83AC_FUNC_REALLOC
84AC_CHECK_FUNCS([getdelim gettimeofday memset socket strdup strerror])
85
86AC_CONFIG_FILES([Makefile
Tomas Cejka04e08f42014-03-27 19:52:34 +010087 config.h
Tomas Cejka834004f2014-04-27 20:13:39 +020088 mod_netconf.spec
Tomas Cejka50c076e2014-03-18 15:31:10 +010089 src/Makefile
90 ])
91AC_OUTPUT
92
93echo
94echo
95echo "------------------------------------------------------------------------"
96echo "$PACKAGE $VERSION"
97echo "------------------------------------------------------------------------"
98echo
99echo
100echo "Configuration Options Summary:"
101echo
102echo "Documentation..........: ${build_doc}"
103echo
104echo "Compilation............: make (or gmake)"
Michal Vaskoc3146782015-11-04 14:46:41 +0100105echo " CC...................: $CC"
Tomas Cejka50c076e2014-03-18 15:31:10 +0100106echo " LIBS.................: $LIBS"
107echo " CFLAGS...............: $CFLAGS"
108echo
Tomas Cejka50c076e2014-03-18 15:31:10 +0100109echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
110echo " prefix...............: $prefix"
111echo " python module dir....: $pyplugindir"
112echo " webgui dir...........: $webguidir"
113echo " webgui name..........: $webguiname"
Tomas Cejka04e08f42014-03-27 19:52:34 +0100114echo "Su user for process:...............: $SU_USER"
115echo "Su group for process:..............: $SU_GROUP"
116echo "Chown user for sock file:...............: $CHOWN_USER"
117echo "Chown group for sock file:..............: $CHOWN_GROUP"
Tomas Cejka50c076e2014-03-18 15:31:10 +0100118echo
119