Thomas Haller | 1389188 | 2020-04-16 12:47:42 +0200 | [diff] [blame] | 1 | # SPDX-License-Identifier: LGPL-2.1-only |
| 2 | |
Thomas Graf | 44d3624 | 2007-09-15 01:28:01 +0200 | [diff] [blame] | 3 | # |
Thomas Graf | 83c762d | 2013-01-24 15:00:26 +0100 | [diff] [blame] | 4 | # Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> |
Thomas Graf | 44d3624 | 2007-09-15 01:28:01 +0200 | [diff] [blame] | 5 | # |
| 6 | |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 7 | # copied from glib |
| 8 | m4_define([libnl_major_version], [3]) |
Thomas Haller | fa05d58 | 2024-07-19 11:34:51 +0200 | [diff] [blame] | 9 | m4_define([libnl_minor_version], [10]) |
Thomas Haller | bcdf874 | 2017-03-06 21:28:49 +0100 | [diff] [blame] | 10 | m4_define([libnl_micro_version], [0]) |
Thomas Haller | 94e1345 | 2014-07-04 19:58:04 +0200 | [diff] [blame] | 11 | m4_define([libnl_git_sha], [m4_esyscmd([ ( [ -d ./.git/ ] && [ "$(readlink -f ./.git/)" = "$(readlink -f "$(git rev-parse --git-dir 2>/dev/null)" 2>/dev/null)" ] && git rev-parse --verify -q HEAD 2>/dev/null ) || true ])]) |
Thomas Graf | ad5d2b7 | 2012-04-26 11:22:49 +0200 | [diff] [blame] | 12 | |
| 13 | |
Thomas Graf | b6afd0b | 2013-01-24 14:34:22 +0100 | [diff] [blame] | 14 | # The following explanation may help to understand the above rules a bit |
| 15 | # better: consider that there are three possible kinds of reactions from |
| 16 | # users of your library to changes in a shared library: |
Thomas Graf | ad5d2b7 | 2012-04-26 11:22:49 +0200 | [diff] [blame] | 17 | # |
Thomas Graf | b6afd0b | 2013-01-24 14:34:22 +0100 | [diff] [blame] | 18 | # 1. Programs using the previous version may use the new version as drop-in |
| 19 | # replacement, and programs using the new version can also work with the |
| 20 | # previous one. In other words, no recompiling nor relinking is needed. |
| 21 | # In this case, bump revision only, don't touch current nor age. |
Thomas Graf | ad5d2b7 | 2012-04-26 11:22:49 +0200 | [diff] [blame] | 22 | # |
Thomas Graf | b6afd0b | 2013-01-24 14:34:22 +0100 | [diff] [blame] | 23 | # 2. Programs using the previous version may use the new version as drop-in |
| 24 | # replacement, but programs using the new version may use APIs not |
| 25 | # present in the previous one. In other words, a program linking against |
| 26 | # the new version may fail with “unresolved symbols” if linking against |
| 27 | # the old version at runtime: set revision to 0, bump current and age. |
| 28 | # |
| 29 | # 3. Programs may need to be changed, recompiled, relinked in order to use |
| 30 | # the new version. Bump current, set revision and age to 0. |
Thomas Graf | ad5d2b7 | 2012-04-26 11:22:49 +0200 | [diff] [blame] | 31 | |
Thomas Haller | e01b9df | 2017-09-20 10:58:20 +0200 | [diff] [blame] | 32 | m4_define([libnl_lt_current], [226]) |
Thomas Haller | c033ee8 | 2016-12-12 15:10:21 +0100 | [diff] [blame] | 33 | m4_define([libnl_lt_revision], [0]) |
Thomas Haller | e01b9df | 2017-09-20 10:58:20 +0200 | [diff] [blame] | 34 | m4_define([libnl_lt_age], [26]) |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 35 | |
| 36 | m4_define([libnl_version], |
Thomas Haller | 3fe3454 | 2017-10-09 13:14:55 +0200 | [diff] [blame] | 37 | [libnl_major_version.libnl_minor_version.libnl_micro_version]) |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 38 | |
Thomas Haller | e4402a4 | 2023-08-29 10:12:38 +0200 | [diff] [blame] | 39 | AC_INIT([libnl],[libnl_version],[],[],[http://www.infradead.org/~tgr/libnl/]) |
Thomas Haller | 8952ce6f | 2023-08-02 16:00:37 +0200 | [diff] [blame] | 40 | AC_CONFIG_HEADERS([include/config.h]) |
Jan Engelhardt | f3cd3fe | 2012-11-26 20:51:51 +0100 | [diff] [blame] | 41 | AC_CONFIG_AUX_DIR([build-aux]) |
Jan Engelhardt | bf4fd3a | 2009-06-23 01:12:53 +0200 | [diff] [blame] | 42 | AC_CONFIG_MACRO_DIR([m4]) |
Thomas Haller | 5761b6a | 2023-08-29 10:05:28 +0200 | [diff] [blame] | 43 | AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign subdir-objects]) |
Reuben Hawkins | b5c474e | 2011-02-17 21:28:50 -0800 | [diff] [blame] | 44 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)], []) |
Jan Engelhardt | 9d92564 | 2012-11-26 20:49:02 +0100 | [diff] [blame] | 45 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) |
Thomas Graf | 44d3624 | 2007-09-15 01:28:01 +0200 | [diff] [blame] | 46 | |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 47 | MAJ_VERSION=libnl_major_version |
| 48 | AC_SUBST(MAJ_VERSION) |
| 49 | MIN_VERSION=libnl_minor_version |
| 50 | AC_SUBST(MIN_VERSION) |
| 51 | MIC_VERSION=libnl_micro_version |
| 52 | AC_SUBST(MIC_VERSION) |
Thomas Haller | 94e1345 | 2014-07-04 19:58:04 +0200 | [diff] [blame] | 53 | LIBNL_GIT_SHA=libnl_git_sha |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 54 | LIBNL_VERSION=libnl_version |
| 55 | AC_SUBST(LIBNL_VERSION) |
| 56 | |
| 57 | LT_CURRENT=libnl_lt_current |
| 58 | AC_SUBST(LT_CURRENT) |
| 59 | LT_REVISION=libnl_lt_revision |
| 60 | AC_SUBST(LT_REVISION) |
| 61 | LT_AGE=libnl_lt_age |
| 62 | AC_SUBST(LT_AGE) |
Thomas Graf | d8d67c0 | 2011-03-16 13:46:41 +0100 | [diff] [blame] | 63 | |
Thomas Haller | 9451842 | 2024-05-29 16:10:53 +0200 | [diff] [blame] | 64 | AC_USE_SYSTEM_EXTENSIONS |
| 65 | |
Thomas Graf | 44d3624 | 2007-09-15 01:28:01 +0200 | [diff] [blame] | 66 | AC_PROG_CC |
Jan Engelhardt | bf4fd3a | 2009-06-23 01:12:53 +0200 | [diff] [blame] | 67 | AM_PROG_CC_C_O |
Thomas Haller | 18b74e0 | 2024-05-06 10:39:30 +0200 | [diff] [blame] | 68 | AC_PROG_CXX |
Thomas Graf | 44d3624 | 2007-09-15 01:28:01 +0200 | [diff] [blame] | 69 | AC_PROG_INSTALL |
Thomas Haller | e4402a4 | 2023-08-29 10:12:38 +0200 | [diff] [blame] | 70 | LT_INIT |
Michał Górny | 4dc7246 | 2014-05-25 11:49:19 +0200 | [diff] [blame] | 71 | AC_PROG_MKDIR_P |
Thomas Graf | 0a9d5fc | 2012-11-23 16:40:14 +0100 | [diff] [blame] | 72 | AC_CHECK_PROGS(FLEX, 'flex') |
Richard Marshall | a2c4bd8 | 2012-11-19 20:20:22 -0800 | [diff] [blame] | 73 | AC_CHECK_PROGS(YACC, 'bison -y') |
Thomas Graf | 44d3624 | 2007-09-15 01:28:01 +0200 | [diff] [blame] | 74 | |
| 75 | AC_C_CONST |
| 76 | AC_C_INLINE |
| 77 | |
Thomas Haller | 18b74e0 | 2024-05-06 10:39:30 +0200 | [diff] [blame] | 78 | AC_LANG_PUSH([C++]) |
| 79 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
| 80 | [[#ifndef __cplusplus |
| 81 | #error "broken C++" |
| 82 | #endif]])],, |
| 83 | [CXX=;]) |
| 84 | AC_LANG_POP([C++]) |
| 85 | AM_CONDITIONAL([HAS_CXX], [test "x$CXX" != x]) |
| 86 | |
Thomas Graf | ead4cde | 2013-04-27 14:27:10 +0200 | [diff] [blame] | 87 | PKG_CHECK_MODULES([CHECK], [check >= 0.9.0], |
Thomas Haller | 7b37595 | 2017-02-26 21:25:28 +0100 | [diff] [blame] | 88 | [has_check="yes"], |
Thomas Graf | ead4cde | 2013-04-27 14:27:10 +0200 | [diff] [blame] | 89 | [AC_MSG_WARN([*** Disabling building of unit tests]) |
Thomas Haller | 7b37595 | 2017-02-26 21:25:28 +0100 | [diff] [blame] | 90 | has_check="no"]) |
| 91 | AM_CONDITIONAL(WITH_CHECK, [test "$has_check" = 'yes']) |
Thomas Graf | e09e7f1 | 2013-03-14 16:25:17 +0100 | [diff] [blame] | 92 | |
Jan Engelhardt | bf4fd3a | 2009-06-23 01:12:53 +0200 | [diff] [blame] | 93 | AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH], |
| 94 | [Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]), |
| 95 | [pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig']) |
| 96 | AC_SUBST([pkgconfigdir]) |
Thomas Graf | 44d3624 | 2007-09-15 01:28:01 +0200 | [diff] [blame] | 97 | |
Karl Hiramoto | 018c297 | 2010-06-16 16:33:51 +0200 | [diff] [blame] | 98 | AC_ARG_ENABLE([cli], |
Thomas Haller | ff19c78 | 2015-03-18 15:20:28 +0100 | [diff] [blame] | 99 | AS_HELP_STRING([--enable-cli=yes|no|no-inst|bin|sbin], [Whether to build command line interface utils. Defaults to 'yes' which is a synonym for 'bin'. 'no-inst' means only build, not installing. 'bin'/'sbin' means installing to bin/sbin directory]), |
Karl Hiramoto | 018c297 | 2010-06-16 16:33:51 +0200 | [diff] [blame] | 100 | [enable_cli="$enableval"], [enable_cli="yes"]) |
Thomas Haller | ff19c78 | 2015-03-18 15:20:28 +0100 | [diff] [blame] | 101 | if test "$enable_cli" != "no" && |
| 102 | test "$enable_cli" != "no-inst" && |
| 103 | test "$enable_cli" != "sbin"; then |
| 104 | enable_cli="bin" |
| 105 | fi |
| 106 | AM_CONDITIONAL([ENABLE_CLI], [test "$enable_cli" != "no"]) |
| 107 | AM_CONDITIONAL([ENABLE_CLI_INSTALL_BIN], [test "$enable_cli" = "bin"]) |
| 108 | AM_CONDITIONAL([ENABLE_CLI_INSTALL_SBIN], [test "$enable_cli" = "sbin"]) |
Karl Hiramoto | 018c297 | 2010-06-16 16:33:51 +0200 | [diff] [blame] | 109 | |
Thomas Haller | c881a27 | 2017-05-12 12:47:19 +0200 | [diff] [blame] | 110 | AC_CHECK_HEADERS(dlfcn.h, [], []) |
| 111 | |
Rich Fought | a8ef352 | 2012-10-26 12:19:26 -0700 | [diff] [blame] | 112 | AC_ARG_ENABLE([pthreads], |
| 113 | AS_HELP_STRING([--disable-pthreads], [Disable pthreads support]), |
| 114 | [enable_pthreads="$enableval"], [enable_pthreads="yes"]) |
| 115 | AM_CONDITIONAL([DISABLE_PTHREADS], [test "$enable_pthreads" = "no"]) |
Rich Fought | a8ef352 | 2012-10-26 12:19:26 -0700 | [diff] [blame] | 116 | if test "x$enable_pthreads" = "xno"; then |
| 117 | AC_DEFINE([DISABLE_PTHREADS], [1], [Define to 1 to disable pthreads]) |
| 118 | else |
| 119 | AC_CHECK_LIB([pthread], [pthread_mutex_lock], [], AC_MSG_ERROR([libpthread is required])) |
| 120 | fi |
Thomas Graf | 44d3624 | 2007-09-15 01:28:01 +0200 | [diff] [blame] | 121 | |
Thomas Haller | fa7f97f | 2022-04-15 13:29:49 +0200 | [diff] [blame] | 122 | AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" != "no"]) |
| 123 | |
Thomas Haller | f0af5d5 | 2017-02-28 00:34:46 +0100 | [diff] [blame] | 124 | AC_ARG_ENABLE([debug], |
Thomas Haller | e592dd8 | 2024-04-22 08:51:58 +0200 | [diff] [blame] | 125 | AS_HELP_STRING([--disable-debug], [Do not include debugging statements]), |
| 126 | [enable_debug="$enableval"], [enable_debug="yes"]) |
| 127 | if test "$enable_debug" = "yes"; then |
Thomas Graf | ff56710 | 2013-04-02 11:39:30 +0200 | [diff] [blame] | 128 | AC_DEFINE([NL_DEBUG], [1], [Define to 1 to enable debugging]) |
Thomas Haller | e592dd8 | 2024-04-22 08:51:58 +0200 | [diff] [blame] | 129 | else |
| 130 | enable_debug=no |
| 131 | AC_DEFINE([NL_DEBUG], [0], [Define to 1 to enable debugging]) |
Thomas Graf | ff56710 | 2013-04-02 11:39:30 +0200 | [diff] [blame] | 132 | fi |
| 133 | |
Thomas Graf | db13843 | 2012-10-19 16:16:06 +0200 | [diff] [blame] | 134 | AC_CONFIG_SUBDIRS([doc]) |
| 135 | |
Alexey Brodkin | e15966a | 2017-03-10 17:44:22 +0300 | [diff] [blame] | 136 | AC_CHECK_FUNCS([strerror_l]) |
| 137 | |
Thomas Haller | 40578a6 | 2023-08-18 12:38:40 +0200 | [diff] [blame] | 138 | AC_CHECK_DECLS([getprotobyname_r, getprotobynumber_r], [], [], [[ |
| 139 | #include <netdb.h> |
| 140 | ]]) |
| 141 | |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 142 | AC_CONFIG_FILES([ |
| 143 | Makefile |
| 144 | libnl-3.0.pc |
| 145 | libnl-route-3.0.pc |
| 146 | libnl-genl-3.0.pc |
| 147 | libnl-nf-3.0.pc |
Jiří Župka | f90dc63 | 2011-10-04 16:06:22 +0200 | [diff] [blame] | 148 | libnl-cli-3.0.pc |
Sruthi Yellamraju | 9171544 | 2014-07-20 15:57:33 +0200 | [diff] [blame] | 149 | libnl-xfrm-3.0.pc |
Sébastien Barré | 1578095 | 2014-09-18 12:17:39 +0200 | [diff] [blame] | 150 | libnl-idiag-3.0.pc |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 151 | python/setup.py |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 152 | include/netlink/version.h |
| 153 | ]) |
| 154 | |
Richard Marshall | a2c4bd8 | 2012-11-19 20:20:22 -0800 | [diff] [blame] | 155 | ac_errcount=0 |
| 156 | if test -z "$YACC"; then |
| 157 | AC_MSG_WARN(bison not found. Please install before continuing.) |
| 158 | ac_errcount=$((ac_errcount + 1)) |
| 159 | fi |
Thomas Graf | 0a9d5fc | 2012-11-23 16:40:14 +0100 | [diff] [blame] | 160 | if test -z "$FLEX"; then |
| 161 | AC_MSG_WARN(flex not found. Please install before continuing.) |
Richard Marshall | a2c4bd8 | 2012-11-19 20:20:22 -0800 | [diff] [blame] | 162 | ac_errcount=$((ac_errcount + 1)) |
| 163 | fi |
| 164 | if test $ac_errcount -gt 0; then |
| 165 | AC_MSG_ERROR(Required packages are missing. Please install them and rerun ./configure) |
| 166 | fi |
| 167 | |
Jan Engelhardt | bf4fd3a | 2009-06-23 01:12:53 +0200 | [diff] [blame] | 168 | AC_OUTPUT |
Thomas Graf | 6e5332b | 2011-09-13 11:49:41 +0200 | [diff] [blame] | 169 | |
Thomas Haller | 18b74e0 | 2024-05-06 10:39:30 +0200 | [diff] [blame] | 170 | CXX_MSG="none" |
| 171 | if test "x$CXX" != x ; then |
| 172 | CXX_MSG="[$CXX]" |
| 173 | fi |
| 174 | |
Thomas Haller | 1558bd6 | 2023-08-29 10:32:04 +0200 | [diff] [blame] | 175 | echo |
| 176 | echo "libnl $LIBNL_VERSION configuration${LIBNL_GIT_SHA:+ (git:$LIBNL_GIT_SHA)}:" |
| 177 | echo " --enable-pthreads=$enable_pthreads" |
| 178 | echo " --enable-static=$enable_static" |
| 179 | echo |
| 180 | echo " --enable-debug=$enable_debug" |
| 181 | echo " --enable-cli=$enable_cli" |
| 182 | echo |
| 183 | echo " check: $has_check" |
Thomas Haller | 18b74e0 | 2024-05-06 10:39:30 +0200 | [diff] [blame] | 184 | echo " CXX: $CXX_MSG (only used for tests)" |
Thomas Haller | 1558bd6 | 2023-08-29 10:32:04 +0200 | [diff] [blame] | 185 | echo |