blob: bd51d41ef2451168567b61b488c5674a4198ab25 [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 Cejka18e505a2016-03-14 09:43:46 -040041AC_DEFINE_DIR(absbindir, [bindir], [Path to binaries])
42
Tomas Cejka50c076e2014-03-18 15:31:10 +010043# Check for rpmbuild
44AC_CHECK_PROG(RPMBUILD, [rpmbuild], [rpmbuild], [""])
Tomas Cejka50c076e2014-03-18 15:31:10 +010045
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
Michal Vasko01a4f0e2016-03-15 16:19:59 +010056PKG_CHECK_MODULES([json], [json-c])
Michal Vaskof35ea502016-02-24 10:44:54 +010057PKG_CHECK_MODULES([netconf2], [libnetconf2])
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 Vaskof35ea502016-02-24 10:44:54 +010060CFLAGS="-Wall -Wextra $json_CFLAGS $netconf2_CFLAGS $yang_FLAGS $PTHREAD_CFLAGS"
61LIBS="$json_LIBS $netconf2_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
Michal Vaskofb93be62016-03-11 09:52:14 +010073AC_ARG_ENABLE([debug],
74 AC_HELP_STRING([--enable-debug],[Compile with debug options]),
75 CFLAGS="$CFLAGS -g -O0"
76 CONFIGURE_PARAMS="--enable-debug $CONFIGURE_PARAMS",
77 CFLAGS="$CFLAGS -O3"
78)
79
Tomas Cejka50c076e2014-03-18 15:31:10 +010080# Checks for header files.
81AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
82
83# Checks for typedefs, structures, and compiler characteristics.
84AC_TYPE_INT64_T
85AC_TYPE_SIZE_T
86AC_TYPE_SSIZE_T
87
88# Checks for library functions.
89AC_FUNC_MALLOC
90AC_FUNC_REALLOC
91AC_CHECK_FUNCS([getdelim gettimeofday memset socket strdup strerror])
92
Tomas Cejkac95271a2016-03-02 09:07:19 +010093# allow to skip systemd, enabled by default
94AC_ARG_WITH([systemd],
95 AC_HELP_STRING([--without-systemd], [Disable checking and usage of systemd]),
96 [if test "$withval" = "no"; then
97 withsystemd="no"
98 else
99 withsystemd="yes"
100 fi], [withsystemd="yes"])
101
102if test "x$withsystemd" = "xyes"; then
103 PKG_CHECK_MODULES([systemd], [systemd], [
104 SYSTEMD_UNIT_DIR=$(pkg-config --variable=systemdsystemunitdir systemd)
105 SYSTEMD_SERVICE_FILE="$SYSTEMD_UNIT_DIR/netopeerguid.service"
106 AC_SUBST(SYSTEMD_SERVICE_FILE)
107 AC_SUBST(SYSTEMD_UNIT_DIR)
108 AM_CONDITIONAL([HAVE_SYSTEMD], [true])
109 ], [AM_CONDITIONAL([HAVE_SYSTEMD], [false])])
110else
111 # disabled systemd
112 AM_CONDITIONAL([HAVE_SYSTEMD], [false])
113fi
114
115
Tomas Cejka50c076e2014-03-18 15:31:10 +0100116AC_CONFIG_FILES([Makefile
Tomas Cejka04e08f42014-03-27 19:52:34 +0100117 config.h
Michal Vaskoa53ef882015-11-24 11:02:01 +0100118 netopeerguid.spec
Tomas Cejkac95271a2016-03-02 09:07:19 +0100119 netopeerguid.service
Michal Vaskoa53ef882015-11-24 11:02:01 +0100120 src/netopeerguid.rc
Tomas Cejka50c076e2014-03-18 15:31:10 +0100121 src/Makefile
122 ])
123AC_OUTPUT
124
125echo
126echo
127echo "------------------------------------------------------------------------"
128echo "$PACKAGE $VERSION"
129echo "------------------------------------------------------------------------"
130echo
131echo
132echo "Configuration Options Summary:"
133echo
134echo "Documentation..........: ${build_doc}"
135echo
136echo "Compilation............: make (or gmake)"
Michal Vaskoc3146782015-11-04 14:46:41 +0100137echo " CC...................: $CC"
Tomas Cejka50c076e2014-03-18 15:31:10 +0100138echo " LIBS.................: $LIBS"
139echo " CFLAGS...............: $CFLAGS"
140echo
Tomas Cejka50c076e2014-03-18 15:31:10 +0100141echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
142echo " prefix...............: $prefix"
143echo " python module dir....: $pyplugindir"
144echo " webgui dir...........: $webguidir"
145echo " webgui name..........: $webguiname"
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