12
12
# PARTICULAR PURPOSE.
18
AC_DEFUN([AM_PATH_OPENEXR],
20
dnl Get the cflags and libraries
22
AC_ARG_WITH(openexr-prefix,[ --with-openexr-prefix=PFX Prefix where libopenexr is installed (optional)], openexr_prefix="$withval", openexr_prefix="/usr")
23
AC_ARG_ENABLE(openexrtest, [ --disable-openexrtest Do not try to compile and run a test Openexr program],, enable_openexrtest=yes)
25
if test "x$openexr_prefix" != "xNONE" ; then
26
openexr_args="$openexr_args --prefix=$openexr_prefix"
27
OPENEXR_INCLUDES="-I$openexr_prefix/include/OpenEXR"
28
OPENEXR_LIBS="-L$openexr_prefix/lib"
29
elif test "$prefix" != ""; then
30
openexr_args="$openexr_args --prefix=$prefix"
31
OPENEXR_INCLUDES="-I$prefix/include/OpenEXR"
32
OPENEXR_LIBS="-L$prefix/lib"
35
OPENEXR_LIBS="$X_LIBS $OPENEXR_LIBS -lIlmImf -lImath -lIex -lHalf -lz"
37
AC_MSG_CHECKING(for OpenEXR)
41
if test "x$enable_openexrtest" = "xyes" ; then
42
ac_save_CXXFLAGS="$CXXFLAGS"
44
CXXFLAGS="$CXXFLAGS $OPENEXR_CXXFLAGS $OPENEXR_INCLUDES"
45
LIBS="$LIBS $OPENEXR_LIBS"
46
rm -f conf.openexrtest
51
#include <ImfRgbaFile.h>
57
Imf::RgbaInputFile exr ("");
62
system("touch conf.openexrtest");
66
],, no_openexr=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
68
CXXFLAGS="$ac_save_CXXFLAGS"
72
if test "x$no_openexr" = "x" ; then
74
ifelse([$1], , :, [$1])
77
if test -f conf.openexrtest ; then
80
echo "*** Could not run OpenEXR test program, checking why..."
81
CXXFLAGS="$CXXFLAGS $OPENEXR_CXXFLAGS $OPENEXR_INCLUDES"
82
LIBS="$LIBS $OPENEXR_LIBS"
87
#include <ImfRgbaFile.h>
88
], [ Imf::RgbaInputFile exr ("");return 0; ],
89
[ echo "*** The test program compiled, but did not run. This usually means"
90
echo "*** that the run-time linker is not finding OpenEXR or finding the wrong"
91
echo "*** version of OpenEXR. If it is not finding OpenEXR, you'll need to set your"
92
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
93
echo "*** to the installed location Also, make sure you have run ldconfig if that"
94
echo "*** is required on your system"
97
CXXFLAGS="$ac_save_CXXFLAGS"
102
ifelse([$2], , :, [$2])
104
AC_SUBST(OPENEXR_INCLUDES)
105
AC_SUBST(OPENEXR_LIBS)
106
rm -f conf.openexrtest
15
dnl Note: to check whether openexr is properly installed, please
16
dnl look at the m4 macro AM_COMPILELINKRUN and it's use to set
17
dnl OPENEXR_CXXFLAGS and OPENEXR_LDFLAGS in the OpenEXR_Viewers package