Re: [mac] --with-system-libxml?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [mac] --with-system-libxml?

stephan.bergmann
[cc'ing dev@porting for general configure questions]

Eric Hoch wrote:

> Am Thu, 24 Jan 2008 11:25:10 +0100 schrieb Stephan Bergmann:
>> Then, there should be no reason to use OOo's private copy of
>> libxml from module libxml2, right?  Then, we should change
>> config_office/configure to make --with-system-libxml at least the
>> default on Mac OS X, and at best (and if possible) remove that
>> switch (and its negation --without-system-libxml) completely for
>> Mac OS X, right?
>
> Yes.
>
> I tried to use --with-system-libxml with OOH680_m4 and I get:
>
> checking for pkg-config... /opt/local/bin/pkg-config
> checking for libxslt ... Package libxslt was not found in the
> pkg-config search path. Perhaps you should add the directory
> containing `libxslt.pc' to the PKG_CONFIG_PATH environment variable
> No package 'libxslt' found
> configure: error: Library requirements (libxslt ) not met; consider
> adjusting the PKG_CONFIG_PATH environment variable if your
> libraries are in a nonstandard prefix so pkg-config can find them.
>
> The thing is I cannot find any libxslt.pc on my Mac.
>
> In addition pkgconfig is needed if I use --with-system-libxml.
>
> This is Mac OS X 10.5.1 on a Mac Intel Mini.

I think this is a deficiency of our config_office/configure.in:1.237.
When using --with-system-libxml or --with-system-libxslt (where the
former also implies the latter, anyway), configure checks for pkg-config
to get suitable values for LIBXML_CFLAGS, LIBXML_LIBS, LIBXSLT_CFLAGS,
LIBXSLT_LIBS.  However, at least on Mac, there appear to always (at
least when Xcode is installed) be /usr/bin/xml2-config and
/usr/bin/xslt-config that could be called instead of pkg-config.  (I
think those two executables are standard parts of the libxml2 and
libxslt packages, but I might be wrong.)

Using the general pkg-config instead of (or before) the specific
xml2|xslt-config has at least two problems:

For one, as Eric observed, it needlessly makes pkg-config a prerequisite
on Mac.

For another, it introduces a subtle problem in combination with building
moz via MacPorts:  moz has as prerequisites gtk2 and libidl, which can
be satisfied by installing those two via MacPorts (which in turn also
installs MacPorts pkg-config, and many others, including libxml2 and
libxslt) and setting PATH to find MacPorts pkg-config in
/opt/local/bin/pkg-config when building OOo.  Now, as MacPorts comes
with its own versions of libxml2 and libxslt, even though the system
already has (different versions of) them, pkg-config will use the
MacPorts versions, so that the resulting OOo installation set will link
against the libraries from /opt/local/lib, and not work properly when
copied to a machine that does not have those MacPorts packages installed.

Both problems can be worked around by changing configure to use
xml2|xslt-config instead of pkg-config (or resorting to the latter if
the former is not available or does not work).  I used a crude patch to
verify this (see below), but I would be happy if somebody with deeper
knowledge of autoconf (Rene?) turned this into a clean patch.

-Stephan


Index: config_office/configure
===================================================================
RCS file: /cvs/tools/config_office/configure,v
retrieving revision 1.211
diff -U 8 -p -r1.211 configure
--- config_office/configure 13 Dec 2007 12:48:20 -0000 1.211
+++ config_office/configure 27 Jan 2008 20:56:44 -0000
@@ -13758,16 +13758,23 @@ if test -n "$with_system_libxslt" -o -n
     test "$with_system_libxslt" != "no"; then
     { echo "$as_me:$LINENO: result: external" >&5
  echo "${ECHO_T}external" >&6; }
     SYSTEM_LIBXSLT=YES


    succeeded=no

+#TODO:
+if test "$_os" = "Darwin"; then
+  LIBXSLT_CFLAGS=`/usr/bin/xslt-config --cflags`
+  LIBXSLT_LIBS=`/usr/bin/xslt-config --libs`
+  succeeded=yes
+else
+#:TODO
    if test -z "$PKG_CONFIG"; then
      # Extract the first word of "pkg-config", so it can be a program
name with args.
  set dummy pkg-config; ac_word=$2
  { echo "$as_me:$LINENO: checking for $ac_word" >&5
  echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
  if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
    echo $ECHO_N "(cached) $ECHO_C" >&6
  else
@@ -13845,16 +13852,19 @@ echo "${ECHO_T}$LIBXSLT_LIBS" >&6; }



       else
          echo "*** Your version of pkg-config is too old. You need
version $PKG_CONFIG_MIN_VERSION or newer."
          echo "*** See http://www.freedesktop.org/software/pkgconfig"
       fi
    fi
+#TODO:
+fi
+#:TODO

    if test $succeeded = yes; then
       :
    else
       { { echo "$as_me:$LINENO: error: Library requirements (libxslt )
not met; consider adjusting the PKG_CONFIG_PATH environment variable if
your libraries are in a nonstandard prefix so pkg-config can find them." >&5
  echo "$as_me: error: Library requirements (libxslt ) not met; consider
adjusting the PKG_CONFIG_PATH environment variable if your libraries are
in a nonstandard prefix so pkg-config can find them." >&2;}
     { (exit 1); exit 1; }; }
    fi
@@ -13922,16 +13932,23 @@ echo $ECHO_N "checking which libxml to u
  if test -n "$with_system_libxml" -o -n "$with_system_libs" && \
  test "$with_system_libxml" != "no"; then
      { echo "$as_me:$LINENO: result: external" >&5
  echo "${ECHO_T}external" >&6; }
      SYSTEM_LIBXML=YES

    succeeded=no

+#TODO:
+if test "$_os" = "Darwin"; then
+  LIBXML_CFLAGS=`/usr/bin/xml2-config --cflags`
+  LIBXML_LIBS=`/usr/bin/xml2-config --libs`
+  succeeded=yes
+else
+#:TODO
    if test -z "$PKG_CONFIG"; then
      # Extract the first word of "pkg-config", so it can be a program
name with args.
  set dummy pkg-config; ac_word=$2
  { echo "$as_me:$LINENO: checking for $ac_word" >&5
  echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
  if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
    echo $ECHO_N "(cached) $ECHO_C" >&6
  else
@@ -14009,16 +14026,19 @@ echo "${ECHO_T}$LIBXML_LIBS" >&6; }



       else
          echo "*** Your version of pkg-config is too old. You need
version $PKG_CONFIG_MIN_VERSION or newer."
          echo "*** See http://www.freedesktop.org/software/pkgconfig"
       fi
    fi
+#TODO:
+fi
+#:TODO

    if test $succeeded = yes; then
       :
    else
       { { echo "$as_me:$LINENO: error: Library requirements (libxml-2.0
 >= 2.0 ) not met; consider adjusting the PKG_CONFIG_PATH environment
variable if your libraries are in a nonstandard prefix so pkg-config can
find them." >&5
  echo "$as_me: error: Library requirements (libxml-2.0 >= 2.0 ) not
met; consider adjusting the PKG_CONFIG_PATH environment variable if your
libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
     { (exit 1); exit 1; }; }
    fi


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Re: [mac] --with-system-libxml?

Rene Engelhard-7
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[ No need to CC me personally, I read dev@porting ]

Stephan Bergmann wrote:
> former also implies the latter, anyway), configure checks for pkg-config  
> to get suitable values for LIBXML_CFLAGS, LIBXML_LIBS, LIBXSLT_CFLAGS,  
> LIBXSLT_LIBS.  However, at least on Mac, there appear to always (at  
> least when Xcode is installed) be /usr/bin/xml2-config and  
> /usr/bin/xslt-config that could be called instead of pkg-config.  (I  
> think those two executables are standard parts of the libxml2 and  
> libxslt packages, but I might be wrong.)

Yeah, the question is: how long? Everything nowadays is done by
pkg-config..

> Using the general pkg-config instead of (or before) the specific  
> xml2|xslt-config has at least two problems:
>
> For one, as Eric observed, it needlessly makes pkg-config a prerequisite  
> on Mac.

Not that argument again, plese...

> the former is not available or does not work).  I used a crude patch to  
> verify this (see below), but I would be happy if somebody with deeper  
> knowledge of autoconf (Rene?) turned this into a clean patch.

Please don't patch a generated file. Patch configure.in. (and run
autoconf)

Regards,

Rene
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD4DBQFHnb63+FmQsCSK63MRAvjJAJjOYuuYfy37wS/ImlhV6s8m8uIJAKCEO5KC
08RePLnVG7ZKf2sHLlgXew==
=8iWD
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Re: [mac] --with-system-libxml?

stephan.bergmann
In reply to this post by stephan.bergmann
Rene Engelhard wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> [ No need to CC me personally, I read dev@porting ]
>
> Stephan Bergmann wrote:
>> former also implies the latter, anyway), configure checks for pkg-config  
>> to get suitable values for LIBXML_CFLAGS, LIBXML_LIBS, LIBXSLT_CFLAGS,  
>> LIBXSLT_LIBS.  However, at least on Mac, there appear to always (at  
>> least when Xcode is installed) be /usr/bin/xml2-config and  
>> /usr/bin/xslt-config that could be called instead of pkg-config.  (I  
>> think those two executables are standard parts of the libxml2 and  
>> libxslt packages, but I might be wrong.)
>
> Yeah, the question is: how long? Everything nowadays is done by
> pkg-config..

Well, obviously at least not on Mac OS X (which includes everything
needed to program against libxml and libxslt, but not pkg-config).

>> Using the general pkg-config instead of (or before) the specific  
>> xml2|xslt-config has at least two problems:
>>
>> For one, as Eric observed, it needlessly makes pkg-config a prerequisite  
>> on Mac.
>
> Not that argument again, plese...

???  I must have missed the relevant thread.

>> the former is not available or does not work).  I used a crude patch to  
>> verify this (see below), but I would be happy if somebody with deeper  
>> knowledge of autoconf (Rene?) turned this into a clean patch.
>
> Please don't patch a generated file. Patch configure.in. (and run
> autoconf)

Sure.  I just wanted to get feedback on the chosen approach (and ideally
somebody willing to turn my crude patch into a good one).

-Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Re: [mac] --with-system-libxml?

Rene Engelhard-7
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Stephan Bergmann wrote:
>> Yeah, the question is: how long? Everything nowadays is done by
>> pkg-config..
>
> Well, obviously at least not on Mac OS X (which includes everything  
> needed to program against libxml and libxslt, but not pkg-config).

But the .pc files. It IMHO is a bug in apples stuff that they don't ship
pkg-config...

>>> Using the general pkg-config instead of (or before) the specific  
>>> xml2|xslt-config has at least two problems:
>>>
>>> For one, as Eric observed, it needlessly makes pkg-config a
>>> prerequisite  on Mac.
>>
>> Not that argument again, plese...
>
> ???  I must have missed the relevant thread.

We had it (mostly on IRC) in the openssl case..

>>> the former is not available or does not work).  I used a crude patch
>>> to  verify this (see below), but I would be happy if somebody with
>>> deeper  knowledge of autoconf (Rene?) turned this into a clean patch.
>>
>> Please don't patch a generated file. Patch configure.in. (and run
>> autoconf)
>
> Sure.  I just wanted to get feedback on the chosen approach (and ideally  
> somebody willing to turn my crude patch into a good one).

For that, I want to look at a configure.in patch, not at a configure one
:)

Regards,

Rene
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHndWg+FmQsCSK63MRAnpQAJ9e8GtomFUC+e6Za6OIUyHATpeBFgCbBY2K
IPIMJuf7IY2wpY5R5wX7cyI=
=oDFm
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Re: [mac] --with-system-libxml?

stephan.bergmann
In reply to this post by stephan.bergmann
Rene Engelhard wrote:
>>> Yeah, the question is: how long? Everything nowadays is done by
>>> pkg-config..
>> Well, obviously at least not on Mac OS X (which includes everything  
>> needed to program against libxml and libxslt, but not pkg-config).
>
> But the .pc files. It IMHO is a bug in apples stuff that they don't ship
> pkg-config...

Yep, you are right.  (However, this little discrepancy nicely helps with
my problem of keeping MacPorts-based pkg-config for building moz (which
would drag behing non-standard pkg-config information for libxml/xslt)
and Mac-standard libxml/xslt from conflicting.)

>>>> the former is not available or does not work).  I used a crude patch
>>>> to  verify this (see below), but I would be happy if somebody with
>>>> deeper  knowledge of autoconf (Rene?) turned this into a clean patch.
>>> Please don't patch a generated file. Patch configure.in. (and run
>>> autoconf)
>> Sure.  I just wanted to get feedback on the chosen approach (and ideally  
>> somebody willing to turn my crude patch into a good one).
>
> For that, I want to look at a configure.in patch, not at a configure one
> :)

Finally managed to sit down and give autoconf a try.  I came up with the
below solution (aka hack).  Let me know what you think about it.

-Stephan

---8<---
Index: acinclude.m4
===================================================================
RCS file: /cvs/tools/config_office/acinclude.m4,v
retrieving revision 1.2
diff -u -p -r1.2 acinclude.m4
--- acinclude.m4 19 Jul 2006 09:39:28 -0000 1.2
+++ acinclude.m4 31 Jan 2008 21:22:23 -0000
@@ -118,3 +118,21 @@ esac
  AC_LANG_POP(C)

  ]) dnl end AC_DEFUN
+
+dnl PKG_CHECK_MODULES_MACHACK is like PKG_CHECK_MODULES but sneaks in
an extra
+dnl argument between the first and second, denoting a program to call
instead of
+dnl pkg-config on Mac OS X (aka Darwin):
+AC_DEFUN([PKG_CHECK_MODULES_MACHACK],
+[if test "$_os" = "Darwin"; then
+   AC_MSG_CHECKING($1_CFLAGS)
+   $1_CFLAGS=`$2 --cflags`
+   AC_MSG_RESULT($$1_CFLAGS)
+   AC_MSG_CHECKING($1_LIBS)
+   $1_LIBS=`$2 --libs`
+   AC_MSG_RESULT($$1_LIBS)
+   AC_SUBST($1_CFLAGS)
+   AC_SUBST($1_LIBS)
+ else
+   PKG_CHECK_MODULES($1, $3, $4, $5, $6)
+ fi
+])
Index: configure.in
===================================================================
RCS file: /cvs/tools/config_office/configure.in,v
retrieving revision 1.237
diff -u -p -r1.237 configure.in
--- configure.in 12 Dec 2007 15:36:54 -0000 1.237
+++ configure.in 31 Jan 2008 21:22:32 -0000
@@ -3241,7 +3241,7 @@ if test -n "$with_system_libxslt" -o -n
     AC_MSG_RESULT([external])
     SYSTEM_LIBXSLT=YES

-   PKG_CHECK_MODULES( LIBXSLT, libxslt )
+   PKG_CHECK_MODULES_MACHACK(LIBXSLT, xslt-config, libxslt)

     dnl Check for xsltproc
     AC_PATH_PROG(XSLTPROC, xsltproc, no)
@@ -3266,7 +3266,7 @@ if test -n "$with_system_libxml" -o -n "
  test "$with_system_libxml" != "no"; then
      AC_MSG_RESULT([external])
      SYSTEM_LIBXML=YES
-    PKG_CHECK_MODULES( LIBXML, libxml-2.0 >= 2.0 )
+    PKG_CHECK_MODULES_MACHACK(LIBXML, xml2-config, libxml-2.0 >= 2.0)
      BUILD_TYPE="$BUILD_TYPE LIBXMLSEC"
  else
      AC_MSG_RESULT([internal])
---8<---

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]