blob: b18a2389fda0be7322bd81e60b8a42467518c38d [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])
Michal Vaskoa53ef882015-11-24 11:02:01 +01005AC_INIT([netopeerguid], [1.0.2], [mvasko@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], [""])
Tomas Cejka50c076e2014-03-18 15:31:10 +010043
Tomas Cejka50c076e2014-03-18 15:31:10 +010044# Check for rpmbuild
45AC_CHECK_PROG(RPMBUILD, rpmbuild, rpmbuild, [""])
46RPM_RELEASE=1
47AC_SUBST(RPM_RELEASE)
48AM_CONDITIONAL(MAKE_RPMS, test x$RPMBUILD != x)
49
50# Checks for libraries.
51# save clean LIBS and CFLAGS
52SAVEDTEMP_LIBS=$LIBS
53SAVEDTEMP_CFLAGS=$CFLAGS
Tomas Cejka50c076e2014-03-18 15:31:10 +010054PKG_CHECK_MODULES([json], [json])
Tomas Cejka50c076e2014-03-18 15:31:10 +010055PKG_CHECK_MODULES([netconf], [libnetconf])
Michal Vaskoda0ab5c2015-11-13 13:24:51 +010056PKG_CHECK_MODULES([yang], [libyang])
Michal Vaskoc3146782015-11-04 14:46:41 +010057AX_PTHREAD([CC="$PTHREAD_CC"], [AC_MSG_ERROR([pthread not found])])
Michal Vaskoda0ab5c2015-11-13 13:24:51 +010058CFLAGS="-Wall -Wextra $json_CFLAGS $netconf_CFLAGS $yang_FLAGS $PTHREAD_CFLAGS"
59LIBS="$json_LIBS $netconf_LIBS $yang_LIBS $PTHREAD_LIBS"
Tomas Cejka50c076e2014-03-18 15:31:10 +010060
Tomas Cejka50c076e2014-03-18 15:31:10 +010061AC_ARG_WITH([notifications],
62[AC_HELP_STRING([--without-notifications], [Disable notifications])],
Tomas Cejkadc8f08d2015-04-29 11:08:24 +020063[AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"],
64[PKG_CHECK_MODULES([websockets], [libwebsockets],
65[CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS"
66LIBS="$LIBS $websockets_LIBS"])])],
67[PKG_CHECK_MODULES([websockets], [libwebsockets],
68[CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS"
69LIBS="$LIBS $websockets_LIBS"])])
Tomas Cejka50c076e2014-03-18 15:31:10 +010070
71# Checks for header files.
72AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
73
74# Checks for typedefs, structures, and compiler characteristics.
75AC_TYPE_INT64_T
76AC_TYPE_SIZE_T
77AC_TYPE_SSIZE_T
78
79# Checks for library functions.
80AC_FUNC_MALLOC
81AC_FUNC_REALLOC
82AC_CHECK_FUNCS([getdelim gettimeofday memset socket strdup strerror])
83
84AC_CONFIG_FILES([Makefile
Tomas Cejka04e08f42014-03-27 19:52:34 +010085 config.h
Michal Vaskoa53ef882015-11-24 11:02:01 +010086 netopeerguid.spec
87 src/netopeerguid.rc
Tomas Cejka50c076e2014-03-18 15:31:10 +010088 src/Makefile
89 ])
90AC_OUTPUT
91
92echo
93echo
94echo "------------------------------------------------------------------------"
95echo "$PACKAGE $VERSION"
96echo "------------------------------------------------------------------------"
97echo
98echo
99echo "Configuration Options Summary:"
100echo
101echo "Documentation..........: ${build_doc}"
102echo
103echo "Compilation............: make (or gmake)"
Michal Vaskoc3146782015-11-04 14:46:41 +0100104echo " CC...................: $CC"
Tomas Cejka50c076e2014-03-18 15:31:10 +0100105echo " LIBS.................: $LIBS"
106echo " CFLAGS...............: $CFLAGS"
107echo
Tomas Cejka50c076e2014-03-18 15:31:10 +0100108echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
109echo " prefix...............: $prefix"
110echo " python module dir....: $pyplugindir"
111echo " webgui dir...........: $webguidir"
112echo " webgui name..........: $webguiname"
Tomas Cejka04e08f42014-03-27 19:52:34 +0100113echo "Su user for process:...............: $SU_USER"
114echo "Su group for process:..............: $SU_GROUP"
115echo "Chown user for sock file:...............: $CHOWN_USER"
116echo "Chown group for sock file:..............: $CHOWN_GROUP"
Tomas Cejka50c076e2014-03-18 15:31:10 +0100117echo
118