Re: build/install xml2 when configured with libxml - Mailing list pgsql-patches

From Andrew Dunstan
Subject Re: build/install xml2 when configured with libxml
Date
Msg-id 46212B3C.6050004@dunslane.net
Whole thread Raw
In response to Re: build/install xml2 when configured with libxml  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: build/install xml2 when configured with libxml
List pgsql-patches

Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.net> writes:
>
>> Peter Eisentraut wrote:
>>
>>> But the policy is that the presence of features in the final build
>>> should not depend on the incidental presence of features in the build
>>> environment.  Either you select a feature, then it's built, or you
>>> don't, then it's not.  So the only options we really have are adding
>>> another switch for libxslt, or including it with libxml.  I'm not sure
>>> which is better.
>>>
>
>
>> Then let's add a switch for libxslt.
>>
>
> +1 --- the fact that so many buildfarm members only have one of the two
> libraries is pretty suggestive that that's common.  We shouldn't require
> both libraries to build the core xml features, if only because
> contrib/xml2 is expected to go away eventually, no?
>
>
>

I don't think it should go away until we provide for equivalents in
core, at least optionally.

Anyway, here's the patch.

cheers

andrew
Index: configure
===================================================================
RCS file: /cvsroot/pgsql/configure,v
retrieving revision 1.543
diff -c -r1.543 configure
*** configure    13 Apr 2007 18:50:01 -0000    1.543
--- configure    14 Apr 2007 19:23:54 -0000
***************
*** 314,320 ****
  # include <unistd.h>
  #endif"

! ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT
exec_prefixprefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir
libdirincludedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS
configure_argsbuild build_cpu build_vendor build_os host host_cpu host_vendor host_os PORTNAME docdir enable_nls
WANTED_LANGUAGESdefault_port enable_shared enable_rpath enable_debug enable_profiling DTRACE DTRACEFLAGS enable_dtrace
CCCFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP GCC TAS autodepend INCLUDES enable_thread_safety with_tcl
with_perlwith_python with_krb5 krb_srvtab with_pam with_ldap with_bonjour with_openssl XML2_CONFIG with_libxml
with_zlibEGREP ELF_SYS LDFLAGS_SL AWK FLEX FLEXFLAGS LN_S LD with_gnu_ld ld_R_works RANLIB ac_ct_RANLIB TAR STRIP
ac_ct_STRIPSTRIP_STATIC_LIB STRIP_SHARED_LIB YACC YFLAGS PERL perl_archlibexp perl_privlibexp perl_useshrplib
perl_embed_ldflagsPYTHON python_version python_configdir python_includespec python_libdir python_libspec
python_additional_libsHAVE_IPV6 LIBOBJS acx_pthread_config PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS LDAP_LIBS_FE
LDAP_LIBS_BEHAVE_POSIX_SIGNALS MSGFMT MSGMERGE XGETTEXT localedir TCLSH TCL_CONFIG_SH TCL_INCLUDE_SPEC TCL_LIB_FILE
TCL_LIBSTCL_LIB_SPEC TCL_SHARED_BUILD TCL_SHLIB_LD_LIBS NSGMLS JADE have_docbook DOCBOOKSTYLE COLLATEINDEX SGMLSPL
vpath_buildLTLIBOBJS' 
  ac_subst_files=''

  # Initialize some variables set by options.
--- 314,320 ----
  # include <unistd.h>
  #endif"

! ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT
exec_prefixprefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir
libdirincludedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS
configure_argsbuild build_cpu build_vendor build_os host host_cpu host_vendor host_os PORTNAME docdir enable_nls
WANTED_LANGUAGESdefault_port enable_shared enable_rpath enable_debug enable_profiling DTRACE DTRACEFLAGS enable_dtrace
CCCFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP GCC TAS autodepend INCLUDES enable_thread_safety with_tcl
with_perlwith_python with_krb5 krb_srvtab with_pam with_ldap with_bonjour with_openssl XML2_CONFIG with_libxml
with_libxsltwith_zlib EGREP ELF_SYS LDFLAGS_SL AWK FLEX FLEXFLAGS LN_S LD with_gnu_ld ld_R_works RANLIB ac_ct_RANLIB
TARSTRIP ac_ct_STRIP STRIP_STATIC_LIB STRIP_SHARED_LIB YACC YFLAGS PERL perl_archlibexp perl_privlibexp perl_useshrplib
perl_embed_ldflagsPYTHON python_version python_configdir python_includespec python_libdir python_libspec
python_additional_libsHAVE_IPV6 LIBOBJS acx_pthread_config PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS LDAP_LIBS_FE
LDAP_LIBS_BEHAVE_POSIX_SIGNALS MSGFMT MSGMERGE XGETTEXT localedir TCLSH TCL_CONFIG_SH TCL_INCLUDE_SPEC TCL_LIB_FILE
TCL_LIBSTCL_LIB_SPEC TCL_SHARED_BUILD TCL_SHLIB_LD_LIBS NSGMLS JADE have_docbook DOCBOOKSTYLE COLLATEINDEX SGMLSPL
vpath_buildLTLIBOBJS' 
  ac_subst_files=''

  # Initialize some variables set by options.
***************
*** 896,901 ****
--- 896,902 ----
    --without-readline      do not use GNU Readline nor BSD Libedit for editing
    --with-libedit-preferred  prefer BSD Libedit over GNU Readline
    --with-libxml           build with XML support
+   --with-libxslt           build with XSLT support
    --without-zlib          do not use Zlib
    --with-gnu-ld           assume the C compiler uses GNU ld [default=no]

***************
*** 4333,4338 ****
--- 4334,4377 ----


  #
+ # XSLT
+ #
+
+ pgac_args="$pgac_args with_libxslt"
+
+
+ # Check whether --with-libxslt or --without-libxslt was given.
+ if test "${with_libxslt+set}" = set; then
+   withval="$with_libxslt"
+
+   case $withval in
+     yes)
+
+ cat >>confdefs.h <<\_ACEOF
+ #define USE_LIBXSLT 1
+ _ACEOF
+
+       ;;
+     no)
+       :
+       ;;
+     *)
+       { { echo "$as_me:$LINENO: error: no argument expected for --with-libxslt option" >&5
+ echo "$as_me: error: no argument expected for --with-libxslt option" >&2;}
+    { (exit 1); exit 1; }; }
+       ;;
+   esac
+
+ else
+   with_libxslt=no
+
+ fi;
+
+
+
+
+
+ #
  # Zlib
  #

***************
*** 7521,7526 ****
--- 7560,7646 ----

  fi

+ if test "$with_libxslt" = yes ; then
+
+ echo "$as_me:$LINENO: checking for xsltLibxmlVersion in -lxslt" >&5
+ echo $ECHO_N "checking for xsltLibxmlVersion in -lxslt... $ECHO_C" >&6
+ if test "${ac_cv_lib_xslt_xsltLibxmlVersion+set}" = set; then
+   echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lxslt  $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+ /* 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 xsltLibxmlVersion ();
+ int
+ main ()
+ {
+ xsltLibxmlVersion ();
+   ;
+   return 0;
+ }
+ _ACEOF
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+   (eval $ac_link) 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); } &&
+      { ac_try='test -z "$ac_c_werror_flag"
+              || test ! -s conftest.err'
+   { (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); }; } &&
+      { 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_xslt_xsltLibxmlVersion=yes
+ else
+   echo "$as_me: failed program was:" >&5
+ sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_xslt_xsltLibxmlVersion=no
+ fi
+ rm -f conftest.err conftest.$ac_objext \
+       conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+ echo "$as_me:$LINENO: result: $ac_cv_lib_xslt_xsltLibxmlVersion" >&5
+ echo "${ECHO_T}$ac_cv_lib_xslt_xsltLibxmlVersion" >&6
+ if test $ac_cv_lib_xslt_xsltLibxmlVersion = yes; then
+   cat >>confdefs.h <<_ACEOF
+ #define HAVE_LIBXSLT 1
+ _ACEOF
+
+   LIBS="-lxslt $LIBS"
+
+ else
+   { { echo "$as_me:$LINENO: error: library 'xslt' is required for XSLT support" >&5
+ echo "$as_me: error: library 'xslt' is required for XSLT support" >&2;}
+    { (exit 1); exit 1; }; }
+ fi
+
+ fi
+

  ##
  ## Header files
***************
*** 10762,10767 ****
--- 10882,11036 ----

  fi

+ if test "$with_libxslt" = yes ; then
+   if test "${ac_cv_header_libxslt_xslt_h+set}" = set; then
+   echo "$as_me:$LINENO: checking for libxslt/xslt.h" >&5
+ echo $ECHO_N "checking for libxslt/xslt.h... $ECHO_C" >&6
+ if test "${ac_cv_header_libxslt_xslt_h+set}" = set; then
+   echo $ECHO_N "(cached) $ECHO_C" >&6
+ fi
+ echo "$as_me:$LINENO: result: $ac_cv_header_libxslt_xslt_h" >&5
+ echo "${ECHO_T}$ac_cv_header_libxslt_xslt_h" >&6
+ else
+   # Is the header compilable?
+ echo "$as_me:$LINENO: checking libxslt/xslt.h usability" >&5
+ echo $ECHO_N "checking libxslt/xslt.h usability... $ECHO_C" >&6
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+ _ACEOF
+ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h.  */
+ $ac_includes_default
+ #include <libxslt/xslt.h>
+ _ACEOF
+ rm -f conftest.$ac_objext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+   (eval $ac_compile) 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); } &&
+      { ac_try='test -z "$ac_c_werror_flag"
+              || test ! -s conftest.err'
+   { (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); }; } &&
+      { 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.err 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 libxslt/xslt.h presence" >&5
+ echo $ECHO_N "checking libxslt/xslt.h presence... $ECHO_C" >&6
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+ _ACEOF
+ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h.  */
+ #include <libxslt/xslt.h>
+ _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
+     ac_cpp_err=$ac_cpp_err$ac_c_werror_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:$ac_c_preproc_warn_flag in
+   yes:no: )
+     { echo "$as_me:$LINENO: WARNING: libxslt/xslt.h: accepted by the compiler, rejected by the preprocessor!" >&5
+ echo "$as_me: WARNING: libxslt/xslt.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+     { echo "$as_me:$LINENO: WARNING: libxslt/xslt.h: proceeding with the compiler's result" >&5
+ echo "$as_me: WARNING: libxslt/xslt.h: proceeding with the compiler's result" >&2;}
+     ac_header_preproc=yes
+     ;;
+   no:yes:* )
+     { echo "$as_me:$LINENO: WARNING: libxslt/xslt.h: present but cannot be compiled" >&5
+ echo "$as_me: WARNING: libxslt/xslt.h: present but cannot be compiled" >&2;}
+     { echo "$as_me:$LINENO: WARNING: libxslt/xslt.h:     check for missing prerequisite headers?" >&5
+ echo "$as_me: WARNING: libxslt/xslt.h:     check for missing prerequisite headers?" >&2;}
+     { echo "$as_me:$LINENO: WARNING: libxslt/xslt.h: see the Autoconf documentation" >&5
+ echo "$as_me: WARNING: libxslt/xslt.h: see the Autoconf documentation" >&2;}
+     { echo "$as_me:$LINENO: WARNING: libxslt/xslt.h:     section \"Present But Cannot Be Compiled\"" >&5
+ echo "$as_me: WARNING: libxslt/xslt.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+     { echo "$as_me:$LINENO: WARNING: libxslt/xslt.h: proceeding with the preprocessor's result" >&5
+ echo "$as_me: WARNING: libxslt/xslt.h: proceeding with the preprocessor's result" >&2;}
+     { echo "$as_me:$LINENO: WARNING: libxslt/xslt.h: in the future, the compiler will take precedence" >&5
+ echo "$as_me: WARNING: libxslt/xslt.h: in the future, the compiler will take precedence" >&2;}
+     (
+       cat <<\_ASBOX
+ ## ---------------------------------------- ##
+ ## Report this to pgsql-bugs@postgresql.org ##
+ ## ---------------------------------------- ##
+ _ASBOX
+     ) |
+       sed "s/^/$as_me: WARNING:     /" >&2
+     ;;
+ esac
+ echo "$as_me:$LINENO: checking for libxslt/xslt.h" >&5
+ echo $ECHO_N "checking for libxslt/xslt.h... $ECHO_C" >&6
+ if test "${ac_cv_header_libxslt_xslt_h+set}" = set; then
+   echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+   ac_cv_header_libxslt_xslt_h=$ac_header_preproc
+ fi
+ echo "$as_me:$LINENO: result: $ac_cv_header_libxslt_xslt_h" >&5
+ echo "${ECHO_T}$ac_cv_header_libxslt_xslt_h" >&6
+
+ fi
+ if test $ac_cv_header_libxslt_xslt_h = yes; then
+   :
+ else
+   { { echo "$as_me:$LINENO: error: header file <libxslt/xslt.h> is required for XSLT support" >&5
+ echo "$as_me: error: header file <libxslt/xslt.h> is required for XSLT support" >&2;}
+    { (exit 1); exit 1; }; }
+ fi
+
+
+ fi
+
  if test "$with_ldap" = yes ; then
    if test "$PORTNAME" != "win32"; then

***************
*** 24322,24327 ****
--- 24591,24597 ----
  s,@with_openssl@,$with_openssl,;t t
  s,@XML2_CONFIG@,$XML2_CONFIG,;t t
  s,@with_libxml@,$with_libxml,;t t
+ s,@with_libxslt@,$with_libxslt,;t t
  s,@with_zlib@,$with_zlib,;t t
  s,@EGREP@,$EGREP,;t t
  s,@ELF_SYS@,$ELF_SYS,;t t
Index: configure.in
===================================================================
RCS file: /cvsroot/pgsql/configure.in,v
retrieving revision 1.510
diff -c -r1.510 configure.in
*** configure.in    13 Apr 2007 18:50:01 -0000    1.510
--- configure.in    14 Apr 2007 19:23:55 -0000
***************
*** 580,585 ****
--- 580,594 ----
  AC_SUBST(with_libxml)

  #
+ # XSLT
+ #
+ PGAC_ARG_BOOL(with, libxslt, no, [  --with-libxslt           build with XSLT support],
+               [AC_DEFINE([USE_LIBXSLT], 1, [Define to 1 to build with XSLT support. (--with-libxslt)])])
+
+
+ AC_SUBST(with_libxslt)
+
+ #
  # Zlib
  #
  PGAC_ARG_BOOL(with, zlib, yes,
***************
*** 768,773 ****
--- 777,786 ----
    AC_CHECK_LIB(xml2, xmlSaveToBuffer, [], [AC_MSG_ERROR([library 'xml2' (version >= 2.6.23) is required for XML
support])])
  fi

+ if test "$with_libxslt" = yes ; then
+   AC_CHECK_LIB(xslt, xsltLibxmlVersion, [], [AC_MSG_ERROR([library 'xslt' is required for XSLT support])])
+ fi
+

  ##
  ## Header files
***************
*** 847,852 ****
--- 860,869 ----
    AC_CHECK_HEADER(libxml/parser.h, [], [AC_MSG_ERROR([header file <libxml/parser.h> is required for XML support])])
  fi

+ if test "$with_libxslt" = yes ; then
+   AC_CHECK_HEADER(libxslt/xslt.h, [], [AC_MSG_ERROR([header file <libxslt/xslt.h> is required for XSLT support])])
+ fi
+
  if test "$with_ldap" = yes ; then
    if test "$PORTNAME" != "win32"; then
       AC_CHECK_HEADERS(ldap.h, [],
Index: contrib/Makefile
===================================================================
RCS file: /cvsroot/pgsql/contrib/Makefile,v
retrieving revision 1.73
diff -c -r1.73 Makefile
*** contrib/Makefile    14 Apr 2007 12:57:07 -0000    1.73
--- contrib/Makefile    14 Apr 2007 19:23:55 -0000
***************
*** 37,45 ****
  WANTED_DIRS += sslinfo
  endif

  # Missing:
  #        start-scripts    \ (does not have a makefile)
! #        xml2        \ (requires libxml and libxslt installed)

  all install installdirs uninstall distprep clean distclean maintainer-clean:
      @for dir in $(WANTED_DIRS); do \
--- 37,51 ----
  WANTED_DIRS += sslinfo
  endif

+ ifeq ($(with_libxml),yes)
+ ifeq ($(with_libxslt),yes)
+ WANTED_DIRS += xml2
+ endif
+ endif
+
  # Missing:
  #        start-scripts    \ (does not have a makefile)
!

  all install installdirs uninstall distprep clean distclean maintainer-clean:
      @for dir in $(WANTED_DIRS); do \
Index: src/Makefile.global.in
===================================================================
RCS file: /cvsroot/pgsql/src/Makefile.global.in,v
retrieving revision 1.234
diff -c -r1.234 Makefile.global.in
*** src/Makefile.global.in    13 Apr 2007 18:50:01 -0000    1.234
--- src/Makefile.global.in    14 Apr 2007 19:23:57 -0000
***************
*** 153,158 ****
--- 153,159 ----
  with_tcl    = @with_tcl@
  with_openssl    = @with_openssl@
  with_libxml    = @with_libxml@
+ with_libxslt    = @with_libxslt@
  with_zlib    = @with_zlib@
  enable_shared    = @enable_shared@
  enable_rpath    = @enable_rpath@
Index: src/include/pg_config.h.in
===================================================================
RCS file: /cvsroot/pgsql/src/include/pg_config.h.in,v
retrieving revision 1.115
diff -c -r1.115 pg_config.h.in
*** src/include/pg_config.h.in    6 Apr 2007 05:36:50 -0000    1.115
--- src/include/pg_config.h.in    14 Apr 2007 19:23:59 -0000
***************
*** 256,261 ****
--- 256,264 ----
  /* Define to 1 if you have the `xml2' library (-lxml2). */
  #undef HAVE_LIBXML2

+ /* Define to 1 if you have the `xslt' library (-lxslt). */
+ #undef HAVE_LIBXSLT
+
  /* Define to 1 if you have the `z' library (-lz). */
  #undef HAVE_LIBZ


pgsql-patches by date:

Previous
From: Stefan Kaltenbrunner
Date:
Subject: Re: build/install xml2 when configured with libxml
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] choose_bitmap_and again (was Re: [PERFORM] Strangely Variable Query Performance)