Add Yavor Doganov's patches for tests and config. Add fixes for GSXML

validation of xml documents
This commit is contained in:
Richard Frith-Macdonald 2018-01-14 12:30:13 +00:00
parent 31257785d6
commit 925f1dd5e1
19 changed files with 260 additions and 98 deletions

View file

@ -1,3 +1,40 @@
2018-01-14 Yavor Doganov <yavor@gnu.org>
* Tests/base/NSXMLDocument/basic.m:
* Tests/base/NSXMLDocument/cdata.m:
* Tests/base/NSXMLNode/basic.m:
* Tests/base/NSXMLElement/attributes.m:
* Tests/base/NSXMLElement/basic.m:
* Tests/base/NSXMLElement/children.m:
* Tests/base/NSXMLElement/transfer.m:
* Tests/base/NSXMLNode/children.m:
* Tests/base/NSXMLNode/description.m:
* Tests/base/NSXMLNode/kinds.m:
* Tests/base/NSXMLNode/namespaces.m: Skip tests if libxml2 is not
available.
* Tests/base/NSTimeZone/use.m: Skip one more test if
NSLOCALE_SUPPORTED is undefined.
* Tests/base/NSRegularExpression/basic.m: Skip all tests if ICU is
not available.
2018-01-14 Richard Frith-Macdonald <rfm@gnu.org>
* configure.ac: Remove explicit test for SAX2.h as we now assume
it is present based on the version of libxml2.
* configure: regenerate
* Source/GSXML.m: fix errors in loading/resolving of external entities
and fix the parsing methods to correctly return whether the xml was
validated against a DTD (when that feature is turned on).
* Tests/base/GSXML/basic.m: add a couple of tests for resolving
external references and validating against a DTD.
2018-01-14 Yavor Doganov <yavor@gnu.org>
* configure.ac: Use PKG_PROG_PKG_CONFIG instead of AC_PATH_PROG to
find pkg-config as it supports cross-compilation.
* configure.ac: Bump ICU requirement to >= 50 for UDAT_PATTERN.
2018-01-11 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSXMLParser.m: OSX compatibility tweaks and correction

View file

@ -885,6 +885,11 @@
# endif
#endif
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS

View file

@ -107,6 +107,8 @@ static Class treeClass;
static IMP usImp;
static SEL usSel;
static xmlExternalEntityLoader originalLoader = NULL;
/*
* Macro to cast results to correct type for libxml2
*/
@ -170,8 +172,11 @@ setupCache()
}
static xmlParserInputPtr
loadEntityFunction(void *ctx,
const unsigned char *eid, const unsigned char *url);
loadEntityFunction(const unsigned char *url, const unsigned char *eid,
void *ctx);
static xmlParserInputPtr
resolveEntityFunction(void *ctx, const unsigned char *eid,
const unsigned char *url);
static xmlEntityPtr
getEntityIgnoreExternal(void *ctx, const xmlChar *name);
static xmlEntityPtr
@ -1651,6 +1656,15 @@ static NSString *endMarker = @"At end of incremental parse";
beenHere = YES;
if (cacheDone == NO)
setupCache();
/* Replace the default external entity loader with our own one which
* looks for GNUstep DTDs in the correct location.
*/
if (NULL == originalLoader)
{
originalLoader = xmlGetExternalEntityLoader();
xmlSetExternalEntityLoader(
(xmlExternalEntityLoader)loadEntityFunction);
}
}
}
@ -2120,7 +2134,9 @@ static NSString *endMarker = @"At end of incremental parse";
}
/**
* Parse source. Return YES if parsed, otherwise NO.
* Parse source. Return YES if parsed as valid, otherwise NO.
* If validation against a DTD is not enabled, the return value simply
* indicates whether the xml was well formed.<br />
* This method should be called once to parse the entire document.
* <example>
* GSXMLParser *p = [GSXMLParser parserWithContentsOfFile:@"macos.xml"];
@ -2187,10 +2203,13 @@ static NSString *endMarker = @"At end of incremental parse";
[self _parseChunk: nil];
RELEASE(tmp);
if (((xmlParserCtxtPtr)lib)->wellFormed)
return YES;
else
return NO;
if (((xmlParserCtxtPtr)lib)->wellFormed != 0
&& (0 == ((xmlParserCtxtPtr)lib)->validate
|| ((xmlParserCtxtPtr)lib)->valid != 0))
{
return YES;
}
return NO;
}
/**
@ -2201,7 +2220,8 @@ static NSString *endMarker = @"At end of incremental parse";
* document has been parsed, the method should be called with
* an empty or nil data object to indicate end of parsing.
* On this final call, the return value indicates whether the
* document was valid or not.
* document was valid or not. If validation to a DTD is not enabled,
* the return value simply indicates whether the xml was well formed.
* </p>
* <example>
* GSXMLParser *p = [GSXMLParser parserWithSAXHandler: nil source: nil];
@ -2239,10 +2259,13 @@ static NSString *endMarker = @"At end of incremental parse";
{
[self _parseChunk: nil];
src = endMarker;
if (((xmlParserCtxtPtr)lib)->wellFormed)
return YES;
else
return NO;
if (((xmlParserCtxtPtr)lib)->wellFormed != 0
&& (0 == ((xmlParserCtxtPtr)lib)->validate
|| ((xmlParserCtxtPtr)lib)->valid != 0))
{
return YES;
}
return NO;
}
else
{
@ -2375,7 +2398,7 @@ static NSString *endMarker = @"At end of incremental parse";
/*
* Set the entity loading function for this parser to be our one.
*/
((xmlParserCtxtPtr)lib)->sax->resolveEntity = loadEntityFunction;
((xmlParserCtxtPtr)lib)->sax->resolveEntity = resolveEntityFunction;
}
return YES;
}
@ -2465,9 +2488,24 @@ static NSString *endMarker = @"At end of incremental parse";
+ (void) initialize
{
if (cacheDone == NO)
static BOOL beenHere = NO;
if (beenHere == NO)
{
setupCache();
beenHere = YES;
if (cacheDone == NO)
{
setupCache();
}
/* Replace the default external entity loader with our own one which
* looks for GNUstep DTDs in the correct location.
*/
if (NULL == originalLoader)
{
originalLoader = xmlGetExternalEntityLoader();
xmlSetExternalEntityLoader(
(xmlExternalEntityLoader)loadEntityFunction);
}
}
}
@ -2576,15 +2614,20 @@ getEntityResolveExternal(void *ctx, const xmlChar *name)
}
/* WARNING ... as far as I can tell libxml2 never uses the resolveEntity
* callback, so this function is never called.
* To implement the -resolveEntities method we therefore intercept the
* getEntity callback, ree-implementing some of the code inside libxml2
* to avoid attempts to load/parse external entities unless we have
* specifically enabled that behavior.
* callback, so this function is never called via that route.
* We therefore also set this as the global default entity loading
* function (in [GSXMLParser+initialize] and [GSSAXHandler+initialize]).
*
* To implement the -resolveEntities method we must permit/deny any attempt
* to load an entity (before the function to resolve is even called),
* We therefore intercept the getEntity callback (using getEntityDefault()),
* re-implementing some of the code inside libxml2 to avoid attempts to
* load/parse external entities unless we have specifically enabled it.
*/
static xmlParserInputPtr
loadEntityFunction(void *ctx,
const unsigned char *eid, const unsigned char *url)
loadEntityFunction(const unsigned char *url,
const unsigned char *eid,
void *ctx)
{
NSString *file = nil;
NSString *entityId;
@ -2623,7 +2666,6 @@ loadEntityFunction(void *ctx,
options: NSLiteralSearch
range: NSMakeRange(0, [local length])];
#ifdef GNUSTEP
if ([location rangeOfString: @"/DTDs/PropertyList"].length > 0)
{
file = [location substringFromIndex: 6];
@ -2636,9 +2678,8 @@ loadEntityFunction(void *ctx,
file = nil;
}
}
#endif
if (file == nil)
if (file == nil && ((xmlParserCtxtPtr)ctx)->_private != NULL)
{
/*
* Now ask the SAXHandler callback for the name of a local file
@ -2784,11 +2825,17 @@ loadEntityFunction(void *ctx,
UTF8STRING([theURL absoluteString]));
}
/*
* A local DTD will now be in the catalog: The builtin entity resolver can
/* A local DTD will now be in the catalog: The builtin entity resolver can
* take over.
*/
return xmlSAX2ResolveEntity(ctx, eid, url);
return (*originalLoader)((const char*)url, (const char*)eid, ctx);
}
static xmlParserInputPtr
resolveEntityFunction(void *ctx,
const unsigned char *eid, const unsigned char *url)
{
return loadEntityFunction(url, eid, ctx);
}
@ -3584,7 +3631,7 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
LIB->fatalError = (void*) fatalErrorFunction;
LIB->getParameterEntity = (void*) getParameterEntityFunction;
LIB->cdataBlock = (void*) cdataBlockFunction;
LIB->resolveEntity = (void*) loadEntityFunction;
LIB->resolveEntity = (void*) resolveEntityFunction;
#undef LIB
return YES;
}

View file

@ -164,6 +164,38 @@ int main()
PASS_EQUAL([[[parser document] root] content], @"&A",
"external entity is ignored")
parser = [GSXMLParser parserWithData:
[str dataUsingEncoding: NSUTF8StringEncoding]];
[parser substituteEntities: YES];
[parser resolveEntities: YES];
[parser parse];
str = [[[parser document] root] content];
PASS([str rangeOfString: @"MAKEFILES"].length > 0,
"external entity is resolved")
str = @"<!DOCTYPE plist PUBLIC \"-//GNUstep//DTD plist 0.9//EN\""
@" \"http://www.gnustep.org/plist-0_9.xml\">\n"
@"<plist></plist>";
parser = [GSXMLParser parserWithData:
[str dataUsingEncoding: NSUTF8StringEncoding]];
[parser substituteEntities: YES];
[parser resolveEntities: YES];
[parser doValidityChecking: YES];
PASS([parser parse] == NO, "empty plist is not valid")
str = @"<!DOCTYPE plist PUBLIC \"-//GNUstep//DTD plist 0.9//EN\""
@" \"http://www.gnustep.org/plist-0_9.xml\">\n"
@"<plist><string>xxx</string></plist>";
parser = [GSXMLParser parserWithData:
[str dataUsingEncoding: NSUTF8StringEncoding]];
[parser substituteEntities: YES];
[parser resolveEntities: YES];
[parser doValidityChecking: YES];
PASS([parser parse] == YES, "plist containing string is valid")
PASS_EQUAL([[[[[parser document] root] firstChild] firstChild] content],
@"xxx", "root/plist/string is parsed")
[arp release]; arp = nil;
return 0;
}

View file

@ -54,6 +54,11 @@
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
START_SET("NSRegularExpression")
#if !(__APPLE__ || GS_USE_ICU)
SKIP("NSRegularExpression not built\nThe ICU library was not available when GNUstep-base was built")
#else
# ifdef GNUSTEP
// Ensure that a deterministic limit is set up for this process
NSUserDefaults *dflts = [NSUserDefaults standardUserDefaults];
@ -164,6 +169,9 @@ int main()
beforeDate: [NSDate dateWithTimeIntervalSinceNow: 0.01]];
}
PASS(NO == [thread isExecuting], "Faulty regular expression terminated");
#endif
END_SET("NSRegularExpression")
[arp release]; arp = nil;
return 0;
}

View file

@ -49,16 +49,16 @@ int main()
&& [current secondsFromGMT] == offset
&& [current isDaylightSavingTime] == NO,
"can set default time zone");
START_SET("NSLocale")
if (!NSLOCALE_SUPPORTED)
SKIP("NSLocale not supported\nThe ICU library was not available when GNUstep-base was built")
current = [NSTimeZone timeZoneWithName: @"Europe/Brussels"];
date = [current nextDaylightSavingTimeTransitionAfterDate:
[NSDate dateWithString: @"2013-06-08 20:00:00 +0200"]];
PASS_EQUAL(date, [NSDate dateWithString: @"2013-10-27 03:00:00 +0200"],
"can calculate next DST transition");
START_SET("NSLocale")
if (!NSLOCALE_SUPPORTED)
SKIP("NSLocale not supported\nThe ICU library was not available when GNUstep-base was built")
current = [NSTimeZone timeZoneWithName: @"America/Sao_Paulo"];
locale = [[NSLocale alloc] initWithLocaleIdentifier: @"en_GB"];

View file

@ -2,10 +2,15 @@
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSXMLDocument.h>
#import <Foundation/NSXMLElement.h>
#import "GNUstepBase/GSConfig.h"
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
START_SET("NSXMLDocument")
#if !GS_USE_LIBXML
SKIP("library built without libxml2")
#else
NSArray *nodes = nil;
NSXMLDocument *node;
NSXMLDocument *node2;
@ -91,7 +96,9 @@ int main()
error:NULL];
PASS([node isEqual: node2],
"Equal documents are equivalent");
#endif
END_SET("NSXMLDocument")
[arp release];
arp = nil;

View file

@ -2,10 +2,15 @@
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSXMLDocument.h>
#import <Foundation/NSXMLElement.h>
#import "GNUstepBase/GSConfig.h"
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
START_SET("NSXMLDocument CDATA")
#if !GS_USE_LIBXML
SKIP("library built without libxml2")
#else
NSString *docString = @"<root><node><![CDATA[How to read this text ?]]></node></root>";
NSData *data = [docString dataUsingEncoding: NSUTF8StringEncoding];
NSError *outError = nil;
@ -17,7 +22,9 @@ int main()
NSXMLNode *childNode = [rootElement childAtIndex: 0];
NSString *cData = [childNode stringValue];
PASS_EQUAL(cData, @"How to read this text ?", "CDATA element is correct");
#endif
END_SET("NSXMLDocument CDATA")
[arp release];
arp = nil;

View file

@ -2,10 +2,15 @@
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSXMLDocument.h>
#import <Foundation/NSXMLElement.h>
#import "GNUstepBase/GSConfig.h"
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
START_SET("NSXMLElement attributes")
#if !GS_USE_LIBXML
SKIP("library built without libxml2")
#else
NSXMLElement *root1;
NSXMLElement *root2;
NSXMLNode *attr1;
@ -42,6 +47,8 @@ int main()
[root1 release];
[root2 release];
#endif
END_SET("NSXMLElement attributes")
[arp release];
arp = nil;

View file

@ -1,10 +1,15 @@
#import "ObjectTesting.h"
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSXMLElement.h>
#import "GNUstepBase/GSConfig.h"
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
START_SET("NSXMLElement")
#if !GS_USE_LIBXML
SKIP("library built without libxml2")
#else
NSXMLElement *node;
NSXMLElement *other;
NSXMLElement *xml;
@ -84,7 +89,8 @@ int main()
[node release];
[other release];
#endif
END_SET("NSXMLElement")
[arp release];
arp = nil;

View file

@ -2,10 +2,15 @@
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSXMLDocument.h>
#import <Foundation/NSXMLElement.h>
#import "GNUstepBase/GSConfig.h"
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
START_SET("NSXMLElement children")
#if !GS_USE_LIBXML
SKIP("library built without libxml2")
#else
NSXMLElement *root1;
NSXMLElement *root2;
NSXMLElement *child1;
@ -124,7 +129,8 @@ int main()
[root2 release];
[child1 release];
[child2 release];
#endif
END_SET("NSXMLElement children")
[arp release];
arp = nil;

View file

@ -2,6 +2,7 @@
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSXMLDocument.h>
#import <Foundation/NSXMLElement.h>
#import "GNUstepBase/GSConfig.h"
/*
int main()
@ -25,6 +26,10 @@ int main()
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
START_SET("NSXMLElement transfer")
#if !GS_USE_LIBXML
SKIP("library built without libxml2")
#else
NSXMLDocument *doc;
NSXMLElement *elem;
NSXMLNode *child;
@ -45,7 +50,9 @@ int main()
child = [elem childAtIndex: 0];
[doc release];
#endif
END_SET("NSXMLElement transfer")
[arp release];
arp = nil;

View file

@ -2,10 +2,15 @@
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSXMLNode.h>
#import <Foundation/NSValue.h>
#import "GNUstepBase/GSConfig.h"
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
START_SET("NSXMLNode")
#if !GS_USE_LIBXML
SKIP("library built without libxml2")
#else
NSXMLNode *node;
NSXMLNode *other;
NSXMLNode *text;
@ -111,7 +116,9 @@ int main()
[attr setStringValue: @"aString"];
PASS_EQUAL([attr stringValue], @"aString",
"setting string value on attr node works");
#endif
END_SET("NSXMLNode")
[arp release];
arp = nil;

View file

@ -3,11 +3,14 @@
#import <Foundation/NSXMLNode.h>
#import <Foundation/NSXMLDocument.h>
#import <Foundation/NSXMLElement.h>
#import "GNUstepBase/GSConfig.h"
int main()
{
START_SET("NSXMLNode - handling children")
#if !GS_USE_LIBXML
SKIP("library built without libxml2")
#else
NS_DURING
{
NSXMLElement *node = [[NSXMLElement alloc] initWithKind: NSXMLElementKind];
@ -54,6 +57,7 @@ int main()
PASS (0 == 1, "NSXML child handling working."); // I don't think this is valid... commenting out for now.
}
NS_ENDHANDLER
#endif
END_SET("NSXMLNode - handling children")
return 0;
}

View file

@ -5,6 +5,7 @@
*/
#import <Foundation/Foundation.h>
#import "GNUstepBase/GSConfig.h"
int
main(int argc, const char *argv[])
@ -18,7 +19,9 @@ main(int argc, const char *argv[])
START_SET("NSXMLNode - descriptions")
#if !GS_USE_LIBXML
SKIP("library built without libxml2")
#else
xmlDocStr = @"<?xml version=\"1.0\" encoding=\"utf-8\"?><env:Envelope xmlns:env=\"http://myurl/mypath/envelope\"><InvokeStampatore xmlns=\"http://tempuri.org/\"> <Flusso><IdFlusso>DF247309-57F8-4CDB-8711-6E9DB69BCE74</IdFlusso><Sorgente>FOX/EDI</Sorgente><DataRichiesta>2012-06-26T17:00:00.717</DataRichiesta><OraRichiesta>17:00</OraRichiesta> <NumeroDocumenti>10</NumeroDocumenti><Lettera><IdCrm>FakeField</IdCrm><TipoDocumento>1001</TipoDocumento><DataDocumento>2012-06-26T14:45:08.673Z</DataDocumento><Utente>FakeUser</Utente><Priorita>Normale</Priorita><PraticaName>FakeName</PraticaName><ContentHeader> <fieldList> <Field><name>Campaign.Name</name> <value>Campagna ENP</value></Field><Field><name>Cliente.Cap</name><value>37053</value></Field></fieldList></ContentHeader></Lettera></Flusso></InvokeStampatore></env:Envelope>";
xmlDoc = [[NSXMLDocument alloc] initWithXMLString:xmlDocStr options:0 error:error];
@ -33,7 +36,7 @@ main(int argc, const char *argv[])
[[[rootElement children] objectAtIndex: 0] description],
@"<InvokeStampatore xmlns=\"http://tempuri.org/\"><Flusso><IdFlusso>DF247309-57F8-4CDB-8711-6E9DB69BCE74</IdFlusso><Sorgente>FOX/EDI</Sorgente><DataRichiesta>2012-06-26T17:00:00.717</DataRichiesta><OraRichiesta>17:00</OraRichiesta><NumeroDocumenti>10</NumeroDocumenti><Lettera><IdCrm>FakeField</IdCrm><TipoDocumento>1001</TipoDocumento><DataDocumento>2012-06-26T14:45:08.673Z</DataDocumento><Utente>FakeUser</Utente><Priorita>Normale</Priorita><PraticaName>FakeName</PraticaName><ContentHeader><fieldList><Field><name>Campaign.Name</name><value>Campagna ENP</value></Field><Field><name>Cliente.Cap</name><value>37053</value></Field></fieldList></ContentHeader></Lettera></Flusso></InvokeStampatore>",
"child description");
#endif
END_SET("NSXMLNode - descriptions")
return 0;

View file

@ -5,6 +5,7 @@
#import <Foundation/NSXMLElement.h>
#import <Foundation/NSXMLDTD.h>
#import <Foundation/NSXMLDTDNode.h>
#import "GNUstepBase/GSConfig.h"
#define NODE_KIND_HAS_CLASS(node, kind, theClass) \
do \
@ -18,6 +19,9 @@
int main()
{
START_SET("NSXMLNode -initWithKind: initializer")
#if !GS_USE_LIBXML
SKIP("library built without libxml2")
#else
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSXMLNode *node;
NS_DURING
@ -39,6 +43,7 @@ int main()
NS_ENDHANDLER
[arp release];
arp = nil;
#endif
END_SET("NSXMLNode -initWithKind: initializer")
return 0;
}

View file

@ -19,6 +19,7 @@
#import <Foundation/NSXMLNode.h>
#import <Foundation/NSXMLDocument.h>
#import <Foundation/NSXMLElement.h>
#import "GNUstepBase/GSConfig.h"
NSString *kGDataNamespaceGData = @"http://schemas.google.com/g/2005";
NSString *kGDataNamespaceBatch = @"http://schemas.google.com/gdata/batch";
@ -29,6 +30,9 @@ NSString *kGDataNamespaceAtomPrefix = @"atom";
int main()
{
START_SET("NSXMLNode namespace handling")
#if !GS_USE_LIBXML
SKIP("library built without libxml2")
#else
NSAutoreleasePool *arp = [NSAutoreleasePool new];
// create elements and attributes
@ -180,6 +184,7 @@ int main()
[arp drain];
arp = nil;
#endif
END_SET("NSXMLNode namespace handling")
return 0;
}

69
configure vendored
View file

@ -715,7 +715,6 @@ ac_cv_sizeof_short
GS_UINT8
GS_SINT8
GS_WORDS_BIGENDIAN
PKGCONFIG
WHOAMI
EGREP
GREP
@ -5789,47 +5788,7 @@ $as_echo "no" >&6; }
fi
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PKGCONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PKGCONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in no
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_PKGCONFIG" && ac_cv_path_PKGCONFIG="yes"
;;
esac
fi
PKGCONFIG=$ac_cv_path_PKGCONFIG
if test -n "$PKGCONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5
$as_echo "$PKGCONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
PKG_PROG_PKG_CONFIG
#--------------------------------------------------------------------
# specific target_os options
@ -10486,10 +10445,10 @@ esac
fi
if test "$do_broken_libffi" = "no"; then
if test "$PKGCONFIG" = "yes"; then
if pkg-config --exists libffi; then
if test -n "$PKG_CONFIG"; then
if $PKG_CONFIG --exists libffi; then
pkg_config_libffi=yes
ffi_CFLAGS=`pkg-config --cflags libffi`;
ffi_CFLAGS=`$PKG_CONFIG --cflags libffi`;
CPPFLAGS="$CPPFLAGS $ffi_CFLAGS"
INCLUDE_FLAGS="$INCLUDE_FLAGS $ffi_CFLAGS"
fi
@ -11540,13 +11499,13 @@ if test $enable_tls = yes; then
saved_LIBS="$LIBS"
saved_CFLAGS="$CFLAGS"
if test $PKGCONFIG = yes; then
if test -n "$PKG_CONFIG"; then
if pkg-config --exists gnutls; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking gnutls support" >&5
$as_echo_n "checking gnutls support... " >&6; }
HAVE_GNUTLS=1
TLS_CFLAGS=`pkg-config --cflags gnutls`
TLS_LIBS=`pkg-config --libs gnutls`
TLS_CFLAGS=`$PKG_CONFIG --cflags gnutls`
TLS_LIBS=`$PKG_CONFIG --libs gnutls`
fi
fi
@ -12134,9 +12093,9 @@ fi
echo "See http://site.icu-project.org/ for help."
else
ICU_VERSION=`$ICU_CONFIG --version`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ICU >= 4.6" >&5
$as_echo_n "checking for ICU >= 4.6... " >&6; }
found=`expr $ICU_VERSION \>= 4.6`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ICU >= 50" >&5
$as_echo_n "checking for ICU >= 50... " >&6; }
found=`expr $ICU_VERSION \>= 50`
if test "$found" = "1" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
@ -12195,6 +12154,14 @@ else
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext;
ac_fn_c_check_decl "$LINENO" "UDAT_PATTERN" "ac_cv_have_decl_UDAT_PATTERN" "#include <unicode/udat.h>
"
if test "x$ac_cv_have_decl_UDAT_PATTERN" = xyes; then :
have_icu=yes
else
have_icu=no
fi
LDFLAGS="$saved_LDFLAGS";
ICU_LIBS="-licui18n -licuuc -licudata -lm"
fi

View file

@ -1210,7 +1210,7 @@ AC_LANG_POP(C)
AC_PATH_PROG(WHOAMI, whoami, echo, $PATH:/usr/ucb)
AC_PATH_PROG(PKGCONFIG, pkg-config, yes, no)
PKG_PROG_PKG_CONFIG
#--------------------------------------------------------------------
# specific target_os options
@ -2793,10 +2793,10 @@ GS_ADD_LIBRARY_PATH([${ffi_libdir}])
fi
if test "$do_broken_libffi" = "no"; then
if test "$PKGCONFIG" = "yes"; then
if pkg-config --exists libffi; then
if test -n "$PKG_CONFIG"; then
if $PKG_CONFIG --exists libffi; then
pkg_config_libffi=yes
ffi_CFLAGS=`pkg-config --cflags libffi`;
ffi_CFLAGS=`$PKG_CONFIG --cflags libffi`;
CPPFLAGS="$CPPFLAGS $ffi_CFLAGS"
INCLUDE_FLAGS="$INCLUDE_FLAGS $ffi_CFLAGS"
fi
@ -3188,12 +3188,12 @@ if test $enable_tls = yes; then
saved_LIBS="$LIBS"
saved_CFLAGS="$CFLAGS"
if test $PKGCONFIG = yes; then
if test -n "$PKG_CONFIG"; then
if pkg-config --exists gnutls; then
AC_MSG_CHECKING(gnutls support)
HAVE_GNUTLS=1
TLS_CFLAGS=`pkg-config --cflags gnutls`
TLS_LIBS=`pkg-config --libs gnutls`
TLS_CFLAGS=`$PKG_CONFIG --cflags gnutls`
TLS_LIBS=`$PKG_CONFIG --libs gnutls`
fi
fi
@ -3314,7 +3314,7 @@ AC_ARG_WITH(icu-library,
if test $enable_icu = yes; then
if test "$enable_icu_config" = "yes"; then
AC_CHECK_ICU(4.6, have_icu=yes, have_icu=no)
AC_CHECK_ICU(50, have_icu=yes, have_icu=no)
else
have_icu=no;
AC_CHECKING([for libicu (icu-config disabled)])
@ -3324,6 +3324,8 @@ if test $enable_icu = yes; then
saved_LDFLAGS="$LDFLAGS";
LDFLAGS="$LDFLAGS $LIBS $ICU_LDFLAGS -licui18n -licuuc -licudata -lm"
AC_TRY_LINK([],[], have_icu="yes", have_icu="no");
AC_CHECK_DECL([UDAT_PATTERN], [have_icu=yes], [have_icu=no],
[#include <unicode/udat.h>])
LDFLAGS="$saved_LDFLAGS";
ICU_LIBS="-licui18n -licuuc -licudata -lm"
fi