[Gc] autoconf on 6.3/6.4

Kees Cook kees at outflux.net
Fri Jan 28 18:27:38 PST 2005

On Fri, Jan 28, 2005 at 05:33:13PM -0800, Boehm, Hans wrote:
> Look at version.h in the main directory.  It defines GC_VERSION_MINOR.
> By default, it also declares and initializes GC_version.  The
> file is included by exactly one of the GC library files (which is ugly,
> but ...).  Thus you should just be able to link against the library
> and test GC_version.

Cool.  I found it just after mental asked the list.  ;)  For anyone else 
interested, here's our entire autoconf section for dealing with libgc.  
If anyone has ideas for improvement, I'd love to incorporate them.

AC_CHECK_HEADERS([gc.h gc/gc.h],
                    # To test for the different required libs, I have to
                    # overcome autoconf's caching system, so I change the
                    # desired function name.  They're all in libgc.
                    # The "break" will exit from the top level
                    # AC_CHECK_HEADERS.
                    AC_CHECK_LIB(gc, GC_init,
                                  LIBS="-lgc $gc_libs $LIBS";
                                  break], [gc_ok=no], [$gc_libs])
                    AC_CHECK_LIB(gc, GC_malloc,
                                  LIBS="-lgc $gc_libs $LIBS";
                                  break], [gc_ok=no], [$gc_libs])
                    AC_CHECK_LIB(gc, GC_realloc,
                                  LIBS="-lgc $gc_libs $LIBS";
                                  break], [gc_ok=no], [$gc_libs])
                    gc_libs="-lpthread -ldl"
                    AC_CHECK_LIB(gc, GC_free,
                                  LIBS="-lgc $gc_libs $LIBS";
                                  break], [gc_ok=no], [$gc_libs])
if test "x$gc_ok" == "xyes"; then
        AC_MSG_CHECKING([libgc version 6.4+])
                        #ifdef HAVE_GC_GC_H
                        # include <gc/gc.h>
                        # include <gc.h>
                        extern unsigned GC_version;
                        int main(void){
                                unsigned min = ((6 << 16) | (4 << 8) | 0);
                                if (GC_version>=min) return 0;
                                return 1;
if test "x$gc_ok" != "xyes"; then
        AC_MSG_ERROR([libgc (the Boehm Conservative Collector) 6.4+, is needed to compile inkscape])

Kees Cook                                            @outflux.net

More information about the Gc mailing list