GNOME Bugzilla – Bug 348203
obsolete macros and new tests in configure.in
Last modified: 2007-03-12 13:39:48 UTC
The macro AC_TRY_LINK is considered obsolete in the Autoconf info manual. Moreover, new tests are needed to a magnifier that will implement full screen magnification, since the use o Composite, Overlay window and ShapeInput are importants to achieve a good user interaction.
Created attachment 69300 [details] [review] This patch replaces the obsolete macros and add the new test needed for full screen magnification
Created attachment 69338 [details] [review] This patch corrects the old tests and add a new one to check for Xrender
Created attachment 69354 [details] [review] Add the AC_SUBST of X_FLAGS to the other patchs
Created attachment 69538 [details] [review] The patch above corrected to only patch what is needed.
Comment on attachment 69538 [details] [review] The patch above corrected to only patch what is needed. >Index: configure.in >=================================================================== >RCS file: /cvs/gnome/gnome-mag/configure.in,v >retrieving revision 1.113 >diff -u -p -r1.113 configure.in >--- configure.in 24 Jul 2006 23:12:37 -0000 1.113 >+++ configure.in 24 Jul 2006 23:46:25 -0000 >@@ -118,7 +118,7 @@ if test "x$XDAMAGE_LIBS" = x; then > *solaris*) XDAMAGE_RPATH_FLAGS="-R$xdamagepath" ;; > esac > AC_MSG_CHECKING(for -lXdamage in $xdamagepath) >- AC_TRY_LINK([], [XDamageCreate()], [ Why did you change AC_TRY_LINK to AC_CHECK_FUNC here? Shouldn't it be AC_LINK_IFELSE ? >+ AC_CHECK_FUNC(XDamageCreate, [ > AC_MSG_RESULT(yes) > XDAMAGE_LIBS="$XDAMAGE_RPATH_FLAGS -L$xdamagepath -lXdamage" > LIBS="$save_LIBS" >@@ -154,7 +154,7 @@ if test "x$XFIXES_LIBS" = x; then > *solaris*) XFIXES_RPATH_FLAGS="-R$xfixespath" ;; > esac > AC_MSG_CHECKING(for -lXfixes in $xfixespath) >- AC_TRY_LINK([], [XFixesCreateRegion()], [ >+ AC_CHECK_FUNC(XFixesCreateRegion, [ Same question here. > AC_MSG_RESULT(yes) > XFIXES_LIBS="$XFIXES_RPATH_FLAGS -L$xfixespath -lXfixes" > LIBS="$save_LIBS" >@@ -174,6 +174,136 @@ else > AC_DEFINE(HAVE_XFIXES, 1, [The XFIXES extension is present]) > fi > >+dnl path to XRENDER >+AC_CHECK_LIB(Xrender, XRenderCreatePicture, XRENDER_LIBS=-lXrender) >+if test "x$XRENDER_LIBS" = x; then >+ save_LIBS="$LIBS" >+ for xrenderpath in $x_libraries; do >+ LIBS="-L$xrenderpath -lXrender -lX11" >+ case "$host" in >+ *solaris*) XRENDER_RPATH_FLAGS="-R$xrenderpath" ;; >+ esac >+ AC_MSG_CHECKING(for -lXrender in $xrenderpath) >+ AC_CHECK_FUNC(XRenderCreatePicture, [ >+ AC_MSG_RESULT(yes) >+ XRENDER_LIBS="$XRENDER_RPATH_FLAGS -L$xrenderpath -lXrender" >+ LIBS="$save_LIBS" >+ break],[AC_MSG_RESULT(no)]) >+ done >+ if test "x$XRENDER_LIBS" = x; then >+ AC_MSG_WARN(Couldn't find the XRENDER library. Check config.log for details) >+ LIBS="$save_LIBS" >+ else >+ X_LIBS="$X_LIBS $XRENDER_LIBS" >+ AC_CHECK_HEADER(X11/extensions/Xrender.h, have_xrender=yes) >+ AC_DEFINE(HAVE_RENDER, 1, [The XRENDER extension is present]) >+ fi >+else >+ X_LIBS="$X_LIBS $XRENDER_LIBS" >+ AC_CHECK_HEADER(X11/extensions/Xrender.h, have_xrender=yes) >+ AC_DEFINE(HAVE_RENDER, 1, [The XRENDER extension is present]) >+fi >+ >+dnl path to XCOMPOSITE >+AC_CHECK_LIB(Xcomposite, XCompositeQueryExtension, XCOMPOSITE_LIBS=-lXcomposite) >+if test "x$XCOMPOSITE_LIBS" = x; then >+ save_LIBS="$LIBS" >+ for xcompositepath in $x_libraries; do >+ LIBS="-L$xcompositepath -lXcomposite -lX11" >+ case "$host" in >+ *solaris*) XCOMPOSITE_RPATH_FLAGS="-R$xcompositepath" ;; >+ esac >+ AC_MSG_CHECKING(for -lXcomposite in $xcompositepath) >+ AC_CHECK_FUNC(XCompositeQueryExtension, [ >+ AC_MSG_RESULT(yes) >+ XCOMPOSITE_LIBS="$XCOMPOSITE_RPATH_FLAGS -L$xcompositepath -lXcomposite" >+ LIBS="$save_LIBS" >+ break],[AC_MSG_RESULT(no)]) >+ done >+ if test "x$XCOMPOSITE_LIBS" = x; then >+ AC_MSG_WARN(Couldn't find the XCOMPOSITE library. Check config.log for details) >+ LIBS="$save_LIBS" >+ else >+ save_LIBS="$LIBS" >+ X_LIBS="$X_LIBS $XCOMPOSITE_LIBS" >+ LIBS="$X_LIBS" >+ AC_CHECK_HEADER(X11/extensions/Xcomposite.h, have_xcomposite=yes) >+ AC_DEFINE(HAVE_COMPOSITE, 1, [The XCOMPOSITE extension is present]) >+ AC_CHECK_FUNC(XCompositeGetOverlayWindow, [ >+ AC_DEFINE(HAVE_OVERLAY, 1, [The Composite extension has Overlay window])]) >+ LIBS="$save_LIBS" >+ fi >+else >+ save_LIBS="$LIBS" >+ X_LIBS="$X_LIBS $XCOMPOSITE_LIBS" >+ LIBS="$X_LIBS" >+ AC_CHECK_HEADER(X11/extensions/Xcomposite.h, have_xcomposite=yes) >+ AC_DEFINE(HAVE_COMPOSITE, 1, [The XCOMPOSITE extension is present]) >+ AC_CHECK_FUNC(XCompositeGetOverlayWindow, [ >+ AC_DEFINE(HAVE_OVERLAY, 1, [The Composite extension has Overlay window])]) >+ LIBS="$save_LIBS" >+fi >+ >+dnl path to XEXT >+AC_CHECK_LIB(Xext, XShapeCombineRectangles, XEXT_LIBS=-lXext) >+if test "x$XEXT_LIBS" = x; then >+ save_LIBS="$LIBS" >+ for xextpath in $x_libraries; do >+ LIBS="-L$xextpath -lXext -lX11" >+ case "$host" in >+ *solaris*) XEXT_RPATH_FLAGS="-R$xextpath" ;; >+ esac >+ AC_MSG_CHECKING(for -lXext in $xextpath) >+ AC_CHECK_FUNC(XShapeCombineRectangles, [ >+ AC_MSG_RESULT(yes) >+ XEXT_LIBS="$XEXT_RPATH_FLAGS -L$xextpath -lXext" >+ LIBS="$save_LIBS" >+ break],[AC_MSG_RESULT(no)]) >+ done >+ if test "x$XEXT_LIBS" = x; then >+ AC_MSG_WARN(Couldn't find the XShape function in Xext library. Check config.log for details) >+ LIBS="$save_LIBS" >+ else >+ save_LIBS="$LIBS" >+ save_CFLAGS="$CFLAGS" >+ X_LIBS="$X_LIBS $XEXT_LIBS" >+ LIBS="$X_LIBS" >+ CFLAGS="-I$x_includes $CFLAGS" >+ AC_CHECK_HEADER(X11/extensions/shape.h, have_xshape=yes) >+ AC_DEFINE(HAVE_XSHAPE, 1, [The XShape extension is present]) >+ if test "x$have_xshape" = x; then >+ AC_MSG_WARN(Couldn't find XShape shape.h header. Check config.log for details) >+ else >+ AC_CHECK_DECL(ShapeInput, [ >+ AC_DEFINE(HAVE_SHAPEINPUT, 1, [ >+ The Shape extension have ShapeInput])], >+ [], [#include <X11/extensions/shape.h>]) >+ fi >+ LIBS="$save_LIBS" >+ CFLAGS="$save_CFLAGS" >+ fi >+else >+ save_LIBS="$LIBS" >+ save_CFLAGS="$CFLAGS" >+ X_LIBS="$X_LIBS $XEXT_LIBS" >+ LIBS="$X_LIBS" >+ CFLAGS="-I$x_includes $CFLAGS" >+ AC_CHECK_HEADER(X11/extensions/shape.h, have_xshape=yes) >+ AC_DEFINE(HAVE_XSHAPE, 1, [The XShape extension is present]) >+ if test "x$have_xshape" = x; then >+ AC_MSG_WARN(Couldn't find XShape shape.h header. Check config.log for details) >+ else >+ AC_CHECK_DECL(ShapeInput, [ >+ AC_DEFINE(HAVE_SHAPEINPUT, 1, [ >+ The Shape extension have ShapeInput])], >+ [], [#include <X11/extensions/shape.h>]) >+ fi >+ LIBS="$save_LIBS" >+ CFLAGS="$save_CFLAGS" >+fi >+ >+X_FLAGS="-I$x_includes" >+AC_SUBST(X_FLAGS) > AC_SUBST(X_LIBS) > > PKG_CHECK_MODULES(LIBDEPS, [
Thanks for point this Bill. When I was reading autoconf documentation I realize that AC_CHECK_FUNC could be a good choose, but reading it again it does no appear the more appropriate macro for this. I believe that a better choice then AC_LINK_IFELSE is AC_CHECK_LIB. What do you think?
I read today (somewhere) that AC_LINK is 'better' than AC_CHECK_LIB because it checks to make sure that a program using the function can actually be linked. We are already using AC_CHECK_LIB in the outer 'if' - perhaps it would still be enough to use AC_CHECK_LIB when searching the other library paths. But I am not an autotools expert!
I think that what you read is false, because of this information that can be found in the autoconf info page about the AC_CHECK_LIB macro: "... try to ensure that the C, C++, or Fortran function FUNCTION is available by checking whether a test program can be *linked* with the library LIBRARY to get the function. ..." I think that you are right, it would be enough to use AC_CHECK_LIB to the other paths. I will try it and put here the patch if it works.
Bill, I create a new patch for it using AC_CHECK_LIB. I think that a positive point to AC_CHECK_LIB is that the FUNCTION is linked with the specified LIBRARY, because this guarantees that the function we want is in the rigth library.
Created attachment 69762 [details] [review] This replaces AC_TRY_LINK with AC_CHECK_LIB and add the new tests
Created attachment 84360 [details] [review] replace the obsolete macro AC_TRY_LINK with AC_CHECK_LIB
This problem has been fixed in our software repository. The fix will go into the next software release. Thank you for your bug report. This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.