autoconf
[Top][All Lists]
Advanced

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

Dealing with static libraries cleanly?


From: E. Rosten
Subject: Dealing with static libraries cleanly?
Date: Wed, 8 Mar 2006 14:30:07 +0000 (GMT)

OK, so dynamic libraries are nice since a -lfoo fill automatically link 
againse libbar.so and libfred.so (where necessary--as long as the dynamic 
libraries are done properly). Static libraries don't contain that 
information, so it's not quite so nice. Sadly some systems (the version of 
Solaris/SPARC which I hace access to and which has a half decent compiler) 
have a mixture of static and dynamic libraries (eg libz is available as 
static only).

Anyway, here's my solution so far. It doesn't seem very clean or general 
to me. I don't want a banket test for libz in this case, since I don't 
want it carried around of libtiff fails (and it's unnecessary on many 
systems). Is there a better way of doing this?


#I want jpeg if possible anyway, but do it first, since tiff might need it 
#as well
AC_CHECK_HEADERS(jpeglib.h)
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress)
if test "$ac_cv_header_jpeglib_h" = yes && test 
"$ac_cv_lib_jpeg_jpeg_destroy_decompress" = yes
then
        AC_DEFINE(CVD_IMAGE_HAVE_JPEG, [JPEG,])
        AC_SUBST(have_jpeg,yes)
        options="$options jpeg"
        
fi

AC_CHECK_HEADERS(tiffio.h)
if test "$ac_cv_header_tiffio_h" = yes 
then
        
        AC_CHECK_LIB(tiff, TIFFReadRGBAImageOriented)
        
        if test "$ac_cv_lib_tiff_TIFFReadRGBAImageOriented" = yes
        then
                AC_DEFINE(CVD_IMAGE_HAVE_TIFF, [TIFF,])
                AC_SUBST(have_tiff,yes)
                options="$options tiff"
        else
                AC_MSG_CHECKING([if perhaps libtiff requires zlib])
                AC_MSG_RESULT()
                foo_LIBS="$LIBS"

                AC_CHECK_LIB(z, deflate)
                unset ac_cv_lib_tiff_TIFFReadRGBAImageOriented
                AC_CHECK_LIB(tiff, TIFFReadRGBAImageOriented)

                if test "$ac_cv_lib_tiff_TIFFReadRGBAImageOriented" = yes
                then
                        AC_MSG_CHECKING([if perhaps libtiff requires zlib...])
                        AC_MSG_RESULT(yes)
                        AC_DEFINE(CVD_IMAGE_HAVE_TIFF, [TIFF,])
                        AC_SUBST(have_tiff,yes)
                        options="$options tiff"
                else
                        LIBS="$foo_LIBS"
                fi
        fi
fi



-Ed

-- 
(You can't go wrong with psycho-rats.)       (er258)(@)(eng.cam)(.ac.uk)

/d{def}def/f{/Times findfont s scalefont setfont}d/s{10}d/r{roll}d f 5/m
{moveto}d -1 r 230 350 m 0 1 179{1 index show 88 rotate 4 mul 0 rmoveto}
for /s 15 d f pop 240 420 m 0 1 3 { 4 2 1 r sub -1 r show } for showpage




reply via email to

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