Add packaging directory
[platform/upstream/libnl3.git] / configure.ac
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 #
9 # Copyright (c) 2003-2013 Thomas Graf <tgraf@suug.ch>
10 #
11
12
13 # copied from glib
14 m4_define([libnl_major_version], [3])
15 m4_define([libnl_minor_version], [2])
16 m4_define([libnl_micro_version], [22])
17
18
19 # The following explanation may help to understand the above rules a bit
20 # better: consider that there are three possible kinds of reactions from
21 # users of your library to changes in a shared library:
22 #
23 # 1. Programs using the previous version may use the new version as drop-in
24 #    replacement, and programs using the new version can also work with the
25 #    previous one. In other words, no recompiling nor relinking is needed.
26 #    In this case, bump revision only, don't touch current nor age.
27 #
28 # 2. Programs using the previous version may use the new version as drop-in
29 #    replacement, but programs using the new version may use APIs not
30 #    present in the previous one. In other words, a program linking against
31 #    the new version may fail with “unresolved symbols” if linking against
32 #    the old version at runtime: set revision to 0, bump current and age.
33 #
34 # 3. Programs may need to be changed, recompiled, relinked in order to use
35 #    the new version. Bump current, set revision and age to 0.
36
37 m4_define([libnl_lt_current],    [217])
38 m4_define([libnl_lt_revision],   [0])
39 m4_define([libnl_lt_age],        [17])
40
41 m4_define([libnl_version],
42           [libnl_major_version.libnl_minor_version.libnl_micro_version])
43
44 AC_INIT(libnl, [libnl_version], [], [], [http://www.infradead.org/~tgr/libnl/])
45 AC_CONFIG_HEADERS([lib/defs.h])
46 AC_CONFIG_AUX_DIR([build-aux])
47 AC_CONFIG_MACRO_DIR([m4])
48 AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
49 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)], [])
50 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
51
52 MAJ_VERSION=libnl_major_version
53 AC_SUBST(MAJ_VERSION)
54 MIN_VERSION=libnl_minor_version
55 AC_SUBST(MIN_VERSION)
56 MIC_VERSION=libnl_micro_version
57 AC_SUBST(MIC_VERSION)
58 LIBNL_VERSION=libnl_version
59 AC_SUBST(LIBNL_VERSION)
60
61 LT_CURRENT=libnl_lt_current
62 AC_SUBST(LT_CURRENT)
63 LT_REVISION=libnl_lt_revision
64 AC_SUBST(LT_REVISION)
65 LT_AGE=libnl_lt_age
66 AC_SUBST(LT_AGE)
67
68 AC_PROG_CC
69 AM_PROG_CC_C_O
70 AC_PROG_INSTALL
71 AM_PROG_LIBTOOL
72 AC_CHECK_PROGS(FLEX, 'flex')
73 AC_CHECK_PROGS(YACC, 'bison -y')
74
75 AC_C_CONST
76 AC_C_INLINE
77
78 PKG_CHECK_MODULES([CHECK], [check >= 0.9.0],
79         [enable_unit_tests="yes"],
80         [AC_MSG_WARN([*** Disabling building of unit tests])
81          enable_unit_tests="no"])
82
83 AM_CONDITIONAL([ENABLE_UNIT_TESTS], [test "$enable_unit_tests" = "yes"])
84
85 AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH],
86         [Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]),
87         [pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
88 AC_SUBST([pkgconfigdir])
89
90 AC_ARG_ENABLE([cli],
91         AS_HELP_STRING([--disable-cli], [Do not build command line interface utils]),
92         [enable_cli="$enableval"], [enable_cli="yes"])
93 AM_CONDITIONAL([ENABLE_CLI], [test "$enable_cli" = "yes"])
94
95 AC_ARG_ENABLE([pthreads],
96         AS_HELP_STRING([--disable-pthreads], [Disable pthreads support]),
97         [enable_pthreads="$enableval"], [enable_pthreads="yes"])
98 AM_CONDITIONAL([DISABLE_PTHREADS], [test "$enable_pthreads" = "no"])
99
100 AC_ARG_ENABLE([debug],
101         AS_HELP_STRING([--disable-debug], [Do not include debugging statements]),
102         [enable_debug="$enableval"], [enable_debug="yes"])
103 AM_CONDITIONAL([ENABLE_DEBUG], [test "$enable_debug" = "no" ])
104
105 AC_CHECK_LIB([m], [pow], [], AC_MSG_ERROR([libm is required]))
106
107 if test "x$enable_pthreads" = "xno"; then
108     AC_DEFINE([DISABLE_PTHREADS], [1], [Define to 1 to disable pthreads])
109 else
110     AC_CHECK_LIB([pthread], [pthread_mutex_lock], [], AC_MSG_ERROR([libpthread is required]))
111 fi
112
113 if test "x$enable_debug" = "xyes"; then
114     AC_DEFINE([NL_DEBUG], [1], [Define to 1 to enable debugging])
115 fi
116
117 AC_CONFIG_SUBDIRS([doc])
118
119 AC_CONFIG_FILES([
120 Makefile
121 libnl-3.0.pc
122 libnl-route-3.0.pc
123 libnl-genl-3.0.pc
124 libnl-nf-3.0.pc
125 libnl-cli-3.0.pc
126 lib/Makefile
127 include/Makefile
128 src/Makefile
129 src/lib/Makefile
130 tests/Makefile
131 man/Makefile
132 python/Makefile
133 python/setup.py
134 python/netlink/Makefile
135 python/netlink/route/Makefile
136 include/netlink/version.h
137 ])
138
139 ac_errcount=0
140 if test -z "$YACC"; then
141     AC_MSG_WARN(bison not found. Please install before continuing.)
142     ac_errcount=$((ac_errcount + 1))
143 fi
144 if test -z "$FLEX"; then
145     AC_MSG_WARN(flex not found. Please install before continuing.)
146     ac_errcount=$((ac_errcount + 1))
147 fi
148 if test $ac_errcount -gt 0; then
149     AC_MSG_ERROR(Required packages are missing. Please install them and rerun ./configure)
150 fi
151
152 AC_OUTPUT
153
154 echo "-------------------------------------------------------------------------------"
155 echo "                                  NOTE"
156 echo ""
157 echo " There have been some changes starting with 3.2 regarding where and how libnl"
158 echo " is being installed on the system in order to allow multiple libnl versions"
159 echo " to be installed in parallel:"
160 echo ""
161 echo "    - Headers will be installed in ${includedir}/libnl${MAJ_VERSION}, therefore"
162 echo "      you will need to add \"-I/usr/include/libnl${MAJ_VERSION}\" to CFLAGS"
163 echo ""
164 echo "    - The library basename was renamed to libnl-${MAJ_VERSION}, i.e. the SO names become"
165 echo "      libnl-${MAJ_VERSION}.so., libnl-route-${MAJ_VERSION}.so, etc."
166 echo ""
167 echo "    - libtool versioning was assumed, to ease detection of compatible library"
168 echo "      versions."
169 echo ""
170 echo " If you are using pkg-config for detecting and linking against the library "
171 echo " things will continue magically as if nothing every happened. If you are "
172 echo " linking manually you need to adapt your Makefiles or switch to using "
173 echo " pkg-config files."
174 echo ""
175 echo "-------------------------------------------------------------------------------"
176