Bibletime – a bible study tool
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

clucene.m4 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. ## -*- autoconf -*-
  2. dnl This file was created by Lee Carpenter <elc@carpie.net>
  3. dnl Later modified by Martin Gruner <mgruner@crosswire.org>
  4. dnl It provides macros for the autoconf package to find the CLucene library on your system.
  5. dnl ----------------------------------------------------------------------
  6. dnl Check for clucene installation
  7. dnl First argument specifies whether or not to link
  8. dnl CLucene statically
  9. dnl ----------------------------------------------------------------------
  10. AC_DEFUN(AC_CHECK_CLUCENE,
  11. [
  12. dnl AC_MSG_CHECKING([for a clucene installation])
  13. dnl The option for the configure script
  14. AC_ARG_WITH(clucene-dir,
  15. [ --with-clucene-dir=DIR Path where CLucene is installed (default=/usr) ],
  16. [
  17. ac_clucene_dir=$withval
  18. ],ac_clucene_dir=/usr
  19. )
  20. AC_ARG_ENABLE(static-clucene,
  21. [ --enable-static-clucene Link to the static CLucene library],
  22. ac_static_clucene="YES",
  23. [ ac_static_clucene="$1" ]
  24. )
  25. dnl try to find CLucene library files
  26. AC_MSG_CHECKING([for CLucene library files])
  27. clucene_multiarch_libs="`find /usr/lib/ -maxdepth 1 -type d | xargs echo`"
  28. ac_clucene_library_dirs="$ac_clucene_dir/lib $exec_prefix/lib $prefix/lib /usr/lib /usr/lib64 /usr/local/lib $clucene_multiarch_libs"
  29. if test "x$ac_static_clucene" = "xYES"; then
  30. SEARCH_LIBS="libclucene.a";
  31. else
  32. SEARCH_LIBS="libclucene.so libclucene.so.0 libclucene.so.0.0.0 libcluene.a";
  33. fi
  34. AC_CACHE_VAL(ac_cv_clucene_libdir, AC_FIND_FILE($SEARCH_LIBS, $ac_clucene_library_dirs, ac_cv_clucene_libdir))
  35. if test "x$ac_cv_clucene_libdir" = "xNO"; then
  36. AC_MSG_CHECKING([for CLucene 2.x library files])
  37. SEARCH_LIBS="libclucene-shared.so libclucene-shared.so.1";
  38. AC_CACHE_VAL(ac_cv_clucene2_libdir, AC_FIND_FILE($SEARCH_LIBS, $ac_clucene_library_dirs, ac_cv_clucene_libdir))
  39. if test "x$ac_cv_clucene2_libdir" = "xNO"; then
  40. AC_MSG_ERROR(CLucene library not found. Try to use configure with --with-clucene-dir=/path/to/clucene);
  41. fi
  42. else
  43. ac_cv_clucene2_libdir="NO"
  44. fi
  45. if test "x$ac_static_clucene" = "xYES"; then
  46. LIB_CLUCENE="$ac_cv_clucene_libdir/libclucene.a";
  47. else
  48. if test "x$ac_cv_clucene2_libdir" = "xNO"; then
  49. LIB_CLUCENE="-lclucene";
  50. else
  51. CXXFLAGS="$CXXFLAGS -DCLUCENE_V2"
  52. LIB_CLUCENE="-lclucene-core -lclucene-shared";
  53. fi
  54. fi
  55. AC_SUBST(CLUCENE_LIBRARY_PATH)
  56. AC_SUBST(LIB_CLUCENE)
  57. all_libraries="$all_libraries -L$ac_cv_clucene_libdir"
  58. if test "x$ac_static_clucene" = "xYES"; then
  59. MESSAGE="static library $ac_cv_clucene_libdir/libclucene.a";
  60. else
  61. MESSAGE="$ac_cv_clucene_libdir";
  62. fi
  63. AC_MSG_RESULT([$MESSAGE])
  64. dnl -- try to find CLucene include files --
  65. AC_MSG_CHECKING([for Clucene include files])
  66. ac_clucene_include_dirs="$ac_clucene_dir/include $exec_prefix/include $prefix/include /usr/include /usr/local/include"
  67. AC_CACHE_VAL(ac_cv_clucene_incdir, AC_FIND_FILE(CLucene.h, $ac_clucene_include_dirs, ac_cv_clucene_incdir))
  68. if test "x$ac_cv_clucene_incdir" = "xNO"; then
  69. AC_MSG_ERROR([The CLucene include file files were not found.
  70. Please try to use configure with --with-clucene-dir=/path/to/clucene
  71. ])
  72. fi
  73. CLUCENE_INCLUDES="-I$ac_cv_clucene_incdir"
  74. AC_SUBST(CLUCENE_INCLUDES)
  75. all_includes="$all_includes -I$ac_cv_clucene_incdir -I$ac_cv_clucene_libdir -I$ac_cv_sword_incdir" #$ac_cv_clucene_libdir needed for Clucene/clucene-config.h
  76. AC_MSG_RESULT([$ac_cv_clucene_incdir])
  77. dnl -- CLucene installed test --
  78. AC_MSG_CHECKING([for CLucene version])
  79. AC_CACHE_VAL(ac_cv_installed_clucene_version,
  80. [
  81. AC_LANG_SAVE
  82. AC_LANG_CPLUSPLUS
  83. ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
  84. ac_LIBRARY_PATH="$LIBRARY_PATH"
  85. ac_cxxflags_safe="$CXXFLAGS"
  86. ac_ldflags_safe="$LDFLAGS"
  87. ac_libs_safe="$LIBS"
  88. CXXFLAGS="$CXXFLAGS -I$"
  89. LDFLAGS="$LDFLAGS -L$ac_cv_clucene_libdir -L$ac_cv_sword_libdir"
  90. LIBS="$LIB_CLUCENE -lz -lsword -ltqt"
  91. LD_LIBRARY_PATH="$ac_cv_clucene_libdir"
  92. export LD_LIBRARY_PATH
  93. LIBRARY_PATH=
  94. export LIBRARY_PATH
  95. cat > conftest.$ac_ext <<EOF
  96. #include <iostream>
  97. #include <swversion.h>
  98. #include <CLucene/clucene-config.h>
  99. int main(int argc, char* argv[[]]) {
  100. if ( sword::SWVersion( _CL_VERSION ) >= sword::SWVersion( "0.9.16" ) ){
  101. std::cout << "ok";
  102. }
  103. else{
  104. std::cout << "not-ok";
  105. }
  106. return 0;
  107. }
  108. EOF
  109. ac_link='$LIBTOOL_SHELL --silent --mode=link --tag=LD ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
  110. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  111. if test -x conftest; then
  112. eval ac_cv_installed_clucene_version=`./conftest 2>&5`
  113. fi
  114. else
  115. echo "configure: failed program was:" >&AC_FD_CC
  116. AC_MSG_ERROR([Failed to compile the test program to check the CLucene version! Please have a look at config.log! Report this to the BibleTime developers!]);
  117. cat conftest.$ac_ext >&AC_FD_CC
  118. fi
  119. rm -f conftest*
  120. CXXFLAGS="$ac_cxxflags_safe"
  121. LDFLAGS="$ac_ldflags_safe"
  122. LIBS="$ac_libs_safe"
  123. LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
  124. export LD_LIBRARY_PATH
  125. LIBRARY_PATH="$ac_LIBRARY_PATH"
  126. export LIBRARY_PATH
  127. AC_LANG_RESTORE
  128. ])
  129. if test "x$ac_cv_installed_clucene_version" = "xok"; then
  130. AC_MSG_RESULT([ok, version is recent enough]);
  131. elif test "x$ac_cv_installed_clucene_version" = "xnot-ok"; then
  132. AC_MSG_RESULT([installed]);
  133. AC_MSG_ERROR([Your CLucene version is not recent enough! Please upgrade to version >= 0.9.16!]);
  134. fi;
  135. ])