GNOME Bugzilla – Bug 471730
Darwin fix for libgnomeprint-2.18.1
Last modified: 2009-04-12 16:26:54 UTC
Patch from tron@NetBSD.org: Fix broken "configure" script: It skips the check for the math library on Darwin because the math functions are included in the system library. It however later aborts because it didn't find a math library. Work arround this by not skipping the math library check on Darwin. The "configure" scripts now finds "/usr/lib/libm.dylib" which is a symlink to the system library.
Created attachment 94603 [details] [review] One possible solution for the problem
aclocal.m4 is a generated file so this has to be patched somewhere else. configure.in maybe?
aclocal.m4 is used together with configure.in to create configure. aclocal.m4 contains cached copies of autoconf macros. So basically, it's an upstream problem for the autoconf macro used to create it, but you can work around it.
It's a bug in gnome-print: configure.in requires that LIBM (as set by AC_CHECK_LIBM) be non-blank, even though that is the appropriate result on some platforms. If gnome-print needs certain math functions, it should just check for them. If it's easier to just load "whatever math lib is appropriate for this platform" (via AC_CHECK_LIBM), then it shouldn't try to second-guess that (AC_CHECK_LIBM already bombs if "the libs appropriate for this platform" aren't present).
Created attachment 98464 [details] [review] Let AC_CHECK_LIBM do the right thing
Hrm, AC_CHECK_LIBM actually might silently do nothing if the needed lib isn't present on a platform that needs it. Looks like the check was added in response to Bug #349182, so after using AC_CHECK_LIBM to get "the local math lib flags", configure.in could AC_CHECK_FUNC for some math function that is known to need -lm (fmod() or cos()?) and then fail if the function is still not available.
*** Bug 396654 has been marked as a duplicate of this bug. ***
I just build libgnomeprint 2.18.4 on Mac OS X Tiger using MacPorts 1.6. Can the original bug reporter retest this?
I asked the original bug reporter to re-test. He's currently using Mac OS 10.5.2 (Leopard) and Xcode Tools 3.0. The problem originally appeared with 10.4.x (Tiger) and Xcode Tools 2.4. The problem is still there. He further comments that the problem is definitely in the configure script, viz.: 1. In line 23750, LIBM is set to "". 2. In lines 23751 and 23752 the test for the existence of libm on Darwin (Mac OS X) is skipped. LIBM stays empty on these platforms. 3. Then there's the test in line 23956: if test "x$LIBM" = "x"; then { { echo "$as_me:$LINENO: error: You need -lm(mathematic library) for this version of libgnomeprint." >&5 echo "$as_me: error: You need -lm(mathematic library) for this version of libgnomeprint." >&2;} { (exit 1); exit 1; }; } fi LIBM is not set because of 1 and 2, so the configure script stops here.
As I said earlier, it's almost never a good idea to second-guess an autodetection of something. It is *not* true that "You need the -lm(mathematic library"...it's just that you need certain math functions. So test for them, rather than assuming how they will be provided.
The cygwin ports maintainer had a patch to drop the test on platforms that doesn't have libm. This has been commited now.