aspell.m4 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. dnl Autoconf macros for libaspell
  2. dnl $Id$
  3. # Configure paths for ASPELL
  4. # Shamelessly stolen from the one of GPGME by Werner Koch
  5. # Melvin Hadasht 2001-09-17, 2002
  6. dnl AM_PATH_ASPELL([MINIMUM-VERSION,
  7. dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
  8. dnl Test for aspell, and define ASPELL_CFLAGS, ASPELL_LIBS and ASPELL_PATH
  9. dnl
  10. AC_DEFUN([AM_PATH_ASPELL],
  11. [dnl
  12. dnl Get the cflags and libraries from the aspell-config script
  13. dnl
  14. AC_ARG_WITH(aspell-prefix,
  15. [ --with-aspell-prefix=PFX Prefix where aspell is installed (optional)],
  16. aspell_prefix="$withval", aspell_prefix="")
  17. AC_ARG_ENABLE(aspell-test,
  18. [ --disable-aspell-test Do not try to compile and run a test GNU/aspell program],
  19. , enable_aspelltest=yes)
  20. AC_ARG_WITH(aspell-libs,
  21. [ --with-aspell-libs=LIBS Where GNU/aspell library reside (/usr/local/lib)],
  22. aspell_libs="$withval", aspell_libs="")
  23. AC_ARG_WITH(aspell-includes,
  24. [ --with-aspell-includes=INCLUDES Where GNU/aspell headers reside (/usr/local/include)],
  25. aspell_includes="$withval", aspell_includes="")
  26. if test x$aspell_prefix != x ; then
  27. if test x${ASPELL+set} != xset ; then
  28. ASPELL=$aspell_prefix/bin/aspell
  29. fi
  30. if test x$aspell_includes = x ; then
  31. aspell_includes=$aspell_prefix/include
  32. fi
  33. if test x$aspell_libs = x ; then
  34. aspell_libs=$aspell_prefix/lib
  35. fi
  36. aspell_path=$aspell_prefix/lib/aspell
  37. fi
  38. if test x$aspell_includes = x ; then
  39. aspell_includes=/usr/local/include
  40. fi
  41. if test x$aspell_libs = x ; then
  42. aspell_libs=/usr/local/lib
  43. fi
  44. if test x$aspell_path = x ; then
  45. aspell_path=/usr/local/lib/aspell
  46. fi
  47. if test "x$enable_aspelltest" != "xyes" ; then
  48. echo "*** Disabling GNU/aspell tests upon user request"
  49. ASPELL_CFLAGS="-I$aspell_includes"
  50. ASPELL_LIBS="-L$aspell_libs -laspell"
  51. AC_DEFINE_UNQUOTED(ASPELL_PATH, "${aspell_path}/", Define ASPELL's default directory)
  52. ifelse([$2], , :, [$2])
  53. else
  54. AC_PATH_PROG(ASPELL, aspell, no)
  55. min_aspell_version=ifelse([$1], ,.50,$1)
  56. AC_MSG_CHECKING(for GNU/aspell - version >= $min_aspell_version)
  57. no_aspell=""
  58. if test "$ASPELL" = "no" ; then
  59. echo "*** The aspell executable could not be found"
  60. echo "*** If aspell was installed in PREFIX, make sure PREFIX/bin is in"
  61. echo "*** your path, or set the ASPELL environment variable to the"
  62. echo "*** full path to aspell or configure with --with-aspell-prefix=PREFIX."
  63. ASPELL_CFLAGS=""
  64. ASPELL_LIBS=""
  65. ASPELL_PATH=""
  66. no_aspell=yes
  67. ifelse([$3], , :, [$3])
  68. else
  69. ASPELL_CFLAGS="-I$aspell_includes"
  70. ASPELL_LIBS="-L$aspell_libs -laspell"
  71. aspell_version=`$ASPELL version|sed -e "s/\(@(#) International Ispell Version 3.1.20 (but really Aspell \)\(.*\))/\2/"`
  72. rm -f conf.aspelltest
  73. AC_TRY_RUN([
  74. #include <stdio.h>
  75. #include <stdlib.h>
  76. #include <string.h>
  77. int
  78. main ()
  79. {
  80. system ("touch conf.aspelltest");
  81. if(strcmp("$aspell_version","$min_aspell_version")<0){
  82. return 1;
  83. }
  84. return 0;
  85. }
  86. ],, no_aspell=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
  87. rm -f conf.aspelltest
  88. if test "x$no_aspell" = x ; then
  89. AC_MSG_RESULT(yes)
  90. AC_MSG_CHECKING(for GNU/aspell dictionaries location)
  91. aspell_path="`$ASPELL config dict-dir`"
  92. AC_DEFINE_UNQUOTED(ASPELL_PATH, "${aspell_path}/", Define ASPELL's default directory)
  93. AC_MSG_RESULT($aspell_path)
  94. AC_MSG_CHECKING(if GNU/aspell is correctly installed)
  95. ac_save_CFLAGS="$CFLAGS"
  96. ac_save_LIBS="$LIBS"
  97. CFLAGS="$CFLAGS $ASPELL_CFLAGS"
  98. LIBS="$LIBS $ASPELL_LIBS"
  99. AC_TRY_RUN([
  100. #include <stdio.h>
  101. #include <stdlib.h>
  102. #include <string.h>
  103. #include <aspell.h>
  104. int
  105. main()
  106. {
  107. AspellConfig * aspellconfig = new_aspell_config();
  108. return 0;
  109. }
  110. ],, aspell_failure=yes,)
  111. rm -f conftest.c
  112. CFLAGS="$ac_save_CFLAGS"
  113. LIBS="$ac_save_LIBS"
  114. if test "x$aspell_failure" = x ; then
  115. AC_MSG_RESULT(yes)
  116. ifelse([$2], , :, [$2])
  117. else
  118. AC_MSG_RESULT(no)
  119. echo "*** The GNU/aspell test program did not succeed. This usually means that "
  120. echo "*** the headers and the libraries could not be found. Check config.log"
  121. echo "*** for detailed error message and add the relevant options"
  122. echo "*** --with-aspell-prefix, --with-aspell-includes or --with-aspell-libs"
  123. echo "*** to the configure command."
  124. echo "*** This can also mean that the library was not found at runtime. In that case"
  125. echo "*** add its path to LD_LIBRARY_PATH environment variable or in /etc/ld.so.conf"
  126. ASPELL_CFLAGS=""
  127. ASPELL_LIBS=""
  128. ASPELL_PATH=""
  129. ifelse([$3], , :, [$3])
  130. fi
  131. else
  132. AC_MSG_RESULT(no)
  133. ASPELL_CFLAGS=""
  134. ASPELL_LIBS=""
  135. ASPELL_PATH=""
  136. ifelse([$3], , :, [$3])
  137. fi
  138. fi
  139. fi
  140. AC_SUBST(ASPELL_CFLAGS)
  141. AC_SUBST(ASPELL_LIBS)
  142. AC_SUBST(ASPELL_PATH)
  143. ])