Thomas Graf | 44d3624 | 2007-09-15 01:28:01 +0200 | [diff] [blame] | 1 | # |
| 2 | # configure.in |
| 3 | # |
| 4 | # This library is free software; you can redistribute it and/or |
| 5 | # modify it under the terms of the GNU Lesser General Public |
| 6 | # License as published by the Free Software Foundation version 2.1 |
| 7 | # of the License. |
| 8 | # |
Thomas Graf | 83c762d | 2013-01-24 15:00:26 +0100 | [diff] [blame] | 9 | # Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch> |
Thomas Graf | 44d3624 | 2007-09-15 01:28:01 +0200 | [diff] [blame] | 10 | # |
| 11 | |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 12 | |
| 13 | # copied from glib |
| 14 | m4_define([libnl_major_version], [3]) |
Thomas Haller | 7b167ef | 2019-09-01 16:19:02 +0200 | [diff] [blame] | 15 | m4_define([libnl_minor_version], [5]) |
Thomas Haller | bcdf874 | 2017-03-06 21:28:49 +0100 | [diff] [blame] | 16 | m4_define([libnl_micro_version], [0]) |
Thomas Haller | 94e1345 | 2014-07-04 19:58:04 +0200 | [diff] [blame] | 17 | 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] | 18 | |
| 19 | |
Thomas Graf | b6afd0b | 2013-01-24 14:34:22 +0100 | [diff] [blame] | 20 | # The following explanation may help to understand the above rules a bit |
| 21 | # better: consider that there are three possible kinds of reactions from |
| 22 | # users of your library to changes in a shared library: |
Thomas Graf | ad5d2b7 | 2012-04-26 11:22:49 +0200 | [diff] [blame] | 23 | # |
Thomas Graf | b6afd0b | 2013-01-24 14:34:22 +0100 | [diff] [blame] | 24 | # 1. Programs using the previous version may use the new version as drop-in |
| 25 | # replacement, and programs using the new version can also work with the |
| 26 | # previous one. In other words, no recompiling nor relinking is needed. |
| 27 | # In this case, bump revision only, don't touch current nor age. |
Thomas Graf | ad5d2b7 | 2012-04-26 11:22:49 +0200 | [diff] [blame] | 28 | # |
Thomas Graf | b6afd0b | 2013-01-24 14:34:22 +0100 | [diff] [blame] | 29 | # 2. Programs using the previous version may use the new version as drop-in |
| 30 | # replacement, but programs using the new version may use APIs not |
| 31 | # present in the previous one. In other words, a program linking against |
| 32 | # the new version may fail with “unresolved symbols” if linking against |
| 33 | # the old version at runtime: set revision to 0, bump current and age. |
| 34 | # |
| 35 | # 3. Programs may need to be changed, recompiled, relinked in order to use |
| 36 | # the new version. Bump current, set revision and age to 0. |
Thomas Graf | ad5d2b7 | 2012-04-26 11:22:49 +0200 | [diff] [blame] | 37 | |
Thomas Haller | e01b9df | 2017-09-20 10:58:20 +0200 | [diff] [blame] | 38 | m4_define([libnl_lt_current], [226]) |
Thomas Haller | c033ee8 | 2016-12-12 15:10:21 +0100 | [diff] [blame] | 39 | m4_define([libnl_lt_revision], [0]) |
Thomas Haller | e01b9df | 2017-09-20 10:58:20 +0200 | [diff] [blame] | 40 | m4_define([libnl_lt_age], [26]) |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 41 | |
| 42 | m4_define([libnl_version], |
Thomas Haller | 3fe3454 | 2017-10-09 13:14:55 +0200 | [diff] [blame] | 43 | [libnl_major_version.libnl_minor_version.libnl_micro_version]) |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 44 | |
Rich Fought | a8ef352 | 2012-10-26 12:19:26 -0700 | [diff] [blame] | 45 | AC_INIT(libnl, [libnl_version], [], [], [http://www.infradead.org/~tgr/libnl/]) |
Jan Engelhardt | bf4fd3a | 2009-06-23 01:12:53 +0200 | [diff] [blame] | 46 | AC_CONFIG_HEADERS([lib/defs.h]) |
Jan Engelhardt | f3cd3fe | 2012-11-26 20:51:51 +0100 | [diff] [blame] | 47 | AC_CONFIG_AUX_DIR([build-aux]) |
Jan Engelhardt | bf4fd3a | 2009-06-23 01:12:53 +0200 | [diff] [blame] | 48 | AC_CONFIG_MACRO_DIR([m4]) |
| 49 | AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) |
Reuben Hawkins | b5c474e | 2011-02-17 21:28:50 -0800 | [diff] [blame] | 50 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)], []) |
Jan Engelhardt | 9d92564 | 2012-11-26 20:49:02 +0100 | [diff] [blame] | 51 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) |
Thomas Graf | 44d3624 | 2007-09-15 01:28:01 +0200 | [diff] [blame] | 52 | |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 53 | MAJ_VERSION=libnl_major_version |
| 54 | AC_SUBST(MAJ_VERSION) |
| 55 | MIN_VERSION=libnl_minor_version |
| 56 | AC_SUBST(MIN_VERSION) |
| 57 | MIC_VERSION=libnl_micro_version |
| 58 | AC_SUBST(MIC_VERSION) |
Thomas Haller | 94e1345 | 2014-07-04 19:58:04 +0200 | [diff] [blame] | 59 | LIBNL_GIT_SHA=libnl_git_sha |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 60 | LIBNL_VERSION=libnl_version |
| 61 | AC_SUBST(LIBNL_VERSION) |
| 62 | |
| 63 | LT_CURRENT=libnl_lt_current |
| 64 | AC_SUBST(LT_CURRENT) |
| 65 | LT_REVISION=libnl_lt_revision |
| 66 | AC_SUBST(LT_REVISION) |
| 67 | LT_AGE=libnl_lt_age |
| 68 | AC_SUBST(LT_AGE) |
Thomas Graf | d8d67c0 | 2011-03-16 13:46:41 +0100 | [diff] [blame] | 69 | |
Thomas Graf | 44d3624 | 2007-09-15 01:28:01 +0200 | [diff] [blame] | 70 | AC_PROG_CC |
Jan Engelhardt | bf4fd3a | 2009-06-23 01:12:53 +0200 | [diff] [blame] | 71 | AM_PROG_CC_C_O |
Thomas Graf | 44d3624 | 2007-09-15 01:28:01 +0200 | [diff] [blame] | 72 | AC_PROG_INSTALL |
Jan Engelhardt | bf4fd3a | 2009-06-23 01:12:53 +0200 | [diff] [blame] | 73 | AM_PROG_LIBTOOL |
Michał Górny | 4dc7246 | 2014-05-25 11:49:19 +0200 | [diff] [blame] | 74 | AC_PROG_MKDIR_P |
Thomas Graf | 0a9d5fc | 2012-11-23 16:40:14 +0100 | [diff] [blame] | 75 | AC_CHECK_PROGS(FLEX, 'flex') |
Richard Marshall | a2c4bd8 | 2012-11-19 20:20:22 -0800 | [diff] [blame] | 76 | AC_CHECK_PROGS(YACC, 'bison -y') |
Thomas Graf | 44d3624 | 2007-09-15 01:28:01 +0200 | [diff] [blame] | 77 | |
| 78 | AC_C_CONST |
| 79 | AC_C_INLINE |
| 80 | |
Thomas Graf | ead4cde | 2013-04-27 14:27:10 +0200 | [diff] [blame] | 81 | PKG_CHECK_MODULES([CHECK], [check >= 0.9.0], |
Thomas Haller | 7b37595 | 2017-02-26 21:25:28 +0100 | [diff] [blame] | 82 | [has_check="yes"], |
Thomas Graf | ead4cde | 2013-04-27 14:27:10 +0200 | [diff] [blame] | 83 | [AC_MSG_WARN([*** Disabling building of unit tests]) |
Thomas Haller | 7b37595 | 2017-02-26 21:25:28 +0100 | [diff] [blame] | 84 | has_check="no"]) |
| 85 | AM_CONDITIONAL(WITH_CHECK, [test "$has_check" = 'yes']) |
Thomas Graf | e09e7f1 | 2013-03-14 16:25:17 +0100 | [diff] [blame] | 86 | |
Jan Engelhardt | bf4fd3a | 2009-06-23 01:12:53 +0200 | [diff] [blame] | 87 | AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH], |
| 88 | [Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]), |
| 89 | [pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig']) |
| 90 | AC_SUBST([pkgconfigdir]) |
Thomas Graf | 44d3624 | 2007-09-15 01:28:01 +0200 | [diff] [blame] | 91 | |
Karl Hiramoto | 018c297 | 2010-06-16 16:33:51 +0200 | [diff] [blame] | 92 | AC_ARG_ENABLE([cli], |
Thomas Haller | ff19c78 | 2015-03-18 15:20:28 +0100 | [diff] [blame] | 93 | 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] | 94 | [enable_cli="$enableval"], [enable_cli="yes"]) |
Thomas Haller | ff19c78 | 2015-03-18 15:20:28 +0100 | [diff] [blame] | 95 | if test "$enable_cli" != "no" && |
| 96 | test "$enable_cli" != "no-inst" && |
| 97 | test "$enable_cli" != "sbin"; then |
| 98 | enable_cli="bin" |
| 99 | fi |
| 100 | AM_CONDITIONAL([ENABLE_CLI], [test "$enable_cli" != "no"]) |
| 101 | AM_CONDITIONAL([ENABLE_CLI_INSTALL_BIN], [test "$enable_cli" = "bin"]) |
| 102 | AM_CONDITIONAL([ENABLE_CLI_INSTALL_SBIN], [test "$enable_cli" = "sbin"]) |
Karl Hiramoto | 018c297 | 2010-06-16 16:33:51 +0200 | [diff] [blame] | 103 | |
Thomas Haller | c881a27 | 2017-05-12 12:47:19 +0200 | [diff] [blame] | 104 | AC_CHECK_HEADERS(dlfcn.h, [], []) |
| 105 | |
Rich Fought | a8ef352 | 2012-10-26 12:19:26 -0700 | [diff] [blame] | 106 | AC_ARG_ENABLE([pthreads], |
| 107 | AS_HELP_STRING([--disable-pthreads], [Disable pthreads support]), |
| 108 | [enable_pthreads="$enableval"], [enable_pthreads="yes"]) |
| 109 | AM_CONDITIONAL([DISABLE_PTHREADS], [test "$enable_pthreads" = "no"]) |
Rich Fought | a8ef352 | 2012-10-26 12:19:26 -0700 | [diff] [blame] | 110 | if test "x$enable_pthreads" = "xno"; then |
| 111 | AC_DEFINE([DISABLE_PTHREADS], [1], [Define to 1 to disable pthreads]) |
| 112 | else |
| 113 | AC_CHECK_LIB([pthread], [pthread_mutex_lock], [], AC_MSG_ERROR([libpthread is required])) |
| 114 | fi |
Thomas Graf | 44d3624 | 2007-09-15 01:28:01 +0200 | [diff] [blame] | 115 | |
Thomas Haller | f0af5d5 | 2017-02-28 00:34:46 +0100 | [diff] [blame] | 116 | AC_ARG_ENABLE([debug], |
| 117 | AS_HELP_STRING([--disable-debug], [Do not include debugging statements]), |
| 118 | [enable_debug="$enableval"], [enable_debug="yes"]) |
Thomas Graf | ff56710 | 2013-04-02 11:39:30 +0200 | [diff] [blame] | 119 | if test "x$enable_debug" = "xyes"; then |
| 120 | AC_DEFINE([NL_DEBUG], [1], [Define to 1 to enable debugging]) |
| 121 | fi |
| 122 | |
Thomas Graf | db13843 | 2012-10-19 16:16:06 +0200 | [diff] [blame] | 123 | AC_CONFIG_SUBDIRS([doc]) |
| 124 | |
Alexey Brodkin | e15966a | 2017-03-10 17:44:22 +0300 | [diff] [blame] | 125 | AC_CHECK_FUNCS([strerror_l]) |
| 126 | |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 127 | AC_CONFIG_FILES([ |
| 128 | Makefile |
| 129 | libnl-3.0.pc |
| 130 | libnl-route-3.0.pc |
| 131 | libnl-genl-3.0.pc |
| 132 | libnl-nf-3.0.pc |
Jiří Župka | f90dc63 | 2011-10-04 16:06:22 +0200 | [diff] [blame] | 133 | libnl-cli-3.0.pc |
Sruthi Yellamraju | 9171544 | 2014-07-20 15:57:33 +0200 | [diff] [blame] | 134 | libnl-xfrm-3.0.pc |
Sébastien Barré | 1578095 | 2014-09-18 12:17:39 +0200 | [diff] [blame] | 135 | libnl-idiag-3.0.pc |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 136 | python/setup.py |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 137 | include/netlink/version.h |
| 138 | ]) |
| 139 | |
Richard Marshall | a2c4bd8 | 2012-11-19 20:20:22 -0800 | [diff] [blame] | 140 | ac_errcount=0 |
| 141 | if test -z "$YACC"; then |
| 142 | AC_MSG_WARN(bison not found. Please install before continuing.) |
| 143 | ac_errcount=$((ac_errcount + 1)) |
| 144 | fi |
Thomas Graf | 0a9d5fc | 2012-11-23 16:40:14 +0100 | [diff] [blame] | 145 | if test -z "$FLEX"; then |
| 146 | AC_MSG_WARN(flex not found. Please install before continuing.) |
Richard Marshall | a2c4bd8 | 2012-11-19 20:20:22 -0800 | [diff] [blame] | 147 | ac_errcount=$((ac_errcount + 1)) |
| 148 | fi |
| 149 | if test $ac_errcount -gt 0; then |
| 150 | AC_MSG_ERROR(Required packages are missing. Please install them and rerun ./configure) |
| 151 | fi |
| 152 | |
Jan Engelhardt | bf4fd3a | 2009-06-23 01:12:53 +0200 | [diff] [blame] | 153 | AC_OUTPUT |
Thomas Graf | 6e5332b | 2011-09-13 11:49:41 +0200 | [diff] [blame] | 154 | |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 155 | echo "-------------------------------------------------------------------------------" |
| 156 | echo " NOTE" |
| 157 | echo "" |
Thomas Graf | d3bb7c9 | 2011-09-19 11:47:49 +0200 | [diff] [blame] | 158 | echo " There have been some changes starting with 3.2 regarding where and how libnl" |
| 159 | echo " is being installed on the system in order to allow multiple libnl versions" |
| 160 | echo " to be installed in parallel:" |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 161 | echo "" |
Thomas Graf | d3bb7c9 | 2011-09-19 11:47:49 +0200 | [diff] [blame] | 162 | echo " - Headers will be installed in ${includedir}/libnl${MAJ_VERSION}, therefore" |
| 163 | echo " you will need to add \"-I/usr/include/libnl${MAJ_VERSION}\" to CFLAGS" |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 164 | echo "" |
Thomas Graf | d3bb7c9 | 2011-09-19 11:47:49 +0200 | [diff] [blame] | 165 | echo " - The library basename was renamed to libnl-${MAJ_VERSION}, i.e. the SO names become" |
| 166 | echo " libnl-${MAJ_VERSION}.so., libnl-route-${MAJ_VERSION}.so, etc." |
| 167 | echo "" |
| 168 | echo " - libtool versioning was assumed, to ease detection of compatible library" |
Thomas Graf | 2b96c33 | 2013-01-22 19:15:34 +0100 | [diff] [blame] | 169 | echo " versions." |
Thomas Graf | d3bb7c9 | 2011-09-19 11:47:49 +0200 | [diff] [blame] | 170 | echo "" |
| 171 | echo " If you are using pkg-config for detecting and linking against the library " |
| 172 | echo " things will continue magically as if nothing every happened. If you are " |
| 173 | echo " linking manually you need to adapt your Makefiles or switch to using " |
| 174 | echo " pkg-config files." |
Thomas Graf | 4c210ad | 2011-09-13 22:58:08 +0200 | [diff] [blame] | 175 | echo "" |
| 176 | echo "-------------------------------------------------------------------------------" |
Thomas Graf | 6e5332b | 2011-09-13 11:49:41 +0200 | [diff] [blame] | 177 | |