openexr-devel
[Top][All Lists]
Advanced

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

Re: [Openexr-devel] A few fixes before the 1.1.0 release


From: Drew Hess
Subject: Re: [Openexr-devel] A few fixes before the 1.1.0 release
Date: Mon, 2 Feb 2004 13:38:34 -0800 (PST)

That'd work fine for projects which use autoconf, but many don't.  And I'd
hate to make people use autoconf just to get "restrict" to work correctly;
pkg-config is so much simpler.

I think we'll have to do this with a header file in Imath with appropriate
ifdefs in order to make a solution that works for everyone.


-dwh-



On Tue, 3 Feb 2004, Brad Hards wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Tue, 03 Feb 2004 07:48 am, Drew Hess wrote:
> > It's easy to have autoconf detect whether the compiler supports "restrict"
> > or not and choose the appropriate flag when building OpenEXR.
> Indeed - it already does this as I understand.
> 
> > The problem occurs when the developer is using Imath in her own project.
> > We can't put the flag in the pkg-config file because the developer can use
> > a different compiler to compile the app than the compiler used to compile
> > OpenEXR itself.  So that puts on the burden on the developer to use the
> > right flag in order to get Imath to compile, which I don't wanna do.
> Another option might be to distribute a macro that goes into
> $prefix/share/aclocal (or whatever is appropriate) that detects the Right
> Thing To Do, and sets the compiler flags.
> 
> Anyone using autoconf already needs tests - we provide the tests, and include
> the right option for handling the restrict keyword. Here are my tests (which 
> don't
> have handling for restrict, and the variable names could be make more
> regular, but you get the idea:
> AC_DEFUN(AC_FIND_LIBEXR,
> [
> AC_REQUIRE([AC_FIND_ZLIB])
> AC_CACHE_VAL(ac_cv_libexr,
> [
>   if test -z "$PKG_CONFIG"; then
>     AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
>   fi
> 
>   AC_MSG_CHECKING([for OpenEXR libraries])
> 
>   if test "$PKG_CONFIG" = "no" ; then
>      AC_MSG_RESULT(no)
>      echo "*** The pkg-config script could not be found. Make sure it is"
>      echo "*** in your path, or set the PKG_CONFIG environment variable"
>      echo "*** to the full path to pkg-config."
>      echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get 
> pkg-config."
>   else
>      if !(`$PKG_CONFIG --exists OpenEXR`) ; then
>         AC_MSG_RESULT(no)
>         echo "*** pkg-config installed, but no OpenEXR Libraries were found 
> ***"
>         echo "*** Install OpenEXR package (from http:///www.openexr.org)"
>         echo "*** if you want EXR image format support"
>      else
>         if !(`$PKG_CONFIG --atleast-version="1.0.7" OpenEXR`) ; then
>            AC_MSG_RESULT(no)
>            echo "*** OpenEXR libraries were found, but at least version 1.0.7 
> is required ***"
>            echo "*** Install newer OpenEXR package (from 
> http:///www.openexr.org)"
>            echo "*** if you want EXR image format support"
>         else
>            kde_save_LIBS="$LIBS"
>            LIBS="$LIBS $all_libraries $USER_LDFLAGS $LIBZ `pkg-config --libs 
> OpenEXR`"
>            AC_LANG_SAVE
>            AC_LANG_CPLUSPLUS
>            kde_save_CXXFLAGS="$CXXFLAGS"
>            EXR_FLAGS=`$PKG_CONFIG --cflags OpenEXR`
>            CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES $EXR_FLAGS"
> 
>            AC_TRY_LINK(dnl
>                [
>                #include <ImfRgbaFile.h>
>                ],
>                [
>                using namespace Imf;
>                RgbaInputFile file ("dummy");
>                return 0;
>                ],
>                eval "ac_cv_libexr='$LIBZ `pkg-config --libs OpenEXR`'",
>                eval "ac_cv_libexr=no"
>            )
>            LIBS="$kde_save_LIBS"
>            CXXFLAGS="$kde_save_CXXFLAGS"
>            AC_LANG_RESTORE
>            ])dnl
>            if eval "test ! \"`echo $ac_cv_libexr`\" = no"; then
>                AC_DEFINE_UNQUOTED(HAVE_EXR, 1, [Define if you have OpenEXR])
>                LIB_EXR="$ac_cv_libexr"
>                AC_MSG_RESULT($ac_cv_libexr)
>            else
>                AC_MSG_RESULT(no)
>                LIB_EXR=""
>            fi
>         fi
>      fi
>   fi
>   AC_SUBST(LIB_EXR)
>   AC_SUBST(EXR_FLAGS)
> ])
> 
> Then you just call AC_FIND_LIBEXR, and use LIB_EXR in the library
> linker flags, and EXR_FLAGS in the compiler flags.
> 
> [This also needs a AC_FIND_ZLIB - we might think about that too, given
> the bad experiences many projects have had bringing in a broken
> zlib from the XFree86 project]
> 
> Brad
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (GNU/Linux)
> 
> iD8DBQFAHr9kGwwszQ/PZzgRAr2kAJ0axKNup9pufFuC+XJtP/oin0M8JwCgpCit
> suB4KZXkZR3kYEkHkLytj8o=
> =5VK0
> -----END PGP SIGNATURE-----
> 
> 






reply via email to

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