blob: cd271f523cd8e92c0ce0e7da9b695293293b6eaf [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
Michal Vaskodd2c41d2016-09-06 11:25:57 +020063AC_ARG_WITH([cert-path],
64 AC_HELP_STRING([--with-cert-path], [Set notification server certificate]),
65 CERT_PATH="$withval",
66 AC_MSG_ERROR([Certificate path must be set.])
67)
68AC_SUBST([CERT_PATH])
69
70AC_ARG_WITH([private-key-path],
71 AC_HELP_STRING([--with-private-key-path], [Set notification server private key]),
72 PRIVKEY_PATH="$withval",
73 AC_MSG_ERROR([Private key path must be set.])
74)
75AC_SUBST([PRIVKEY_PATH])
76
Tomas Cejka50c076e2014-03-18 15:31:10 +010077AC_ARG_WITH([notifications],
78[AC_HELP_STRING([--without-notifications], [Disable notifications])],
Tomas Cejkadc8f08d2015-04-29 11:08:24 +020079[AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"],
80[PKG_CHECK_MODULES([websockets], [libwebsockets],
81[CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS"
82LIBS="$LIBS $websockets_LIBS"])])],
83[PKG_CHECK_MODULES([websockets], [libwebsockets],
84[CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS"
85LIBS="$LIBS $websockets_LIBS"])])
Tomas Cejka50c076e2014-03-18 15:31:10 +010086
Michal Vaskofb93be62016-03-11 09:52:14 +010087AC_ARG_ENABLE([debug],
88 AC_HELP_STRING([--enable-debug],[Compile with debug options]),
Michal Vaskoa7197102016-04-06 11:17:52 +020089 CFLAGS="$CFLAGS -g -O0 -DDBG"
Michal Vaskofb93be62016-03-11 09:52:14 +010090 CONFIGURE_PARAMS="--enable-debug $CONFIGURE_PARAMS",
91 CFLAGS="$CFLAGS -O3"
92)
93
Tomas Cejka50c076e2014-03-18 15:31:10 +010094# Checks for header files.
95AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
96
97# Checks for typedefs, structures, and compiler characteristics.
98AC_TYPE_INT64_T
99AC_TYPE_SIZE_T
100AC_TYPE_SSIZE_T
101
102# Checks for library functions.
103AC_FUNC_MALLOC
104AC_FUNC_REALLOC
105AC_CHECK_FUNCS([getdelim gettimeofday memset socket strdup strerror])
106
Tomas Cejkac95271a2016-03-02 09:07:19 +0100107# allow to skip systemd, enabled by default
108AC_ARG_WITH([systemd],
109 AC_HELP_STRING([--without-systemd], [Disable checking and usage of systemd]),
110 [if test "$withval" = "no"; then
111 withsystemd="no"
112 else
113 withsystemd="yes"
114 fi], [withsystemd="yes"])
115
116if test "x$withsystemd" = "xyes"; then
117 PKG_CHECK_MODULES([systemd], [systemd], [
118 SYSTEMD_UNIT_DIR=$(pkg-config --variable=systemdsystemunitdir systemd)
119 SYSTEMD_SERVICE_FILE="$SYSTEMD_UNIT_DIR/netopeerguid.service"
120 AC_SUBST(SYSTEMD_SERVICE_FILE)
121 AC_SUBST(SYSTEMD_UNIT_DIR)
122 AM_CONDITIONAL([HAVE_SYSTEMD], [true])
123 ], [AM_CONDITIONAL([HAVE_SYSTEMD], [false])])
124else
125 # disabled systemd
126 AM_CONDITIONAL([HAVE_SYSTEMD], [false])
127fi
128
129
Tomas Cejka50c076e2014-03-18 15:31:10 +0100130AC_CONFIG_FILES([Makefile
Tomas Cejka04e08f42014-03-27 19:52:34 +0100131 config.h
Michal Vaskoa53ef882015-11-24 11:02:01 +0100132 netopeerguid.spec
Tomas Cejkac95271a2016-03-02 09:07:19 +0100133 netopeerguid.service
Michal Vaskoa53ef882015-11-24 11:02:01 +0100134 src/netopeerguid.rc
Tomas Cejka50c076e2014-03-18 15:31:10 +0100135 src/Makefile
136 ])
137AC_OUTPUT
138
139echo
140echo
141echo "------------------------------------------------------------------------"
142echo "$PACKAGE $VERSION"
143echo "------------------------------------------------------------------------"
144echo
145echo
146echo "Configuration Options Summary:"
147echo
148echo "Documentation..........: ${build_doc}"
149echo
150echo "Compilation............: make (or gmake)"
Michal Vaskoc3146782015-11-04 14:46:41 +0100151echo " CC...................: $CC"
Tomas Cejka50c076e2014-03-18 15:31:10 +0100152echo " LIBS.................: $LIBS"
153echo " CFLAGS...............: $CFLAGS"
154echo
Tomas Cejka50c076e2014-03-18 15:31:10 +0100155echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
156echo " prefix...............: $prefix"
Tomas Cejka04e08f42014-03-27 19:52:34 +0100157echo "Su user for process:...............: $SU_USER"
158echo "Su group for process:..............: $SU_GROUP"
159echo "Chown user for sock file:...............: $CHOWN_USER"
160echo "Chown group for sock file:..............: $CHOWN_GROUP"
Tomas Cejka50c076e2014-03-18 15:31:10 +0100161echo
162