aspell.m4 5.3 KB

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