• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# SPDX-License-Identifier: LGPL-2.1-only
2
3#
4# Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch>
5#
6
7# copied from glib
8m4_define([libnl_major_version], [3])
9m4_define([libnl_minor_version], [7])
10m4_define([libnl_micro_version], [0])
11m4_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 ])])
12
13
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:
17#
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.
22#
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.
31
32m4_define([libnl_lt_current],    [226])
33m4_define([libnl_lt_revision],   [0])
34m4_define([libnl_lt_age],        [26])
35
36m4_define([libnl_version],
37	  [libnl_major_version.libnl_minor_version.libnl_micro_version])
38
39AC_INIT(libnl, [libnl_version], [], [], [http://www.infradead.org/~tgr/libnl/])
40AC_CONFIG_HEADERS([lib/defs.h])
41AC_CONFIG_AUX_DIR([build-aux])
42AC_CONFIG_MACRO_DIR([m4])
43AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
44m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)], [])
45m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
46
47MAJ_VERSION=libnl_major_version
48AC_SUBST(MAJ_VERSION)
49MIN_VERSION=libnl_minor_version
50AC_SUBST(MIN_VERSION)
51MIC_VERSION=libnl_micro_version
52AC_SUBST(MIC_VERSION)
53LIBNL_GIT_SHA=libnl_git_sha
54LIBNL_VERSION=libnl_version
55AC_SUBST(LIBNL_VERSION)
56
57LT_CURRENT=libnl_lt_current
58AC_SUBST(LT_CURRENT)
59LT_REVISION=libnl_lt_revision
60AC_SUBST(LT_REVISION)
61LT_AGE=libnl_lt_age
62AC_SUBST(LT_AGE)
63
64AC_PROG_CC
65AM_PROG_CC_C_O
66AC_PROG_INSTALL
67AM_PROG_LIBTOOL
68AC_PROG_MKDIR_P
69AC_CHECK_PROGS(FLEX, 'flex')
70AC_CHECK_PROGS(YACC, 'bison -y')
71
72AC_C_CONST
73AC_C_INLINE
74
75PKG_CHECK_MODULES([CHECK], [check >= 0.9.0],
76	[has_check="yes"],
77	[AC_MSG_WARN([*** Disabling building of unit tests])
78	 has_check="no"])
79AM_CONDITIONAL(WITH_CHECK, [test "$has_check" = 'yes'])
80
81AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH],
82	[Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]),
83	[pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
84AC_SUBST([pkgconfigdir])
85
86AC_ARG_ENABLE([cli],
87	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]),
88	[enable_cli="$enableval"], [enable_cli="yes"])
89if test "$enable_cli" != "no" &&
90   test "$enable_cli" != "no-inst" &&
91   test "$enable_cli" != "sbin"; then
92	enable_cli="bin"
93fi
94AM_CONDITIONAL([ENABLE_CLI], [test "$enable_cli" != "no"])
95AM_CONDITIONAL([ENABLE_CLI_INSTALL_BIN], [test "$enable_cli" = "bin"])
96AM_CONDITIONAL([ENABLE_CLI_INSTALL_SBIN], [test "$enable_cli" = "sbin"])
97
98AC_CHECK_HEADERS(dlfcn.h, [], [])
99
100AC_ARG_ENABLE([pthreads],
101	AS_HELP_STRING([--disable-pthreads], [Disable pthreads support]),
102	[enable_pthreads="$enableval"], [enable_pthreads="yes"])
103AM_CONDITIONAL([DISABLE_PTHREADS], [test "$enable_pthreads" = "no"])
104if test "x$enable_pthreads" = "xno"; then
105    AC_DEFINE([DISABLE_PTHREADS], [1], [Define to 1 to disable pthreads])
106else
107    AC_CHECK_LIB([pthread], [pthread_mutex_lock], [], AC_MSG_ERROR([libpthread is required]))
108fi
109
110AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" != "no"])
111
112AC_ARG_ENABLE([debug],
113	AS_HELP_STRING([--disable-debug], [Do not include debugging statements]),
114	[enable_debug="$enableval"], [enable_debug="yes"])
115if test "x$enable_debug" = "xyes"; then
116    AC_DEFINE([NL_DEBUG], [1], [Define to 1 to enable debugging])
117fi
118
119AC_CONFIG_SUBDIRS([doc])
120
121AC_CHECK_FUNCS([strerror_l])
122
123AC_CONFIG_FILES([
124Makefile
125libnl-3.0.pc
126libnl-route-3.0.pc
127libnl-genl-3.0.pc
128libnl-nf-3.0.pc
129libnl-cli-3.0.pc
130libnl-xfrm-3.0.pc
131libnl-idiag-3.0.pc
132python/setup.py
133include/netlink/version.h
134])
135
136ac_errcount=0
137if test -z "$YACC"; then
138    AC_MSG_WARN(bison not found. Please install before continuing.)
139    ac_errcount=$((ac_errcount + 1))
140fi
141if test -z "$FLEX"; then
142    AC_MSG_WARN(flex not found. Please install before continuing.)
143    ac_errcount=$((ac_errcount + 1))
144fi
145if test $ac_errcount -gt 0; then
146    AC_MSG_ERROR(Required packages are missing. Please install them and rerun ./configure)
147fi
148
149AC_OUTPUT
150
151echo "-------------------------------------------------------------------------------"
152echo "                                  NOTE"
153echo ""
154echo " There have been some changes starting with 3.2 regarding where and how libnl"
155echo " is being installed on the system in order to allow multiple libnl versions"
156echo " to be installed in parallel:"
157echo ""
158echo "    - Headers will be installed in ${includedir}/libnl${MAJ_VERSION}, therefore"
159echo "      you will need to add \"-I/usr/include/libnl${MAJ_VERSION}\" to CFLAGS"
160echo ""
161echo "    - The library basename was renamed to libnl-${MAJ_VERSION}, i.e. the SO names become"
162echo "      libnl-${MAJ_VERSION}.so., libnl-route-${MAJ_VERSION}.so, etc."
163echo ""
164echo "    - libtool versioning was assumed, to ease detection of compatible library"
165echo "      versions."
166echo ""
167echo " If you are using pkg-config for detecting and linking against the library "
168echo " things will continue magically as if nothing every happened. If you are "
169echo " linking manually you need to adapt your Makefiles or switch to using "
170echo " pkg-config files."
171echo ""
172echo "-------------------------------------------------------------------------------"
173
174