help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Autoconf issues


From: Glynn Clements
Subject: Re: Autoconf issues
Date: 01 Jul 2004 02:54:26 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Security Through Obscurity)

Sensei <noone@nowhere.org> writes:

> mike burrell wrote:

> > If libgl is linked against what libraries it needs, then -lgl is all you
> > would need (the linker should pull in everything else for you ---
> > try it!). So, just use AC_CHECK_LIB(gl, whatever).
> 
> 
> Yeah, but the fact is that many different systems have differen
> locations for shared libraries. Slack is not the same as gentoo, osx
> is horribly different (something /Library/FrameWorks/...).
> 
> 
> So how to deal with different paths? When -lGL and company fails
> (AC_CHECK_LIB) I search for the library itself and check for a user
> provided argument: how to deal with suffixes and paths?

1. Define a switch:

        AC_ARG_WITH(opengl-libs,     [  --with-opengl-libs=DIR       OpenGL 
libraries are in DIR])

2. Check whether the switch was used:

        if test -n "$with_opengl_libs" ; then
            OPENGLLIB="-L$with_opengl_libs"
        else
            OPENGLLIB=
        fi
        AC_SUBST(OPENGLLIB)

3. Check for the library using the relevant linking switches:

        ac_save_ldflags="$LDFLAGS"
        LDFLAGS="$LDFLAGS $OPENGLLIB"
        AC_CHECK_LIB(GL,glBegin)
        LDFLAGS=${ac_save_ldflags}

Headers are dealt with using the same mechanism (except that you use
-I and CPPFLAGS instead of -L and LDFLAGS).

Note: you don't deal with suffixes; you just pass "-lGL" to the
linker.

-- 
Glynn Clements <glynn.clements@virgin.net>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]