blob: ee44d895aea74f4593e143ce86292aa85db7cfeb [file] [log] [blame]
Thomas Graf44d36242007-09-15 01:28:01 +02001#
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 Graf83c762d2013-01-24 15:00:26 +01009# Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch>
Thomas Graf44d36242007-09-15 01:28:01 +020010#
11
Thomas Graf4c210ad2011-09-13 22:58:08 +020012
13# copied from glib
14m4_define([libnl_major_version], [3])
Thomas Haller7b167ef2019-09-01 16:19:02 +020015m4_define([libnl_minor_version], [5])
Thomas Hallerbcdf8742017-03-06 21:28:49 +010016m4_define([libnl_micro_version], [0])
Thomas Haller94e13452014-07-04 19:58:04 +020017m4_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 Grafad5d2b72012-04-26 11:22:49 +020018
19
Thomas Grafb6afd0b2013-01-24 14:34:22 +010020# 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 Grafad5d2b72012-04-26 11:22:49 +020023#
Thomas Grafb6afd0b2013-01-24 14:34:22 +010024# 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 Grafad5d2b72012-04-26 11:22:49 +020028#
Thomas Grafb6afd0b2013-01-24 14:34:22 +010029# 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 Grafad5d2b72012-04-26 11:22:49 +020037
Thomas Hallere01b9df2017-09-20 10:58:20 +020038m4_define([libnl_lt_current], [226])
Thomas Hallerc033ee82016-12-12 15:10:21 +010039m4_define([libnl_lt_revision], [0])
Thomas Hallere01b9df2017-09-20 10:58:20 +020040m4_define([libnl_lt_age], [26])
Thomas Graf4c210ad2011-09-13 22:58:08 +020041
42m4_define([libnl_version],
Thomas Haller3fe34542017-10-09 13:14:55 +020043 [libnl_major_version.libnl_minor_version.libnl_micro_version])
Thomas Graf4c210ad2011-09-13 22:58:08 +020044
Rich Foughta8ef3522012-10-26 12:19:26 -070045AC_INIT(libnl, [libnl_version], [], [], [http://www.infradead.org/~tgr/libnl/])
Jan Engelhardtbf4fd3a2009-06-23 01:12:53 +020046AC_CONFIG_HEADERS([lib/defs.h])
Jan Engelhardtf3cd3fe2012-11-26 20:51:51 +010047AC_CONFIG_AUX_DIR([build-aux])
Jan Engelhardtbf4fd3a2009-06-23 01:12:53 +020048AC_CONFIG_MACRO_DIR([m4])
49AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
Reuben Hawkinsb5c474e2011-02-17 21:28:50 -080050m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)], [])
Jan Engelhardt9d925642012-11-26 20:49:02 +010051m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
Thomas Graf44d36242007-09-15 01:28:01 +020052
Thomas Graf4c210ad2011-09-13 22:58:08 +020053MAJ_VERSION=libnl_major_version
54AC_SUBST(MAJ_VERSION)
55MIN_VERSION=libnl_minor_version
56AC_SUBST(MIN_VERSION)
57MIC_VERSION=libnl_micro_version
58AC_SUBST(MIC_VERSION)
Thomas Haller94e13452014-07-04 19:58:04 +020059LIBNL_GIT_SHA=libnl_git_sha
Thomas Graf4c210ad2011-09-13 22:58:08 +020060LIBNL_VERSION=libnl_version
61AC_SUBST(LIBNL_VERSION)
62
63LT_CURRENT=libnl_lt_current
64AC_SUBST(LT_CURRENT)
65LT_REVISION=libnl_lt_revision
66AC_SUBST(LT_REVISION)
67LT_AGE=libnl_lt_age
68AC_SUBST(LT_AGE)
Thomas Grafd8d67c02011-03-16 13:46:41 +010069
Thomas Graf44d36242007-09-15 01:28:01 +020070AC_PROG_CC
Jan Engelhardtbf4fd3a2009-06-23 01:12:53 +020071AM_PROG_CC_C_O
Thomas Graf44d36242007-09-15 01:28:01 +020072AC_PROG_INSTALL
Jan Engelhardtbf4fd3a2009-06-23 01:12:53 +020073AM_PROG_LIBTOOL
Michał Górny4dc72462014-05-25 11:49:19 +020074AC_PROG_MKDIR_P
Thomas Graf0a9d5fc2012-11-23 16:40:14 +010075AC_CHECK_PROGS(FLEX, 'flex')
Richard Marshalla2c4bd82012-11-19 20:20:22 -080076AC_CHECK_PROGS(YACC, 'bison -y')
Thomas Graf44d36242007-09-15 01:28:01 +020077
78AC_C_CONST
79AC_C_INLINE
80
Thomas Grafead4cde2013-04-27 14:27:10 +020081PKG_CHECK_MODULES([CHECK], [check >= 0.9.0],
Thomas Haller7b375952017-02-26 21:25:28 +010082 [has_check="yes"],
Thomas Grafead4cde2013-04-27 14:27:10 +020083 [AC_MSG_WARN([*** Disabling building of unit tests])
Thomas Haller7b375952017-02-26 21:25:28 +010084 has_check="no"])
85AM_CONDITIONAL(WITH_CHECK, [test "$has_check" = 'yes'])
Thomas Grafe09e7f12013-03-14 16:25:17 +010086
Jan Engelhardtbf4fd3a2009-06-23 01:12:53 +020087AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH],
88 [Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]),
89 [pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
90AC_SUBST([pkgconfigdir])
Thomas Graf44d36242007-09-15 01:28:01 +020091
Karl Hiramoto018c2972010-06-16 16:33:51 +020092AC_ARG_ENABLE([cli],
Thomas Hallerff19c782015-03-18 15:20:28 +010093 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 Hiramoto018c2972010-06-16 16:33:51 +020094 [enable_cli="$enableval"], [enable_cli="yes"])
Thomas Hallerff19c782015-03-18 15:20:28 +010095if test "$enable_cli" != "no" &&
96 test "$enable_cli" != "no-inst" &&
97 test "$enable_cli" != "sbin"; then
98 enable_cli="bin"
99fi
100AM_CONDITIONAL([ENABLE_CLI], [test "$enable_cli" != "no"])
101AM_CONDITIONAL([ENABLE_CLI_INSTALL_BIN], [test "$enable_cli" = "bin"])
102AM_CONDITIONAL([ENABLE_CLI_INSTALL_SBIN], [test "$enable_cli" = "sbin"])
Karl Hiramoto018c2972010-06-16 16:33:51 +0200103
Thomas Hallerc881a272017-05-12 12:47:19 +0200104AC_CHECK_HEADERS(dlfcn.h, [], [])
105
Rich Foughta8ef3522012-10-26 12:19:26 -0700106AC_ARG_ENABLE([pthreads],
107 AS_HELP_STRING([--disable-pthreads], [Disable pthreads support]),
108 [enable_pthreads="$enableval"], [enable_pthreads="yes"])
109AM_CONDITIONAL([DISABLE_PTHREADS], [test "$enable_pthreads" = "no"])
Rich Foughta8ef3522012-10-26 12:19:26 -0700110if test "x$enable_pthreads" = "xno"; then
111 AC_DEFINE([DISABLE_PTHREADS], [1], [Define to 1 to disable pthreads])
112else
113 AC_CHECK_LIB([pthread], [pthread_mutex_lock], [], AC_MSG_ERROR([libpthread is required]))
114fi
Thomas Graf44d36242007-09-15 01:28:01 +0200115
Thomas Hallerf0af5d52017-02-28 00:34:46 +0100116AC_ARG_ENABLE([debug],
117 AS_HELP_STRING([--disable-debug], [Do not include debugging statements]),
118 [enable_debug="$enableval"], [enable_debug="yes"])
Thomas Grafff567102013-04-02 11:39:30 +0200119if test "x$enable_debug" = "xyes"; then
120 AC_DEFINE([NL_DEBUG], [1], [Define to 1 to enable debugging])
121fi
122
Thomas Grafdb138432012-10-19 16:16:06 +0200123AC_CONFIG_SUBDIRS([doc])
124
Alexey Brodkine15966a2017-03-10 17:44:22 +0300125AC_CHECK_FUNCS([strerror_l])
126
Thomas Graf4c210ad2011-09-13 22:58:08 +0200127AC_CONFIG_FILES([
128Makefile
129libnl-3.0.pc
130libnl-route-3.0.pc
131libnl-genl-3.0.pc
132libnl-nf-3.0.pc
Jiří Župkaf90dc632011-10-04 16:06:22 +0200133libnl-cli-3.0.pc
Sruthi Yellamraju91715442014-07-20 15:57:33 +0200134libnl-xfrm-3.0.pc
Sébastien Barré15780952014-09-18 12:17:39 +0200135libnl-idiag-3.0.pc
Thomas Graf4c210ad2011-09-13 22:58:08 +0200136python/setup.py
Thomas Graf4c210ad2011-09-13 22:58:08 +0200137include/netlink/version.h
138])
139
Richard Marshalla2c4bd82012-11-19 20:20:22 -0800140ac_errcount=0
141if test -z "$YACC"; then
142 AC_MSG_WARN(bison not found. Please install before continuing.)
143 ac_errcount=$((ac_errcount + 1))
144fi
Thomas Graf0a9d5fc2012-11-23 16:40:14 +0100145if test -z "$FLEX"; then
146 AC_MSG_WARN(flex not found. Please install before continuing.)
Richard Marshalla2c4bd82012-11-19 20:20:22 -0800147 ac_errcount=$((ac_errcount + 1))
148fi
149if test $ac_errcount -gt 0; then
150 AC_MSG_ERROR(Required packages are missing. Please install them and rerun ./configure)
151fi
152
Jan Engelhardtbf4fd3a2009-06-23 01:12:53 +0200153AC_OUTPUT
Thomas Graf6e5332b2011-09-13 11:49:41 +0200154
Thomas Graf4c210ad2011-09-13 22:58:08 +0200155echo "-------------------------------------------------------------------------------"
156echo " NOTE"
157echo ""
Thomas Grafd3bb7c92011-09-19 11:47:49 +0200158echo " There have been some changes starting with 3.2 regarding where and how libnl"
159echo " is being installed on the system in order to allow multiple libnl versions"
160echo " to be installed in parallel:"
Thomas Graf4c210ad2011-09-13 22:58:08 +0200161echo ""
Thomas Grafd3bb7c92011-09-19 11:47:49 +0200162echo " - Headers will be installed in ${includedir}/libnl${MAJ_VERSION}, therefore"
163echo " you will need to add \"-I/usr/include/libnl${MAJ_VERSION}\" to CFLAGS"
Thomas Graf4c210ad2011-09-13 22:58:08 +0200164echo ""
Thomas Grafd3bb7c92011-09-19 11:47:49 +0200165echo " - The library basename was renamed to libnl-${MAJ_VERSION}, i.e. the SO names become"
166echo " libnl-${MAJ_VERSION}.so., libnl-route-${MAJ_VERSION}.so, etc."
167echo ""
168echo " - libtool versioning was assumed, to ease detection of compatible library"
Thomas Graf2b96c332013-01-22 19:15:34 +0100169echo " versions."
Thomas Grafd3bb7c92011-09-19 11:47:49 +0200170echo ""
171echo " If you are using pkg-config for detecting and linking against the library "
172echo " things will continue magically as if nothing every happened. If you are "
173echo " linking manually you need to adapt your Makefiles or switch to using "
174echo " pkg-config files."
Thomas Graf4c210ad2011-09-13 22:58:08 +0200175echo ""
176echo "-------------------------------------------------------------------------------"
Thomas Graf6e5332b2011-09-13 11:49:41 +0200177