pspell.m4 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. dnl Autoconf macros for libpspell
  2. dnl $Id$
  3. # Configure paths for PSPELL
  4. # Shamelessly stolen from the one of GPGME by Werner Koch
  5. # Melvin Hadasht 2001-09-17
  6. dnl AM_PATH_PSPELL([MINIMUM-VERSION,
  7. dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
  8. dnl Test for pspell, and define PSPELL_CFLAGS and PSPELL_LIBS
  9. dnl
  10. AC_DEFUN(AM_PATH_PSPELL,
  11. [dnl
  12. dnl Get the cflags and libraries from the pspell-config script
  13. dnl
  14. AC_ARG_WITH(pspell-prefix,
  15. [ --with-pspell-prefix=PFX Prefix where pspell-config is installed (optional)],
  16. pspell_config_prefix="$withval", pspell_config_prefix="")
  17. AC_ARG_ENABLE(pspelltest,
  18. [ --disable-pspelltest Do not try to compile and run a test pspell program],
  19. , enable_pspelltest=yes)
  20. AC_ARG_WITH(pspelllibs,
  21. [ --with-pspell-libs=LIBS Where pspell library reside (/usr/local/lib)],
  22. pspell_libs=$pspelllibs, pspell_libs='/usr/local/lib')
  23. AC_ARG_WITH(pspellincludes,
  24. [ --with-pspell-includes=INCLUDES Where pspell headers reside (/usr/local/include)],
  25. pspell_includes=$pspelllibs, pspell_includes='/usr/local/include')
  26. if test x$pspell_config_prefix != x ; then
  27. if test x${PSPELL_CONFIG+set} != xset ; then
  28. PSPELL_CONFIG=$pspell_config_prefix/bin/pspell-config
  29. fi
  30. fi
  31. AC_PATH_PROG(PSPELL_CONFIG, pspell-config, no)
  32. min_pspell_version=ifelse([$1], ,.12.2,$1)
  33. AC_MSG_CHECKING(for pspell - version >= $min_pspell_version)
  34. no_pspell=""
  35. if test "$PSPELL_CONFIG" = "no" ; then
  36. no_pspell=yes
  37. else
  38. PSPELL_CFLAGS="-I$pspell_includes"
  39. PSPELL_LIBS="-L$pspell_libs -lpspell"
  40. pspell_config_version=`$PSPELL_CONFIG version`
  41. if test "x$enable_pspelltest" = "xyes" ; then
  42. ac_save_CFLAGS="$CFLAGS"
  43. ac_save_LIBS="$LIBS"
  44. CFLAGS="$CFLAGS $PSPELL_CFLAGS"
  45. LIBS="$LIBS $PSPELL_LIBS"
  46. dnl
  47. dnl
  48. dnl
  49. rm -f conf.pspelltest
  50. AC_TRY_RUN([
  51. #include <stdio.h>
  52. #include <stdlib.h>
  53. #include <string.h>
  54. #include <pspell/pspell.h>
  55. int
  56. main ()
  57. {
  58. system ("touch conf.pspelltest");
  59. if(strcmp("$pspell_config_version","$min_pspell_version")<0){
  60. printf("no\n");
  61. return 1;
  62. }
  63. return 0;
  64. }
  65. ],, no_pspell=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
  66. CFLAGS="$ac_save_CFLAGS"
  67. LIBS="$ac_save_LIBS"
  68. fi
  69. fi
  70. if test "x$no_pspell" = x ; then
  71. AC_MSG_RESULT(yes)
  72. ifelse([$2], , :, [$2])
  73. else
  74. if test -f conf.pspelltest ; then
  75. :
  76. else
  77. AC_MSG_RESULT(no)
  78. fi
  79. if test "$PSPELL_CONFIG" = "no" ; then
  80. echo "*** The pspell-config script installed by pspell could not be found"
  81. echo "*** If pspell was installed in PREFIX, make sure PREFIX/bin is in"
  82. echo "*** your path, or set the PSPELL_CONFIG environment variable to the"
  83. echo "*** full path to pspell-config."
  84. else
  85. if test -f conf.pspelltest ; then
  86. :
  87. else
  88. echo "*** Could not run pspell test program, checking why..."
  89. CFLAGS="$CFLAGS $PSPELL_CFLAGS"
  90. LIBS="$LIBS $PSPELL_LIBS"
  91. AC_TRY_LINK([
  92. #include <stdio.h>
  93. #include <stdlib.h>
  94. #include <string.h>
  95. #include <pspell/pspell.h>
  96. ], [ PspellConfig * pspellconfig= new_pspell_config(); return 0 ],
  97. [
  98. echo "*** The test program compiled, but did not run. This usually means"
  99. echo "*** that the run-time linker is not finding pspell or finding the wrong"
  100. echo "*** version of pspell. If it is not finding pspell, you'll need to set your"
  101. echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
  102. echo "*** to the installed location Also, make sure you have run ldconfig if"
  103. echo "*** that is required on your system"
  104. echo "***"
  105. echo "*** If you have an old version installed, it is best to remove it,"
  106. echo "*** although you may also be able to get things to work by"
  107. echo "*** modifying LD_LIBRARY_PATH"
  108. echo "***"
  109. ],
  110. [
  111. echo "*** The test program failed to compile or link. See the file config.log"
  112. echo "*** for the exact error that occured. This usually means pspell was"
  113. echo "*** incorrectly installed or that you have moved pspell since it was"
  114. echo "*** installed. In the latter case, you may want to edit the"
  115. echo "*** pspell-config script: $PSPELL_CONFIG"
  116. ])
  117. CFLAGS="$ac_save_CFLAGS"
  118. LIBS="$ac_save_LIBS"
  119. fi
  120. fi
  121. PSPELL_CFLAGS=""
  122. PSPELL_LIBS=""
  123. ifelse([$3], , :, [$3])
  124. fi
  125. AC_SUBST(PSPELL_CFLAGS)
  126. AC_SUBST(PSPELL_LIBS)
  127. rm -f conf.pspelltest
  128. ])