New implementation of spell checker.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@19431 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gcasa 2004-06-01 05:51:06 +00:00
parent c58c1924d8
commit 0d03c14729
7 changed files with 327 additions and 269 deletions

View file

@ -1,3 +1,12 @@
2004-06-01 Gregory John Casamento <greg_casamento@yahoo.com>
* configure.ac: added code to detect the presence of
libaspell for the new implementation of GSspell.
* configure: regenerated.
* Tools/GSspell.m: Completely reimplemented the
spell-checker code using aspell. This simplified the
code tremendously.
2004-05-31 Fred Kiefer <FredKiefer@gmx.de> 2004-05-31 Fred Kiefer <FredKiefer@gmx.de>
* Headers/Additions/GNUstepGUI/GSDrawFunctions.h: * Headers/Additions/GNUstepGUI/GSDrawFunctions.h:

View file

@ -1,5 +1,11 @@
/* Headers/Additions/GNUstepGUI/config.h.in. Generated from configure.ac by autoheader. */ /* Headers/Additions/GNUstepGUI/config.h.in. Generated from configure.ac by autoheader. */
/* Define if you have the aspell header */
#undef HAVE_ASPELL
/* Define to 1 if you have the <aspell.h> header file. */
#undef HAVE_ASPELL_H
/* Define to 1 if you have the <audiofile.h> header file. */ /* Define to 1 if you have the <audiofile.h> header file. */
#undef HAVE_AUDIOFILE_H #undef HAVE_AUDIOFILE_H
@ -9,6 +15,9 @@
/* Define to 1 if you have the <jpeglib.h> header file. */ /* Define to 1 if you have the <jpeglib.h> header file. */
#undef HAVE_JPEGLIB_H #undef HAVE_JPEGLIB_H
/* Define to 1 if you have the `aspell' library (-laspell). */
#undef HAVE_LIBASPELL
/* Define to 1 if you have the `audiofile' library (-laudiofile). */ /* Define to 1 if you have the `audiofile' library (-laudiofile). */
#undef HAVE_LIBAUDIOFILE #undef HAVE_LIBAUDIOFILE

View file

@ -97,7 +97,7 @@ NSString *GSSpellServerName(NSString *checkerDictionary, NSString *language);
@implementation GSServicesManager(NSSpellCheckerMethods) @implementation GSServicesManager(NSSpellCheckerMethods)
- (id)_launchSpellCheckerForLanguage: (NSString *)language - (id)_launchSpellCheckerForLanguage: (NSString *)language
{ {
id proxy = nil; id<NSSpellServerPrivateProtocol> proxy = nil;
NSDictionary *spellCheckers = [_allServices objectForKey: @"BySpell"]; NSDictionary *spellCheckers = [_allServices objectForKey: @"BySpell"];
NSDictionary *checkerDictionary = [spellCheckers objectForKey: language]; NSDictionary *checkerDictionary = [spellCheckers objectForKey: language];
NSString *spellServicePath = [checkerDictionary objectForKey: @"ServicePath"]; NSString *spellServicePath = [checkerDictionary objectForKey: @"ServicePath"];
@ -190,7 +190,7 @@ static int __documentTag = 0;
// Support function to start the spell server // Support function to start the spell server
- (id)_startServerForLanguage: (NSString *)language - (id)_startServerForLanguage: (NSString *)language
{ {
id proxy = nil; id<NSSpellServerPrivateProtocol> proxy = nil;
// Start the service for this language // Start the service for this language
proxy = [[NSApp _listener] _launchSpellCheckerForLanguage: language]; proxy = [[NSApp _listener] _launchSpellCheckerForLanguage: language];
@ -221,7 +221,7 @@ static int __documentTag = 0;
{ {
// Start the server and retain the reference to the // Start the server and retain the reference to the
// proxy. // proxy.
id proxy = [self _startServerForLanguage: _language]; id<NSSpellServerPrivateProtocol> proxy = [self _startServerForLanguage: _language];
if(proxy != nil) if(proxy != nil)
{ {
_serverProxy = proxy; _serverProxy = proxy;
@ -317,7 +317,7 @@ static int __documentTag = 0;
{ {
int count = 0; int count = 0;
NSRange r = NSMakeRange(0,0); NSRange r = NSMakeRange(0,0);
id proxy = [self _serverProxy]; id<NSSpellServerPrivateProtocol> proxy = [self _serverProxy];
if (proxy != nil) if (proxy != nil)
r = [proxy _findMisspelledWordInString: aString r = [proxy _findMisspelledWordInString: aString
@ -372,7 +372,7 @@ static int __documentTag = 0;
// spellserver does not bring down the application. // spellserver does not bring down the application.
NS_DURING NS_DURING
{ {
id proxy = [self _serverProxy]; id<NSSpellServerPrivateProtocol> proxy = [self _serverProxy];
// Get the substring and check it. // Get the substring and check it.
NSString *substringToCheck = [stringToCheck substringFromIndex: startingOffset]; NSString *substringToCheck = [stringToCheck substringFromIndex: startingOffset];
@ -629,7 +629,7 @@ inSpellDocumentWithTag:(int)tag
- _switchDictionary: (id)sender - _switchDictionary: (id)sender
{ {
id proxy = nil; id<NSSpellServerPrivateProtocol> proxy = nil;
NSString *language = nil; NSString *language = nil;
// Start the service for this language // Start the service for this language

View file

@ -21,7 +21,7 @@
# ADDITIONAL_CFLAGS += # ADDITIONAL_CFLAGS +=
# Additional include directories the compiler should search # Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS += -I../Headers/Additions -I../Headers ADDITIONAL_INCLUDE_DIRS += -I../Headers/Additions -I../Headers -I../Source
# Additional LDFLAGS to pass to the linker # Additional LDFLAGS to pass to the linker
# ADDITIONAL_LDFLAGS += # ADDITIONAL_LDFLAGS +=

View file

@ -22,9 +22,14 @@
*/ */
// get the configuration.
#include "config.h"
#include <AppKit/AppKit.h> #include <AppKit/AppKit.h>
#include <Foundation/Foundation.h> #include <Foundation/Foundation.h>
#include <Foundation/NSString.h>
#ifdef HAVE_ASPELL_H
#include <aspell.h>
#endif
// A minor category for NSData so that we can convert NSStrings // A minor category for NSData so that we can convert NSStrings
// into data. // into data.
@ -43,193 +48,48 @@
@interface GNUSpellChecker : NSObject @interface GNUSpellChecker : NSObject
{ {
NSTask *_spellTask; #ifdef HAVE_ASPELL_H
AspellConfig *config;
AspellSpeller *speller;
AspellDocumentChecker *checker;
#endif
} }
@end @end
@implementation GNUSpellChecker @implementation GNUSpellChecker
// Find the ispell executable in the user's path.
- (NSString *)_locateIspell
{
NSDictionary *env = [[NSProcessInfo processInfo] environment];
NSString *path = [env objectForKey: @"PATH"], *fullPath = nil;
NSScanner *pathScanner = nil;
BOOL found = NO;
NSFileManager *fm = [NSFileManager defaultManager];
pathScanner = [NSScanner scannerWithString: path];
while(![pathScanner isAtEnd] && !found)
{
NSString *directory = nil;
BOOL scanned = NO;
scanned = [pathScanner scanUpToString: @":" intoString: &directory];
[pathScanner scanString: @":" intoString: NULL];
fullPath = [directory stringByAppendingString: @"/ispell"];
found = [fm fileExistsAtPath: fullPath];
}
if(!found)
{
fullPath = nil;
}
return fullPath;
}
// Start the ispell command.
// The -a option allows the program to accept commands
// from stdin and put output on stdout.
- (id)_runIspell
{
NSArray *args = [NSArray arrayWithObject: @"-a"];
if(_spellTask == nil)
{
NSString *pathToIspell = [self _locateIspell];
NSPipe
*inputPipe = [NSPipe pipe],
*outputPipe = [NSPipe pipe];
_spellTask = [[NSTask alloc] init];
[_spellTask setLaunchPath: pathToIspell];
[_spellTask setArguments: args];
[_spellTask setStandardInput: inputPipe];
[_spellTask setStandardOutput: outputPipe];
[_spellTask launch];
if(![_spellTask isRunning])
{
NSLog(@"ispell failed to launch");
}
else
{
// Enter terse mode immediately upon startup.
NSString *terseCommand = @"!", *outstring = nil;
NSData
*data = [NSData dataWithString: terseCommand],
*output = nil;
// Sleep until ispell starts
[NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 1]];
[[[_spellTask standardInput] fileHandleForWriting] writeData: data];
output = [[[_spellTask standardOutput] fileHandleForReading] availableData];
outstring = [NSString stringWithCString: (char *)[output bytes]];
}
}
return _spellTask;
}
- (void)_handleTaskTermination: (NSNotification *)notification
{
NSLog(@"ispell process died");
_spellTask = nil;
}
- (NSRange)spellServer:(NSSpellServer *)sender - (NSRange)spellServer:(NSSpellServer *)sender
findMisspelledWordInString:(NSString *)stringToCheck findMisspelledWordInString:(NSString *)stringToCheck
language:(NSString *)language language:(NSString *)language
wordCount:(int *)wordCount wordCount:(int *)wordCount
countOnly:(BOOL)countOnly countOnly:(BOOL)countOnly
{ {
int length = 0;
NSRange r = NSMakeRange(0,0); NSRange r = NSMakeRange(0,0);
char *p = 0;
[self _runIspell]; #ifdef HAVE_ASPELL_H
if(_spellTask != nil) if(countOnly)
{ {
NSCharacterSet *newlineSet = nil; NSScanner *inputScanner = [NSScanner scannerWithString: stringToCheck];
NSRange newlineRange; [inputScanner setCharactersToBeSkipped: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString
*checkCommand = @"^", *outputString = nil;
NSData
*inputData = nil,
*outputData = nil;
NSScanner
*inputScanner = nil;
NSFileHandle
*standardInput = [[_spellTask standardInput] fileHandleForWriting],
*standardOutput = [[_spellTask standardOutput] fileHandleForReading];
unsigned int i = 0;
newlineRange.location = (unsigned char)'\n';
newlineRange.length = 1;
newlineSet = [NSCharacterSet characterSetWithRange: newlineRange];
inputScanner = [NSScanner scannerWithString: stringToCheck];
[inputScanner setCharactersToBeSkipped: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
*wordCount = 0;
while(![inputScanner isAtEnd]) while(![inputScanner isAtEnd])
{ {
NSScanner *outputScanner = nil; [inputScanner scanUpToCharactersFromSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]
NSString *outputString = nil, *fullCommand = nil, *inputString = nil; intoString: NULL];
NSData *returnChar = [NSData dataWithBytes: "\n" *wordCount++;
length: 1];
[inputScanner scanUpToCharactersFromSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]
intoString: &inputString];
fullCommand = [checkCommand stringByAppendingString: inputString];
fullCommand = [fullCommand stringByAppendingString: @"\n"];
inputData = [NSData dataWithString: fullCommand];
[standardInput writeData: inputData];
[standardInput writeData: returnChar];
outputData = [standardOutput availableData];
p = (char *)[outputData bytes];
outputString = [NSString stringWithCString: p];
// Put everything back into a string for scanning
outputScanner = [NSScanner scannerWithString: outputString];
// Check to see if the first character in the byte stream is
// a carriage return. If so, no spelling errors were found.
if(p[0] != '\n' && !countOnly)
{
NSString *indicator = nil;
NSString *word = nil,
*count = nil,
*offset = nil;
int start = 0;
[outputScanner scanUpToString: @" " intoString: &indicator];
if([indicator isEqualToString: @"&"]
|| [indicator isEqualToString: @"?"])
{
BOOL found = NO;
[outputScanner scanUpToString: @" " intoString: &word];
[outputScanner scanUpToString: @" " intoString: &count];
[outputScanner scanUpToString: @":" intoString: &offset];
found = [sender isWordInUserDictionaries: word caseSensitive: NO];
if(!found)
{
start = [inputScanner scanLocation] - [word length];
r = NSMakeRange(start, [word length]);
break;
}
}
else
if([indicator isEqualToString: @"#"])
{
BOOL found = NO;
[outputScanner scanUpToString: @" " intoString: &word];
[outputScanner scanUpToString: @" " intoString: &offset];
found = [sender isWordInUserDictionaries: word caseSensitive: NO];
if(!found)
{
start = [inputScanner scanLocation] - [word length];
r = NSMakeRange(start, [word length]);
break;
}
}
}
*wordCount++;
} }
} }
else
{
const char *p = [stringToCheck UTF8String];
AspellToken token;
int length = strlen(p);
aspell_document_checker_process(checker, p, length);
token = aspell_document_checker_next_misspelling(checker);
r = NSMakeRange(token.offset,token.len);
}
#else
NSLog(@"spellServer:findMisspelledWordInString:... invoked, spell server not configured.");
#endif
return r; return r;
} }
@ -239,87 +99,32 @@ findMisspelledWordInString:(NSString *)stringToCheck
inLanguage:(NSString *)language inLanguage:(NSString *)language
{ {
NSMutableArray *array = [NSMutableArray array]; NSMutableArray *array = [NSMutableArray array];
NSString *checkCommand = @"^", *fullCommand = nil, *outputString = nil; const char *p = [word UTF8String];
NSScanner *inputScanner = nil; int len = strlen(p);
NSData *inputData = nil, *outputData = nil; int words = 0;
NSData *returnChar = [NSData dataWithBytes: "\n"
length: 1];
NSFileHandle
*standardInput = [[[self _runIspell] standardInput] fileHandleForWriting],
*standardOutput = [[[self _runIspell] standardOutput] fileHandleForReading];
char *p = 0;
unsigned int i = 0;
BOOL stop = NO;
fullCommand = [checkCommand stringByAppendingString: word]; #ifdef HAVE_ASPELL_H
inputData = [NSData dataWithString: fullCommand]; {
[standardInput writeData: inputData]; const struct AspellWordList *list = aspell_speller_suggest(speller, p, len);
[standardInput writeData: returnChar]; AspellStringEnumeration *en;
// Check to see if the first character in the byte stream is words = aspell_word_list_size(list);
// a carriage return. If so, no spelling errors were found. en = aspell_word_list_elements(list);
outputData = [standardOutput availableData];
// look at the results // add them to the array.
p = (char *)[outputData bytes]; while(!aspell_string_enumeration_at_end(en))
if(p[0] != '\n') {
{ const char *string = aspell_string_enumeration_next(en);
NSString *indicator = nil; NSString *word = [NSString stringWithUTF8String: string];
NSString *word = nil; [array addObject: word];
NSScanner *outputScanner = nil; }
int i = 0;
// replace the first carriage return with a NULL to prevent the // cleanup.
// NSString from being constructed incorrectly delete_aspell_string_enumeration(en);
while(p[i] != '\n') }
{ #else
i++; NSLog(@"spellServer:suggestGuessesForWord:... invoked, spell server not configured");
} #endif
p[i] = 0;
// Put everything back into a string for scanning
outputString = [NSString stringWithCString: p];
outputScanner = [NSScanner scannerWithString: outputString];
[outputScanner setCharactersToBeSkipped: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
// Scan the string for the indicator. Either & or #.
// The "&" and "?" symbols indicates a misspelled word for which ispell can suggest corrections
// whereas the "#" symbol represents a word for which ispell cannot suggest corrections.
[outputScanner scanUpToString: @" " intoString: &indicator];
if([indicator isEqualToString: @"&"]
|| [indicator isEqualToString: @"?"])
{
// get past the ": " on ispell's output line
[outputScanner scanUpToString: @": " intoString: NULL];
[outputScanner scanString: @": " intoString: NULL];
while(![outputScanner isAtEnd])
{
NSString *guessWord = nil;
if([outputScanner scanUpToString: @", " intoString: &guessWord])
{
[outputScanner scanString: @", " intoString: NULL];
}
else
if(![outputScanner scanUpToCharactersFromSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]
intoString: &guessWord])
{
break;
}
if(guessWord != nil)
{
[array addObject: guessWord];
}
}
}
else
if([indicator isEqualToString: @"#"])
{
[outputScanner scanUpToString: @" " intoString: &word];
}
}
return array; return array;
} }
@ -328,27 +133,40 @@ findMisspelledWordInString:(NSString *)stringToCheck
didLearnWord:(NSString *)word didLearnWord:(NSString *)word
inLanguage:(NSString *)language inLanguage:(NSString *)language
{ {
#ifdef HAVE_ASPELL_H
NSLog(@"Stubbed out -- Learning word: %@", word); {
const char *aword = [word UTF8String];
aspell_speller_add_to_personal(speller, aword, strlen(aword));
NSLog(@"Not implemented");
}
#else
NSLog(@"spellServer:didLearnWord:inLanguage: invoked, spell server not configured");
#endif
} }
- (void)spellServer:(NSSpellServer *)sender - (void)spellServer:(NSSpellServer *)sender
didForgetWord:(NSString *)word didForgetWord:(NSString *)word
inLanguage:(NSString *)language inLanguage:(NSString *)language
{ {
NSLog(@"Stubbed out -- Forgetting word: %@", word); #ifdef HAVE_ASPELL_H
NSLog(@"Not implemented");
#else
NSLog(@"spellServer:didForgetWord:inLanguage: invoked, spell server not configured");
#endif
} }
- init - init
{ {
[super init]; self = [super init];
[[NSNotificationCenter defaultCenter] if(self != nil)
addObserver: self {
selector: @selector(_handleTaskTermination:) #ifdef HAVE_ASPELL_H
name: NSTaskDidTerminateNotification // initialization...
object: nil]; config = new_aspell_config();
[self _runIspell]; speller = to_aspell_speller(new_aspell_speller(config));
checker = to_aspell_document_checker(new_aspell_document_checker(speller));
#endif
}
return self; return self;
} }
@end @end
@ -362,8 +180,6 @@ int main(int argc, char** argv)
CREATE_AUTORELEASE_POOL (_pool); CREATE_AUTORELEASE_POOL (_pool);
NSSpellServer *aServer = [[NSSpellServer alloc] init]; NSSpellServer *aServer = [[NSSpellServer alloc] init];
if ([aServer registerLanguage: @"AmericanEnglish" byVendor: @"GNU"]) //&& if ([aServer registerLanguage: @"AmericanEnglish" byVendor: @"GNU"]) //&&
// [aServer registerLanguage: @"Spanish" byVendor: @"GNU"] &&
// [aServer registerLanguage: @"French" byVendor: @"GNU"] )
{ {
[aServer setDelegate: [[GNUSpellChecker alloc] init]]; [aServer setDelegate: [[GNUSpellChecker alloc] init]];
NSLog(@"Spell server started and waiting."); NSLog(@"Spell server started and waiting.");

216
configure vendored
View file

@ -4920,6 +4920,222 @@ echo "$as_me: -gui will be linked against -lX11 to support ungif images" >&6;}
fi fi
fi fi
#--------------------------------------------------------------------
# Check for the spelling lib, for the built-in spell checker...
#--------------------------------------------------------------------
echo "$as_me:$LINENO: checking for new_aspell_document_checker in -laspell" >&5
echo $ECHO_N "checking for new_aspell_document_checker in -laspell... $ECHO_C" >&6
if test "${ac_cv_lib_aspell_new_aspell_document_checker+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-laspell $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char new_aspell_document_checker ();
int
main ()
{
new_aspell_document_checker ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_aspell_new_aspell_document_checker=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_aspell_new_aspell_document_checker=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_aspell_new_aspell_document_checker" >&5
echo "${ECHO_T}$ac_cv_lib_aspell_new_aspell_document_checker" >&6
if test $ac_cv_lib_aspell_new_aspell_document_checker = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBASPELL 1
_ACEOF
LIBS="-laspell $LIBS"
fi
if test "${ac_cv_lib_aspell_new_aspell_document_checker}" = yes; then
for ac_header in aspell.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc in
yes:no )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
## Report this to bug-autoconf@gnu.org. ##
## ------------------------------------ ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
no:yes )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
## Report this to bug-autoconf@gnu.org. ##
## ------------------------------------ ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
cat >>confdefs.h <<\_ACEOF
#define HAVE_ASPELL 1
_ACEOF
fi
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# NSSound # NSSound

View file

@ -250,6 +250,14 @@ if test "${enable_ungif}" = yes; then
fi fi
fi fi
#--------------------------------------------------------------------
# Check for the spelling lib, for the built-in spell checker...
#--------------------------------------------------------------------
AC_CHECK_LIB(aspell, new_aspell_document_checker)
if test "${ac_cv_lib_aspell_new_aspell_document_checker}" = yes; then
AC_CHECK_HEADERS(aspell.h)
AC_DEFINE(HAVE_ASPELL,1,[Define if you have the aspell header])
fi
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# NSSound # NSSound