----- Original Message ----- > Hi, > > * Magnus Ihse Bursie <magnus.ihse.bur...@oracle.com> [2014-02-12 17:49]: > > > > On 2014-02-12 18:47, Andrew Hughes wrote: > > >>To be extremely clear: Andrew, do you object to bringing Omairs patch, > > >>as it is, into OpenJDK? > > >> > > >Yes. > > > > Okay then. > > > > I'll put a mental note to revisit libpng when cleaning up > > libraries.m4. > > Assuming that I have the cycles to clean up some stuff, what's the > minimal I could get away with (to enable system libpng support)? > > > Are we in agreement that it should to the following: > > --with-libpng=bundled | system | <some path> > > and if "system" is selected, it should first check with pkg-config, > > and only if that fails, try hard-coded values. In any case it should > > try to compile a short code to see that it works properly. (This is > > not needed for bundled; that is assumed to be working). > > Would it be sufficient if I updated the patch to use PGK_CHECK_MODULES > and simply fail if that doesn't work? I will be happy to implement > something more complex if you can sketch it out. > > Thanks, > Omair > > -- > PGP Key: 66484681 (http://pgp.mit.edu/) > Fingerprint = F072 555B 0A17 3957 4E95 0056 F286 F14F 6648 4681 >
As I said in the previous e-mail, the minimum I'd be happy with is if the current patch was updated so settings weren't being hardcoded into the makefiles. Passing them from configure would be sufficient for now, then it can be replaced by PKG_CONFIG. That said, adding PKG_CONFIG is trivial. This is what the IcedTea forest has had in its jdk_generic_profile script since 2011: # Export variables for system libpng # PNG_CFLAGS and PNG_LIBS tell the compiler how to compile and # link against libpng if [ -x "${pkgconfig}" ] ; then if [ "${PNG_CFLAGS}" = "" ] ; then PNG_CFLAGS=$("${pkgconfig}" --cflags libpng) fi if [ "${PNG_LIBS}" = "" ] ; then PNG_LIBS=$("${pkgconfig}" --libs libpng) fi fi if [ "${PNG_LIBS}" = "" ] ; then PNG_LIBS="-lpng" fi export PNG_CFLAGS export PNG_LIBS In autoconf, obviously, you can use the preferable macro instead by the idea is the same. I don't see why this needs so much discussion. If pkg-config fails, there are three options of what to do: 1. Error out. This is my preference & what IcedTea does. PKG_CHECK_MODULES(PNG, libpng,[LIBPNG_FOUND=yes],[LIBPNG_FOUND=no]) if test "x${LIBPNG_FOUND}" = xno then AC_MSG_ERROR([Could not find libpng; install libpng or build with --disable-system-png to use the in-tree copy.]) fi AC_SUBST(PNG_CFLAGS) AC_SUBST(PNG_LIBS) 2. Use a hardcoded value as the IcedTea forest does. 3. Output a message and drop back to bundled automatically. This isn't the default like in IcedTea, which makes me even more strongly in favour of option 1. If someone has explicitly enabled the system libpng option, silently carrying on and using the bundled one is kind of evil. -- Andrew :) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) PGP Key: 248BDC07 (https://keys.indymedia.org/) Fingerprint = EC5A 1F5E C0AD 1D15 8F1F 8F91 3B96 A578 248B DC07