1 dnl Autoconf macros for libpspell
4 # Configure paths for PSPELL
5 # Shamelessly stolen from the one of GPGME by Werner Koch
6 # Melvin Hadasht 2001-09-17
8 dnl AM_PATH_PSPELL([MINIMUM-VERSION,
9 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
10 dnl Test for pspell, and define PSPELL_CFLAGS and PSPELL_LIBS
12 AC_DEFUN(AM_PATH_PSPELL,
14 dnl Get the cflags and libraries from the pspell-config script
16 AC_ARG_WITH(pspell-prefix,
17 [ --with-pspell-prefix=PFX Prefix where pspell-config is installed (optional)],
18 pspell_config_prefix="$withval", pspell_config_prefix="")
19 AC_ARG_ENABLE(pspelltest,
20 [ --disable-pspelltest Do not try to compile and run a test pspell program],
21 , enable_pspelltest=yes)
22 AC_ARG_WITH(pspelllibs,
23 [ --with-pspell-libs=LIBS Where pspell library reside (/usr/local/lib)],
24 pspell_libs=$pspelllibs, pspell_libs='/usr/local/lib')
25 AC_ARG_WITH(pspellincludes,
26 [ --with-pspell-includes=INCLUDES Where pspell headers reside (/usr/local/include)],
27 pspell_includes=$pspelllibs, pspell_includes='/usr/local/include')
30 if test x$pspell_config_prefix != x ; then
31 if test x${PSPELL_CONFIG+set} != xset ; then
32 PSPELL_CONFIG=$pspell_config_prefix/bin/pspell-config
36 AC_PATH_PROG(PSPELL_CONFIG, pspell-config, no)
37 min_pspell_version=ifelse([$1], ,.12.2,$1)
38 AC_MSG_CHECKING(for pspell - version >= $min_pspell_version)
40 if test "$PSPELL_CONFIG" = "no" ; then
43 PSPELL_CFLAGS="-I$pspell_includes"
44 PSPELL_LIBS="-L$pspell_libs -lpspell"
45 pspell_config_version=`$PSPELL_CONFIG version`
46 if test "x$enable_pspelltest" = "xyes" ; then
47 ac_save_CFLAGS="$CFLAGS"
49 CFLAGS="$CFLAGS $PSPELL_CFLAGS"
50 LIBS="$LIBS $PSPELL_LIBS"
59 #include <pspell/pspell.h>
64 system ("touch conf.pspelltest");
65 if(strcmp("$pspell_config_version","$min_pspell_version")<0){
71 ],, no_pspell=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
72 CFLAGS="$ac_save_CFLAGS"
76 if test "x$no_pspell" = x ; then
78 ifelse([$2], , :, [$2])
80 if test -f conf.pspelltest ; then
85 if test "$PSPELL_CONFIG" = "no" ; then
86 echo "*** The pspell-config script installed by pspell could not be found"
87 echo "*** If pspell was installed in PREFIX, make sure PREFIX/bin is in"
88 echo "*** your path, or set the PSPELL_CONFIG environment variable to the"
89 echo "*** full path to pspell-config."
91 if test -f conf.pspelltest ; then
94 echo "*** Could not run pspell test program, checking why..."
95 CFLAGS="$CFLAGS $PSPELL_CFLAGS"
96 LIBS="$LIBS $PSPELL_LIBS"
101 #include <pspell/pspell.h>
102 ], [ PspellConfig * pspellconfig= new_pspell_config(); return 0 ],
104 echo "*** The test program compiled, but did not run. This usually means"
105 echo "*** that the run-time linker is not finding pspell or finding the wrong"
106 echo "*** version of pspell. If it is not finding pspell, you'll need to set your"
107 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
108 echo "*** to the installed location Also, make sure you have run ldconfig if"
109 echo "*** that is required on your system"
111 echo "*** If you have an old version installed, it is best to remove it,"
112 echo "*** although you may also be able to get things to work by"
113 echo "*** modifying LD_LIBRARY_PATH"
117 echo "*** The test program failed to compile or link. See the file config.log"
118 echo "*** for the exact error that occured. This usually means pspell was"
119 echo "*** incorrectly installed or that you have moved pspell since it was"
120 echo "*** installed. In the latter case, you may want to edit the"
121 echo "*** pspell-config script: $PSPELL_CONFIG"
123 CFLAGS="$ac_save_CFLAGS"
129 ifelse([$3], , :, [$3])
131 AC_SUBST(PSPELL_CFLAGS)
132 AC_SUBST(PSPELL_LIBS)
133 rm -f conf.pspelltest