blob: 2c315522bd58e1a301d15025cb5348b8557959e3 [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 Grafd7222e52012-01-11 12:51:03 +01009# Copyright (c) 2003-2012 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])
15m4_define([libnl_minor_version], [2])
Thomas Graf6b4a2cb2013-01-17 14:02:35 +010016m4_define([libnl_micro_version], [19])
Thomas Grafad5d2b72012-04-26 11:22:49 +020017
18
19# If either revision or age are omitted, they default to 0. Also note that age
20# must be less than or equal to the current interface number.
21#
22# Here are a set of rules to help you update your library version information:
23#
24# 1. Start with version information of `0:0:0' for each libtool library.
25# 2. Update the version information only immediately before a public release
26# of your software. More frequent updates are unnecessary, and only
27# guarantee that the current interface number gets larger faster.
28# 3. If the library source code has changed at all since the last update, then
29# increment revision (`c:r:a' becomes `c:r+1:a').
30# 4. If any interfaces have been added, removed, or changed since the last
31# update, increment current, and set revision to 0.
32# 5. If any interfaces have been added since the last public release, then
33# increment age.
34# 6. If any interfaces have been removed since the last public release, then
35# set age to 0.
36
Thomas Graf75591572013-01-22 19:07:09 +010037m4_define([libnl_lt_current], [216])
Thomas Graf6b4a2cb2013-01-17 14:02:35 +010038m4_define([libnl_lt_revision], [0])
Thomas Graf75591572013-01-22 19:07:09 +010039m4_define([libnl_lt_age], [16])
Thomas Graf4c210ad2011-09-13 22:58:08 +020040
41m4_define([libnl_version],
42 [libnl_major_version.libnl_minor_version.libnl_micro_version])
43
Rich Foughta8ef3522012-10-26 12:19:26 -070044AC_INIT(libnl, [libnl_version], [], [], [http://www.infradead.org/~tgr/libnl/])
Jan Engelhardtbf4fd3a2009-06-23 01:12:53 +020045AC_CONFIG_HEADERS([lib/defs.h])
Jan Engelhardtf3cd3fe2012-11-26 20:51:51 +010046AC_CONFIG_AUX_DIR([build-aux])
Jan Engelhardtbf4fd3a2009-06-23 01:12:53 +020047AC_CONFIG_MACRO_DIR([m4])
48AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
Reuben Hawkinsb5c474e2011-02-17 21:28:50 -080049m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)], [])
Jan Engelhardt9d925642012-11-26 20:49:02 +010050m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
Thomas Graf44d36242007-09-15 01:28:01 +020051
Thomas Graf4c210ad2011-09-13 22:58:08 +020052MAJ_VERSION=libnl_major_version
53AC_SUBST(MAJ_VERSION)
54MIN_VERSION=libnl_minor_version
55AC_SUBST(MIN_VERSION)
56MIC_VERSION=libnl_micro_version
57AC_SUBST(MIC_VERSION)
58LIBNL_VERSION=libnl_version
59AC_SUBST(LIBNL_VERSION)
60
61LT_CURRENT=libnl_lt_current
62AC_SUBST(LT_CURRENT)
63LT_REVISION=libnl_lt_revision
64AC_SUBST(LT_REVISION)
65LT_AGE=libnl_lt_age
66AC_SUBST(LT_AGE)
Thomas Grafd8d67c02011-03-16 13:46:41 +010067
Thomas Graf44d36242007-09-15 01:28:01 +020068AC_PROG_CC
Jan Engelhardtbf4fd3a2009-06-23 01:12:53 +020069AM_PROG_CC_C_O
Thomas Graf44d36242007-09-15 01:28:01 +020070AC_PROG_INSTALL
Jan Engelhardtbf4fd3a2009-06-23 01:12:53 +020071AM_PROG_LIBTOOL
Thomas Graf0a9d5fc2012-11-23 16:40:14 +010072AC_CHECK_PROGS(FLEX, 'flex')
Richard Marshalla2c4bd82012-11-19 20:20:22 -080073AC_CHECK_PROGS(YACC, 'bison -y')
Thomas Graf44d36242007-09-15 01:28:01 +020074
75AC_C_CONST
76AC_C_INLINE
77
Jan Engelhardtbf4fd3a2009-06-23 01:12:53 +020078AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH],
79 [Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]),
80 [pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
81AC_SUBST([pkgconfigdir])
Thomas Graf44d36242007-09-15 01:28:01 +020082
Karl Hiramoto018c2972010-06-16 16:33:51 +020083AC_ARG_ENABLE([cli],
84 AS_HELP_STRING([--disable-cli], [Do not build command line interface utils]),
85 [enable_cli="$enableval"], [enable_cli="yes"])
86AM_CONDITIONAL([ENABLE_CLI], [test "$enable_cli" = "yes"])
87
Rich Foughta8ef3522012-10-26 12:19:26 -070088AC_ARG_ENABLE([pthreads],
89 AS_HELP_STRING([--disable-pthreads], [Disable pthreads support]),
90 [enable_pthreads="$enableval"], [enable_pthreads="yes"])
91AM_CONDITIONAL([DISABLE_PTHREADS], [test "$enable_pthreads" = "no"])
92
Jan Engelhardtbf4fd3a2009-06-23 01:12:53 +020093AC_CHECK_LIB([m], [pow], [], AC_MSG_ERROR([libm is required]))
Rich Foughta8ef3522012-10-26 12:19:26 -070094
95if test "x$enable_pthreads" = "xno"; then
96 AC_DEFINE([DISABLE_PTHREADS], [1], [Define to 1 to disable pthreads])
97else
98 AC_CHECK_LIB([pthread], [pthread_mutex_lock], [], AC_MSG_ERROR([libpthread is required]))
99fi
Thomas Graf44d36242007-09-15 01:28:01 +0200100
Thomas Grafdb138432012-10-19 16:16:06 +0200101AC_CONFIG_SUBDIRS([doc])
102
Thomas Graf4c210ad2011-09-13 22:58:08 +0200103AC_CONFIG_FILES([
104Makefile
105libnl-3.0.pc
106libnl-route-3.0.pc
107libnl-genl-3.0.pc
108libnl-nf-3.0.pc
Jiří Župkaf90dc632011-10-04 16:06:22 +0200109libnl-cli-3.0.pc
Thomas Graf4c210ad2011-09-13 22:58:08 +0200110lib/Makefile
111include/Makefile
112src/Makefile
113src/lib/Makefile
Thomas Graf9af54692012-04-21 10:34:43 +0200114tests/Makefile
Thomas Graf4c210ad2011-09-13 22:58:08 +0200115man/Makefile
116python/Makefile
117python/setup.py
118python/netlink/Makefile
119python/netlink/route/Makefile
120include/netlink/version.h
121])
122
Richard Marshalla2c4bd82012-11-19 20:20:22 -0800123ac_errcount=0
124if test -z "$YACC"; then
125 AC_MSG_WARN(bison not found. Please install before continuing.)
126 ac_errcount=$((ac_errcount + 1))
127fi
Thomas Graf0a9d5fc2012-11-23 16:40:14 +0100128if test -z "$FLEX"; then
129 AC_MSG_WARN(flex not found. Please install before continuing.)
Richard Marshalla2c4bd82012-11-19 20:20:22 -0800130 ac_errcount=$((ac_errcount + 1))
131fi
132if test $ac_errcount -gt 0; then
133 AC_MSG_ERROR(Required packages are missing. Please install them and rerun ./configure)
134fi
135
Jan Engelhardtbf4fd3a2009-06-23 01:12:53 +0200136AC_OUTPUT
Thomas Graf6e5332b2011-09-13 11:49:41 +0200137
Thomas Graf4c210ad2011-09-13 22:58:08 +0200138echo "-------------------------------------------------------------------------------"
139echo " NOTE"
140echo ""
Thomas Grafd3bb7c92011-09-19 11:47:49 +0200141echo " There have been some changes starting with 3.2 regarding where and how libnl"
142echo " is being installed on the system in order to allow multiple libnl versions"
143echo " to be installed in parallel:"
Thomas Graf4c210ad2011-09-13 22:58:08 +0200144echo ""
Thomas Grafd3bb7c92011-09-19 11:47:49 +0200145echo " - Headers will be installed in ${includedir}/libnl${MAJ_VERSION}, therefore"
146echo " you will need to add \"-I/usr/include/libnl${MAJ_VERSION}\" to CFLAGS"
Thomas Graf4c210ad2011-09-13 22:58:08 +0200147echo ""
Thomas Grafd3bb7c92011-09-19 11:47:49 +0200148echo " - The library basename was renamed to libnl-${MAJ_VERSION}, i.e. the SO names become"
149echo " libnl-${MAJ_VERSION}.so., libnl-route-${MAJ_VERSION}.so, etc."
150echo ""
151echo " - libtool versioning was assumed, to ease detection of compatible library"
Thomas Graf2b96c332013-01-22 19:15:34 +0100152echo " versions."
Thomas Grafd3bb7c92011-09-19 11:47:49 +0200153echo ""
154echo " If you are using pkg-config for detecting and linking against the library "
155echo " things will continue magically as if nothing every happened. If you are "
156echo " linking manually you need to adapt your Makefiles or switch to using "
157echo " pkg-config files."
Thomas Graf4c210ad2011-09-13 22:58:08 +0200158echo ""
159echo "-------------------------------------------------------------------------------"
Thomas Graf6e5332b2011-09-13 11:49:41 +0200160