Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

150 lines
5.4KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_lib_tabix.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_LIB_TABIX()
  8. #
  9. # DESCRIPTION
  10. #
  11. # This macro searches for an installed tabix library. If nothing was
  12. # specified when calling configure, it searches first in /usr/local and
  13. # then tries with ld's default library search path. If the
  14. # --with-tabix=DIR is specified, it will try to find it in
  15. # DIR/include/tabix/tabix.h and DIR/lib/libtabix.a. As a final try it will
  16. # look in DIR/tabix.h and DIR/libtabix.a as the tabix library does not
  17. # contain an install rule.
  18. #
  19. # If --without-tabix is specified, the library is not searched at all.
  20. #
  21. # If either the header file (tabix.h) or the library (libtabix) is not
  22. # found, the configuration exits on error, asking for a valid tabix
  23. # installation directory or --without-tabix.
  24. #
  25. # The macro defines the symbol HAVE_TABIX if the library is found. You
  26. # should use autoheader to include a definition for this symbol in a
  27. # config.h file. Sample usage in a C/C++ source is as follows:
  28. #
  29. # #ifdef HAVE_TABIX
  30. # #include <tabix.h>
  31. # #endif /* HAVE_TABIX */
  32. #
  33. # The following output variables are set with AC_SUBST:
  34. #
  35. # TABIX_CPPFLAGS
  36. # TABIX_LDFLAGS
  37. # TABIX_LIBS
  38. #
  39. # You can use them like this in Makefile.am:
  40. #
  41. # AM_CPPFLAGS = $(TABIX_CPPFLAGS)
  42. # AM_LDFLAGS = $(TABIX_LDFLAGS)
  43. # program_LDADD = $(TABIX_LIBS)
  44. #
  45. # LICENSE
  46. #
  47. # Copyright (c) 2013 Timothy Brown <tbrown@freeshell.org>
  48. #
  49. # This program is free software; you can redistribute it and/or modify it
  50. # under the terms of the GNU General Public License as published by the
  51. # Free Software Foundation; either version 3 of the License, or (at your
  52. # option) any later version.
  53. #
  54. # This program is distributed in the hope that it will be useful, but
  55. # WITHOUT ANY WARRANTY; without even the implied warranty of
  56. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  57. # Public License for more details.
  58. #
  59. # You should have received a copy of the GNU General Public License along
  60. # with this program. If not, see <https://www.gnu.org/licenses/>.
  61. #
  62. # As a special exception, the respective Autoconf Macro's copyright owner
  63. # gives unlimited permission to copy, distribute and modify the configure
  64. # scripts that are the output of Autoconf when processing the Macro. You
  65. # need not follow the terms of the GNU General Public License when using
  66. # or distributing such scripts, even though portions of the text of the
  67. # Macro appear in them. The GNU General Public License (GPL) does govern
  68. # all other use of the material that constitutes the Autoconf Macro.
  69. #
  70. # This special exception to the GPL applies to versions of the Autoconf
  71. # Macro released by the Autoconf Archive. When you make and distribute a
  72. # modified version of the Autoconf Macro, you may extend this special
  73. # exception to the GPL to apply to your modified version as well.
  74. #serial 3
  75. AC_DEFUN([AX_LIB_TABIX],
  76. #
  77. # Handle user hints
  78. #
  79. [AC_MSG_CHECKING([if tabix is wanted])
  80. AC_ARG_WITH([tabix],
  81. AS_HELP_STRING([--with-tabix],
  82. [search for tabix in DIR/include and DIR/lib]),
  83. [if test "$withval" != no ; then
  84. AC_MSG_RESULT([yes])
  85. if test -d "$withval" ; then
  86. TABIX_HOME="$withval"
  87. else
  88. AC_MSG_WARN([Sorry, $withval does not exist, checking usual places])
  89. fi
  90. else
  91. AC_MSG_RESULT([no])
  92. fi],
  93. [AC_MSG_RESULT([yes])])
  94. if test -f "${TABIX_HOME}/include/tabix/tabix.h" ; then
  95. TABIX_INCDIR="-I${TABIX_HOME}/include/tabix"
  96. TABIX_LIBDIR="-L${TABIX_HOME}/lib"
  97. elif test -f "${TABIX_HOME}/include/tabix.h" ; then
  98. TABIX_INCDIR="-I${TABIX_HOME}/include"
  99. TABIX_LIBDIR="-L${TABIX_HOME}/lib"
  100. elif test -f "${TABIX_HOME}/tabix.h" ; then
  101. TABIX_INCDIR="-I${TABIX_HOME}"
  102. TABIX_LIBDIR="-L${TABIX_HOME}"
  103. elif test -f "/usr/local/include/tabix/tabix.h" ; then
  104. TABIX_HOME="/usr/local"
  105. TABIX_INCDIR="-I${TABIX_HOME}/include/tabix"
  106. TABIX_LIBDIR="-L${TABIX_HOME}/lib"
  107. else
  108. TABIX_HOME="/usr"
  109. TABIX_INCDIR="-I${TABIX_HOME}/include/tabix"
  110. TABIX_LIBDIR=""
  111. fi
  112. #
  113. # Locate tabix, if wanted
  114. #
  115. if test -n "${TABIX_HOME}" ; then
  116. TABIX_OLD_LDFLAGS=$LDFLAGS
  117. TABIX_OLD_CPPFLAGS=$LDFLAGS
  118. LDFLAGS="$LDFLAGS ${TABIX_LIBDIR}"
  119. CPPFLAGS="$CPPFLAGS ${TABIX_INCDIR}"
  120. AC_LANG_SAVE
  121. AC_LANG_C
  122. AC_CHECK_HEADER([tabix.h], [ac_cv_tabix_h=yes], [ac_cv_tabix_h=no])
  123. AC_CHECK_LIB([tabix],[ti_open],[ac_cv_libtabix=yes],[ac_cv_libtabix=no])
  124. AC_LANG_RESTORE
  125. if test "$ac_cv_libtabix" = "yes" && \
  126. test "$ac_cv_tabix_h" = "yes" ; then
  127. #
  128. # If both library and header were found, use them
  129. #
  130. AC_MSG_CHECKING([tabix])
  131. AC_MSG_RESULT([ok])
  132. with_tabix=yes
  133. else
  134. #
  135. # If either header or library was not found, revert and bomb
  136. #
  137. LDFLAGS="$TABIX_OLD_LDFLAGS"
  138. CPPFLAGS="$TABIX_OLD_CPPFLAGS"
  139. AC_MSG_CHECKING([tabix])
  140. AC_MSG_RESULT([failed])
  141. AC_MSG_ERROR([either specify a valid tabix installation with --with-tabix=DIR or disable tabix usage with --without-tabix])
  142. fi
  143. fi
  144. ])