configure.ac 6.1 KB

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