Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 1 | # -*- Autoconf -*- |
| 2 | # Process this file with autoconf to produce a configure script. |
| 3 | |
| 4 | AC_PREREQ([2.63]) |
Michal Vasko | a53ef88 | 2015-11-24 11:02:01 +0100 | [diff] [blame] | 5 | AC_INIT([netopeerguid], [1.0.2], [mvasko@cesnet.cz]) |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 6 | AM_INIT_AUTOMAKE([silent-rules]) |
| 7 | AM_SILENT_RULES([yes]) |
| 8 | |
| 9 | USERNAME=`git config --get user.name` |
| 10 | USERMAIL=`git config --get user.email` |
| 11 | AC_SUBST(USERNAME) |
| 12 | AC_SUBST(USERMAIL) |
| 13 | |
| 14 | RELEASE=1 |
| 15 | AC_SUBST(RELEASE) |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 16 | |
Tomas Cejka | 04e08f4 | 2014-03-27 19:52:34 +0100 | [diff] [blame] | 17 | AC_ARG_VAR(SU_USER, [Change UID of process according to username.]) |
| 18 | if test "x$SU_USER" == x; then |
| 19 | SU_USER="" |
| 20 | fi |
| 21 | AC_SUBST([SU_USER]) |
| 22 | |
| 23 | AC_ARG_VAR(SU_GROUP, [Change GID of process according to groupname.]) |
| 24 | if test "x$SU_GROUP" == x; then |
| 25 | SU_GROUP="" |
| 26 | fi |
| 27 | AC_SUBST([SU_GROUP]) |
| 28 | |
| 29 | AC_ARG_VAR(CHOWN_USER, [Use chown (user) on socket file.]) |
| 30 | if test "x$CHOWN_USER" == x; then |
| 31 | CHOWN_USER="" |
| 32 | fi |
| 33 | AC_SUBST([CHOWN_USER]) |
| 34 | |
| 35 | AC_ARG_VAR(CHOWN_GROUP, [Use chown (group) on socket file.]) |
| 36 | if test "x$CHOWN_GROUP" == x; then |
| 37 | CHOWN_GROUP="" |
| 38 | fi |
| 39 | AC_SUBST([CHOWN_GROUP]) |
| 40 | |
Tomas Cejka | 18e505a | 2016-03-14 09:43:46 -0400 | [diff] [blame] | 41 | AC_DEFINE_DIR(absbindir, [bindir], [Path to binaries]) |
| 42 | |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 43 | # Check for rpmbuild |
| 44 | AC_CHECK_PROG(RPMBUILD, [rpmbuild], [rpmbuild], [""]) |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 45 | |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 46 | # Check for rpmbuild |
| 47 | AC_CHECK_PROG(RPMBUILD, rpmbuild, rpmbuild, [""]) |
| 48 | RPM_RELEASE=1 |
| 49 | AC_SUBST(RPM_RELEASE) |
| 50 | AM_CONDITIONAL(MAKE_RPMS, test x$RPMBUILD != x) |
| 51 | |
| 52 | # Checks for libraries. |
| 53 | # save clean LIBS and CFLAGS |
| 54 | SAVEDTEMP_LIBS=$LIBS |
| 55 | SAVEDTEMP_CFLAGS=$CFLAGS |
Michal Vasko | 01a4f0e | 2016-03-15 16:19:59 +0100 | [diff] [blame] | 56 | PKG_CHECK_MODULES([json], [json-c]) |
Michal Vasko | f35ea50 | 2016-02-24 10:44:54 +0100 | [diff] [blame] | 57 | PKG_CHECK_MODULES([netconf2], [libnetconf2]) |
Michal Vasko | da0ab5c | 2015-11-13 13:24:51 +0100 | [diff] [blame] | 58 | PKG_CHECK_MODULES([yang], [libyang]) |
Michal Vasko | c314678 | 2015-11-04 14:46:41 +0100 | [diff] [blame] | 59 | AX_PTHREAD([CC="$PTHREAD_CC"], [AC_MSG_ERROR([pthread not found])]) |
Michal Vasko | f35ea50 | 2016-02-24 10:44:54 +0100 | [diff] [blame] | 60 | CFLAGS="-Wall -Wextra $json_CFLAGS $netconf2_CFLAGS $yang_FLAGS $PTHREAD_CFLAGS" |
| 61 | LIBS="$json_LIBS $netconf2_LIBS $yang_LIBS $PTHREAD_LIBS" |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 62 | |
Michal Vasko | dd2c41d | 2016-09-06 11:25:57 +0200 | [diff] [blame^] | 63 | AC_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 | ) |
| 68 | AC_SUBST([CERT_PATH]) |
| 69 | |
| 70 | AC_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 | ) |
| 75 | AC_SUBST([PRIVKEY_PATH]) |
| 76 | |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 77 | AC_ARG_WITH([notifications], |
| 78 | [AC_HELP_STRING([--without-notifications], [Disable notifications])], |
Tomas Cejka | dc8f08d | 2015-04-29 11:08:24 +0200 | [diff] [blame] | 79 | [AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"], |
| 80 | [PKG_CHECK_MODULES([websockets], [libwebsockets], |
| 81 | [CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS" |
| 82 | LIBS="$LIBS $websockets_LIBS"])])], |
| 83 | [PKG_CHECK_MODULES([websockets], [libwebsockets], |
| 84 | [CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS" |
| 85 | LIBS="$LIBS $websockets_LIBS"])]) |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 86 | |
Michal Vasko | fb93be6 | 2016-03-11 09:52:14 +0100 | [diff] [blame] | 87 | AC_ARG_ENABLE([debug], |
| 88 | AC_HELP_STRING([--enable-debug],[Compile with debug options]), |
Michal Vasko | a719710 | 2016-04-06 11:17:52 +0200 | [diff] [blame] | 89 | CFLAGS="$CFLAGS -g -O0 -DDBG" |
Michal Vasko | fb93be6 | 2016-03-11 09:52:14 +0100 | [diff] [blame] | 90 | CONFIGURE_PARAMS="--enable-debug $CONFIGURE_PARAMS", |
| 91 | CFLAGS="$CFLAGS -O3" |
| 92 | ) |
| 93 | |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 94 | # Checks for header files. |
| 95 | AC_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. |
| 98 | AC_TYPE_INT64_T |
| 99 | AC_TYPE_SIZE_T |
| 100 | AC_TYPE_SSIZE_T |
| 101 | |
| 102 | # Checks for library functions. |
| 103 | AC_FUNC_MALLOC |
| 104 | AC_FUNC_REALLOC |
| 105 | AC_CHECK_FUNCS([getdelim gettimeofday memset socket strdup strerror]) |
| 106 | |
Tomas Cejka | c95271a | 2016-03-02 09:07:19 +0100 | [diff] [blame] | 107 | # allow to skip systemd, enabled by default |
| 108 | AC_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 | |
| 116 | if 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])]) |
| 124 | else |
| 125 | # disabled systemd |
| 126 | AM_CONDITIONAL([HAVE_SYSTEMD], [false]) |
| 127 | fi |
| 128 | |
| 129 | |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 130 | AC_CONFIG_FILES([Makefile |
Tomas Cejka | 04e08f4 | 2014-03-27 19:52:34 +0100 | [diff] [blame] | 131 | config.h |
Michal Vasko | a53ef88 | 2015-11-24 11:02:01 +0100 | [diff] [blame] | 132 | netopeerguid.spec |
Tomas Cejka | c95271a | 2016-03-02 09:07:19 +0100 | [diff] [blame] | 133 | netopeerguid.service |
Michal Vasko | a53ef88 | 2015-11-24 11:02:01 +0100 | [diff] [blame] | 134 | src/netopeerguid.rc |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 135 | src/Makefile |
| 136 | ]) |
| 137 | AC_OUTPUT |
| 138 | |
| 139 | echo |
| 140 | echo |
| 141 | echo "------------------------------------------------------------------------" |
| 142 | echo "$PACKAGE $VERSION" |
| 143 | echo "------------------------------------------------------------------------" |
| 144 | echo |
| 145 | echo |
| 146 | echo "Configuration Options Summary:" |
| 147 | echo |
| 148 | echo "Documentation..........: ${build_doc}" |
| 149 | echo |
| 150 | echo "Compilation............: make (or gmake)" |
Michal Vasko | c314678 | 2015-11-04 14:46:41 +0100 | [diff] [blame] | 151 | echo " CC...................: $CC" |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 152 | echo " LIBS.................: $LIBS" |
| 153 | echo " CFLAGS...............: $CFLAGS" |
| 154 | echo |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 155 | echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')" |
| 156 | echo " prefix...............: $prefix" |
Tomas Cejka | 04e08f4 | 2014-03-27 19:52:34 +0100 | [diff] [blame] | 157 | echo "Su user for process:...............: $SU_USER" |
| 158 | echo "Su group for process:..............: $SU_GROUP" |
| 159 | echo "Chown user for sock file:...............: $CHOWN_USER" |
| 160 | echo "Chown group for sock file:..............: $CHOWN_GROUP" |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 161 | echo |
| 162 | |