Fix contrib/xml2 makefile to not override CFLAGS, and in passing make it
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 8 May 2008 16:49:48 +0000 (16:49 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 8 May 2008 16:49:48 +0000 (16:49 +0000)
auto-configure properly for libxslt present or not.

contrib/Makefile
contrib/xml2/Makefile
contrib/xml2/xslt_proc.c
doc/src/sgml/xml2.sgml

index be72cecb12e0b1a8b4fc87ebf2d85c4a3ecfca89..cccdd5d237eb9473ae2f6a3b05eb869aec1fced5 100644 (file)
@@ -46,10 +46,8 @@ WANTED_DIRS += uuid-ossp
 endif
 
 ifeq ($(with_libxml),yes)
-ifeq ($(with_libxslt),yes)
 WANTED_DIRS += xml2
 endif
-endif
 
 # Missing:
 #              start-scripts   \ (does not have a makefile)
index 3c7eef8b200a3481dce8e47603117a82f4efdea5..ea8636ad4c7ada120b9879b0f8b36639b6a5dc29 100644 (file)
@@ -2,17 +2,13 @@
 
 MODULE_big = pgxml
 
-# Remove xslt_proc.o from the following line if you don't have libxslt
-OBJS = xpath.o xslt_proc.o
+OBJS = $(if $(filter -lxslt, $(LIBS)), xpath.o xslt_proc.o, xpath.o)
 
-# Remove -lxslt from the following line if you don't have libxslt.
-SHLIB_LINK = -lxslt -lxml2
+SHLIB_LINK += $(filter -lxslt, $(LIBS)) $(filter -lxml2, $(LIBS))
 
 DATA_built = pgxml.sql
 DATA = uninstall_pgxml.sql
 
-override CFLAGS += $(shell xml2-config --cflags)
-
 ifdef USE_PGXS
 PG_CONFIG = pg_config
 PGXS := $(shell $(PG_CONFIG) --pgxs)
index f498192426098a10713a9c0b25b08c07b3e32356..b2349aaace7ec2cb64c10a213f9812da23f71dc5 100644 (file)
@@ -119,7 +119,7 @@ xslt_process(PG_FUNCTION_ARGS)
        if (resstat < 0)
                PG_RETURN_NULL();
 
-       PG_RETURN_TEXT_P(cstring_to_text_with_len(resstr, reslen));
+       PG_RETURN_TEXT_P(cstring_to_text_with_len((char *) resstr, reslen));
 }
 
 
index 3f200802c756ab65a205785c4e8e7c37bd223db0..e1641e8815b1ef6d90c5e3ae4036c9452934ed1b 100644 (file)
@@ -374,9 +374,7 @@ WHERE t.author_id = p.person_id;
   <title>XSLT functions</title>
 
   <para>
-   The following functions are available if libxslt is installed (this is
-   not currently detected automatically, so you will have to amend the
-   Makefile):
+   The following functions are available if libxslt is installed:
   </para>
 
   <sect3>