summaryrefslogtreecommitdiff
path: root/configure.in
blob: 28d1754296597302531d67a10986a6a9268ad811 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#
# configure.in
#
# 	This library is free software; you can redistribute it and/or
#	modify it under the terms of the GNU Lesser General Public
#	License as published by the Free Software Foundation version 2.1
#	of the License.
#
# Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch>
#


# copied from glib
m4_define([libnl_major_version], [3])
m4_define([libnl_minor_version], [2])
m4_define([libnl_micro_version], [13])


# If either revision or age are omitted, they default to 0. Also note that age
# must be less than or equal to the current interface number.
#
# Here are a set of rules to help you update your library version information:
#
# 1. Start with version information of `0:0:0' for each libtool library.
# 2. Update the version information only immediately before a public release
#    of your software. More frequent updates are unnecessary, and only
#    guarantee that the current interface number gets larger faster.
# 3. If the library source code has changed at all since the last update, then
#    increment revision (`c:r:a' becomes `c:r+1:a').
# 4. If any interfaces have been added, removed, or changed since the last
#    update, increment current, and set revision to 0.
# 5. If any interfaces have been added since the last public release, then
#    increment age.
# 6. If any interfaces have been removed since the last public release, then
#    set age to 0.

m4_define([libnl_lt_current],    [210])
m4_define([libnl_lt_revision],	 [1])
m4_define([libnl_lt_age],        [10])

m4_define([libnl_version],
	  [libnl_major_version.libnl_minor_version.libnl_micro_version])

AC_INIT(libnl, [libnl_version], [http://www.infradead.org/~tgr/libnl/])
AC_CONFIG_HEADERS([lib/defs.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)], [])

MAJ_VERSION=libnl_major_version
AC_SUBST(MAJ_VERSION)
MIN_VERSION=libnl_minor_version
AC_SUBST(MIN_VERSION)
MIC_VERSION=libnl_micro_version
AC_SUBST(MIC_VERSION)
LIBNL_VERSION=libnl_version
AC_SUBST(LIBNL_VERSION)

LT_CURRENT=libnl_lt_current
AC_SUBST(LT_CURRENT)
LT_REVISION=libnl_lt_revision
AC_SUBST(LT_REVISION)
LT_AGE=libnl_lt_age
AC_SUBST(LT_AGE)

AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_INSTALL
AM_PROG_LIBTOOL
AM_PROG_LEX
AC_PROG_YACC

AC_C_CONST
AC_C_INLINE

#
# Generating the documentation
#
AC_ARG_ENABLE([doc],
	      AS_HELP_STRING([--disable-doc], [Do not generate documentation]),
	      [generate_doc="$enableval"], [generate_doc=auto])

if test "x$generate_doc" != "xno"; then
	AC_PROG_SED
	AC_PROG_EGREP

	AX_PYTHON

	AC_CHECK_PROG(HAVE_DOXYGEN, [doxygen], yes, no)
	if test "x$HAVE_DOXYGEN" = "xno" -a "x$generate_doc" = "xyes"; then
		AC_MSG_ERROR([*** doxygen package required to generate documentation])
	fi

	AC_CHECK_PROG(HAVE_DOT, [dot], yes, no)
	if test "x$HAVE_DOT" = "xno"; then
		if test "x$generate_doc" = "xyes"; then
			AC_MSG_ERROR([*** graphviz package required to generate documentation])
		else
			AC_MSG_WARN([*** graphviz not found, disabling building of API reference])
			HAVE_DOXYGEN=no
		fi
	fi

	AC_CHECK_PROG(HAVE_ASCIIDOC, [asciidoc], yes, no)
	if test "x$HAVE_ASCIIDOC" = "xno"; then
		if test "x$generate_doc" = "xyes"; then
			AC_MSG_ERROR([*** asciidoc package required to generate documentation])
		else
			AC_MSG_WARN([*** asciidoc not found, disabling building of guides])
		fi
	fi

	AC_CHECK_PROG(HAVE_SOURCE_HIGHLIGHT, [source-highlight], yes, no)
	if test "x$HAVE_SOURCE_HIGHLIGHT" = "xno"; then
		if test "x$generate_doc" = "xyes"; then
			AC_MSG_ERROR([*** source-highlight required to generate documentation])
		else
			AC_MSG_WARN([*** source-highlight not found, disabling building of guides])
			HAVE_ASCIIDOC=no
		fi
	fi

	AC_CHECK_PROG(HAVE_MSCGEN, [mscgen], yes, no)
	if test "x$HAVE_MSCGEN" = "xno"; then
		AC_MSG_WARN([*** mscgen not found, get it at http://www.mcternan.me.uk/mscgen/])
		if test "x$generate_doc" = "xyes"; then
			AC_MSG_ERROR([*** mscgen package required to generate documentation])
		else
			AC_MSG_WARN([*** Disabling building of guides])
			HAVE_ASCIIDOC=no
			HAVE_DOXYGEN=no
		fi
	fi

	AC_CHECK_PROG(HAVE_PYGMENTIZE, [pygmentize], yes, no)
	if test "x$HAVE_PYGMENTIZE" = "xno"; then
		if test "x$generate_doc" = "xyes"; then
			AC_MSG_ERROR([*** pygmentize package required to generate documentation])
		else
			AC_MSG_WARN([*** Disabling building of guides])
			HAVE_ASCIIDOC=no
		fi
	fi

	link_doc=yes
	if test "x$HAVE_DOXYGEN" = "xno"; then
		AC_MSG_WARN([*** Disabling API linking due to missing doxygen package])
		link_doc=no
	fi
fi

AM_CONDITIONAL([LINK_DOC], [test "x$link_doc" = "xyes"])
AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$HAVE_DOXYGEN" = "xyes"])
AM_CONDITIONAL([HAVE_ASCIIDOC], [test "x$HAVE_ASCIIDOC" = "xyes"])

AM_CONDITIONAL([GENERATE_DOC], [test "x$generate_doc" != "xno"])

AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH],
	[Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]),
	[pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
AC_SUBST([pkgconfigdir])

AC_ARG_ENABLE([cli],
	AS_HELP_STRING([--disable-cli], [Do not build command line interface utils]),
	[enable_cli="$enableval"], [enable_cli="yes"])
AM_CONDITIONAL([ENABLE_CLI], [test "$enable_cli" = "yes"])

AC_CHECK_LIB([m], [pow], [], AC_MSG_ERROR([libm is required]))
AC_CHECK_LIB([pthread], [pthread_mutex_lock], [], AC_MSG_ERROR([libpthread is required]))

AC_CONFIG_FILES([
Makefile
libnl-3.0.pc
libnl-route-3.0.pc
libnl-genl-3.0.pc
libnl-nf-3.0.pc
libnl-cli-3.0.pc
doc/Doxyfile
doc/Makefile
lib/Makefile
include/Makefile
src/Makefile
src/lib/Makefile
tests/Makefile
man/Makefile
python/Makefile
python/setup.py
python/netlink/Makefile
python/netlink/route/Makefile
include/netlink/version.h
])

AC_OUTPUT

echo "-------------------------------------------------------------------------------"
echo "                                  NOTE"
echo ""
echo " There have been some changes starting with 3.2 regarding where and how libnl"
echo " is being installed on the system in order to allow multiple libnl versions"
echo " to be installed in parallel:"
echo ""
echo "    - Headers will be installed in ${includedir}/libnl${MAJ_VERSION}, therefore"
echo "      you will need to add \"-I/usr/include/libnl${MAJ_VERSION}\" to CFLAGS"
echo ""
echo "    - The library basename was renamed to libnl-${MAJ_VERSION}, i.e. the SO names become"
echo "      libnl-${MAJ_VERSION}.so., libnl-route-${MAJ_VERSION}.so, etc."
echo ""
echo "    - libtool versioning was assumed, to ease detection of compatible library"
echo "      versions. libnl-${MAJ_VERSION}.so.CURRENT.REVISION.AGE where."
echo "          CURRENT  := 100 * \$MINOR_VERSION + \$MICRO_VERSION"
echo "          REVISION := nth revision if API was unchanged"
echo "          AGE      := nth revision that is backwards compatible."
echo ""
echo " If you are using pkg-config for detecting and linking against the library "
echo " things will continue magically as if nothing every happened. If you are "
echo " linking manually you need to adapt your Makefiles or switch to using "
echo " pkg-config files."
echo ""
echo "-------------------------------------------------------------------------------"