Paul Stewart | 054c80d | 2016-11-04 10:50:31 -0700 | [diff] [blame] | 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], [25]) |
| 17 | m4_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 ])]) |
| 18 | |
| 19 | |
| 20 | # 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: |
| 23 | # |
| 24 | # 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. |
| 28 | # |
| 29 | # 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. |
| 37 | |
| 38 | m4_define([libnl_lt_current], [220]) |
| 39 | m4_define([libnl_lt_revision], [0]) |
| 40 | m4_define([libnl_lt_age], [20]) |
| 41 | |
| 42 | m4_define([libnl_version], |
| 43 | [libnl_major_version.libnl_minor_version.libnl_micro_version]) |
| 44 | |
| 45 | AC_INIT(libnl, [libnl_version], [], [], [http://www.infradead.org/~tgr/libnl/]) |
| 46 | AC_CONFIG_HEADERS([lib/defs.h]) |
| 47 | AC_CONFIG_AUX_DIR([build-aux]) |
| 48 | AC_CONFIG_MACRO_DIR([m4]) |
| 49 | AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) |
| 50 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)], []) |
| 51 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) |
| 52 | |
| 53 | MAJ_VERSION=libnl_major_version |
| 54 | AC_SUBST(MAJ_VERSION) |
| 55 | MIN_VERSION=libnl_minor_version |
| 56 | AC_SUBST(MIN_VERSION) |
| 57 | MIC_VERSION=libnl_micro_version |
| 58 | AC_SUBST(MIC_VERSION) |
| 59 | LIBNL_GIT_SHA=libnl_git_sha |
| 60 | LIBNL_VERSION=libnl_version |
| 61 | AC_SUBST(LIBNL_VERSION) |
| 62 | |
| 63 | LT_CURRENT=libnl_lt_current |
| 64 | AC_SUBST(LT_CURRENT) |
| 65 | LT_REVISION=libnl_lt_revision |
| 66 | AC_SUBST(LT_REVISION) |
| 67 | LT_AGE=libnl_lt_age |
| 68 | AC_SUBST(LT_AGE) |
| 69 | |
| 70 | AC_PROG_CC |
| 71 | AM_PROG_CC_C_O |
| 72 | AC_PROG_INSTALL |
| 73 | AM_PROG_LIBTOOL |
| 74 | AC_PROG_MKDIR_P |
| 75 | AC_CHECK_PROGS(FLEX, 'flex') |
| 76 | AC_CHECK_PROGS(YACC, 'bison -y') |
| 77 | |
| 78 | AC_C_CONST |
| 79 | AC_C_INLINE |
| 80 | |
| 81 | PKG_CHECK_MODULES([CHECK], [check >= 0.9.0], |
| 82 | [enable_unit_tests="yes"], |
| 83 | [AC_MSG_WARN([*** Disabling building of unit tests]) |
| 84 | enable_unit_tests="no"]) |
| 85 | |
| 86 | AM_CONDITIONAL([ENABLE_UNIT_TESTS], [test "$enable_unit_tests" = "yes"]) |
| 87 | |
| 88 | AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH], |
| 89 | [Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]), |
| 90 | [pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig']) |
| 91 | AC_SUBST([pkgconfigdir]) |
| 92 | |
| 93 | AC_ARG_ENABLE([cli], |
| 94 | AS_HELP_STRING([--disable-cli], [Do not build command line interface utils]), |
| 95 | [enable_cli="$enableval"], [enable_cli="yes"]) |
| 96 | AM_CONDITIONAL([ENABLE_CLI], [test "$enable_cli" = "yes"]) |
| 97 | |
| 98 | AC_ARG_ENABLE([pthreads], |
| 99 | AS_HELP_STRING([--disable-pthreads], [Disable pthreads support]), |
| 100 | [enable_pthreads="$enableval"], [enable_pthreads="yes"]) |
| 101 | AM_CONDITIONAL([DISABLE_PTHREADS], [test "$enable_pthreads" = "no"]) |
| 102 | |
| 103 | AC_ARG_ENABLE([debug], |
| 104 | AS_HELP_STRING([--disable-debug], [Do not include debugging statements]), |
| 105 | [enable_debug="$enableval"], [enable_debug="yes"]) |
| 106 | AM_CONDITIONAL([ENABLE_DEBUG], [test "$enable_debug" = "no" ]) |
| 107 | |
| 108 | AC_CHECK_LIB([m], [pow], [], AC_MSG_ERROR([libm is required])) |
| 109 | |
| 110 | if test "x$enable_pthreads" = "xno"; then |
| 111 | AC_DEFINE([DISABLE_PTHREADS], [1], [Define to 1 to disable pthreads]) |
| 112 | else |
| 113 | AC_CHECK_LIB([pthread], [pthread_mutex_lock], [], AC_MSG_ERROR([libpthread is required])) |
| 114 | fi |
| 115 | |
| 116 | if test "x$enable_debug" = "xyes"; then |
| 117 | AC_DEFINE([NL_DEBUG], [1], [Define to 1 to enable debugging]) |
| 118 | fi |
| 119 | |
| 120 | AC_CONFIG_SUBDIRS([doc]) |
| 121 | |
| 122 | AC_CONFIG_FILES([ |
| 123 | Makefile |
| 124 | libnl.sym |
| 125 | libnl-3.0.pc |
| 126 | libnl-route-3.0.pc |
| 127 | libnl-genl-3.0.pc |
| 128 | libnl-nf-3.0.pc |
| 129 | libnl-cli-3.0.pc |
| 130 | lib/Makefile |
| 131 | include/Makefile |
| 132 | src/Makefile |
| 133 | src/lib/Makefile |
| 134 | tests/Makefile |
| 135 | man/Makefile |
| 136 | python/Makefile |
| 137 | python/setup.py |
| 138 | python/doc/Makefile |
| 139 | python/examples/Makefile |
| 140 | python/netlink/Makefile |
| 141 | python/netlink/genl/Makefile |
| 142 | python/netlink/route/Makefile |
| 143 | python/tests/Makefile |
| 144 | include/netlink/version.h |
| 145 | ]) |
| 146 | |
| 147 | ac_errcount=0 |
| 148 | if test -z "$YACC"; then |
| 149 | AC_MSG_WARN(bison not found. Please install before continuing.) |
| 150 | ac_errcount=$((ac_errcount + 1)) |
| 151 | fi |
| 152 | if test -z "$FLEX"; then |
| 153 | AC_MSG_WARN(flex not found. Please install before continuing.) |
| 154 | ac_errcount=$((ac_errcount + 1)) |
| 155 | fi |
| 156 | if test $ac_errcount -gt 0; then |
| 157 | AC_MSG_ERROR(Required packages are missing. Please install them and rerun ./configure) |
| 158 | fi |
| 159 | |
| 160 | AC_OUTPUT |
| 161 | |
| 162 | echo "-------------------------------------------------------------------------------" |
| 163 | echo " NOTE" |
| 164 | echo "" |
| 165 | echo " There have been some changes starting with 3.2 regarding where and how libnl" |
| 166 | echo " is being installed on the system in order to allow multiple libnl versions" |
| 167 | echo " to be installed in parallel:" |
| 168 | echo "" |
| 169 | echo " - Headers will be installed in ${includedir}/libnl${MAJ_VERSION}, therefore" |
| 170 | echo " you will need to add \"-I/usr/include/libnl${MAJ_VERSION}\" to CFLAGS" |
| 171 | echo "" |
| 172 | echo " - The library basename was renamed to libnl-${MAJ_VERSION}, i.e. the SO names become" |
| 173 | echo " libnl-${MAJ_VERSION}.so., libnl-route-${MAJ_VERSION}.so, etc." |
| 174 | echo "" |
| 175 | echo " - libtool versioning was assumed, to ease detection of compatible library" |
| 176 | echo " versions." |
| 177 | echo "" |
| 178 | echo " If you are using pkg-config for detecting and linking against the library " |
| 179 | echo " things will continue magically as if nothing every happened. If you are " |
| 180 | echo " linking manually you need to adapt your Makefiles or switch to using " |
| 181 | echo " pkg-config files." |
| 182 | echo "" |
| 183 | echo "-------------------------------------------------------------------------------" |
| 184 | |