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 | |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 63 | AC_ARG_WITH([notifications], |
| 64 | [AC_HELP_STRING([--without-notifications], [Disable notifications])], |
Tomas Cejka | dc8f08d | 2015-04-29 11:08:24 +0200 | [diff] [blame] | 65 | [AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"], |
| 66 | [PKG_CHECK_MODULES([websockets], [libwebsockets], |
| 67 | [CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS" |
| 68 | LIBS="$LIBS $websockets_LIBS"])])], |
| 69 | [PKG_CHECK_MODULES([websockets], [libwebsockets], |
| 70 | [CFLAGS="$CFLAGS $websockets_CFLAGS -DWITH_NOTIFICATIONS" |
| 71 | LIBS="$LIBS $websockets_LIBS"])]) |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 72 | |
Michal Vasko | fb93be6 | 2016-03-11 09:52:14 +0100 | [diff] [blame] | 73 | AC_ARG_ENABLE([debug], |
| 74 | AC_HELP_STRING([--enable-debug],[Compile with debug options]), |
Michal Vasko | a719710 | 2016-04-06 11:17:52 +0200 | [diff] [blame^] | 75 | CFLAGS="$CFLAGS -g -O0 -DDBG" |
Michal Vasko | fb93be6 | 2016-03-11 09:52:14 +0100 | [diff] [blame] | 76 | CONFIGURE_PARAMS="--enable-debug $CONFIGURE_PARAMS", |
| 77 | CFLAGS="$CFLAGS -O3" |
| 78 | ) |
| 79 | |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 80 | # Checks for header files. |
| 81 | AC_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. |
| 84 | AC_TYPE_INT64_T |
| 85 | AC_TYPE_SIZE_T |
| 86 | AC_TYPE_SSIZE_T |
| 87 | |
| 88 | # Checks for library functions. |
| 89 | AC_FUNC_MALLOC |
| 90 | AC_FUNC_REALLOC |
| 91 | AC_CHECK_FUNCS([getdelim gettimeofday memset socket strdup strerror]) |
| 92 | |
Tomas Cejka | c95271a | 2016-03-02 09:07:19 +0100 | [diff] [blame] | 93 | # allow to skip systemd, enabled by default |
| 94 | AC_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 | |
| 102 | if 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])]) |
| 110 | else |
| 111 | # disabled systemd |
| 112 | AM_CONDITIONAL([HAVE_SYSTEMD], [false]) |
| 113 | fi |
| 114 | |
| 115 | |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 116 | AC_CONFIG_FILES([Makefile |
Tomas Cejka | 04e08f4 | 2014-03-27 19:52:34 +0100 | [diff] [blame] | 117 | config.h |
Michal Vasko | a53ef88 | 2015-11-24 11:02:01 +0100 | [diff] [blame] | 118 | netopeerguid.spec |
Tomas Cejka | c95271a | 2016-03-02 09:07:19 +0100 | [diff] [blame] | 119 | netopeerguid.service |
Michal Vasko | a53ef88 | 2015-11-24 11:02:01 +0100 | [diff] [blame] | 120 | src/netopeerguid.rc |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 121 | src/Makefile |
| 122 | ]) |
| 123 | AC_OUTPUT |
| 124 | |
| 125 | echo |
| 126 | echo |
| 127 | echo "------------------------------------------------------------------------" |
| 128 | echo "$PACKAGE $VERSION" |
| 129 | echo "------------------------------------------------------------------------" |
| 130 | echo |
| 131 | echo |
| 132 | echo "Configuration Options Summary:" |
| 133 | echo |
| 134 | echo "Documentation..........: ${build_doc}" |
| 135 | echo |
| 136 | echo "Compilation............: make (or gmake)" |
Michal Vasko | c314678 | 2015-11-04 14:46:41 +0100 | [diff] [blame] | 137 | echo " CC...................: $CC" |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 138 | echo " LIBS.................: $LIBS" |
| 139 | echo " CFLAGS...............: $CFLAGS" |
| 140 | echo |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 141 | echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')" |
| 142 | echo " prefix...............: $prefix" |
| 143 | echo " python module dir....: $pyplugindir" |
| 144 | echo " webgui dir...........: $webguidir" |
| 145 | echo " webgui name..........: $webguiname" |
Tomas Cejka | 04e08f4 | 2014-03-27 19:52:34 +0100 | [diff] [blame] | 146 | echo "Su user for process:...............: $SU_USER" |
| 147 | echo "Su group for process:..............: $SU_GROUP" |
| 148 | echo "Chown user for sock file:...............: $CHOWN_USER" |
| 149 | echo "Chown group for sock file:..............: $CHOWN_GROUP" |
Tomas Cejka | 50c076e | 2014-03-18 15:31:10 +0100 | [diff] [blame] | 150 | echo |
| 151 | |