Recommended method for checking libesmtp installation in configure scripts.

Pawel Salek <[email protected]> Tue, 11 Jun 2002 09:41:20 +0200
Newsgroups gmane.comp.lib.libesmtp
Message-ID <[email protected]>
Hi,

I wonder what is the best way to check in a configure script for 
libesmtp? At the moment, something like this is used:


-------------- cut here -------------------------
AC_ARG_WITH(esmtp, [  --with-esmtp=DIR        Enable libESMTP 
[default=yes]],[
         with_esmtp=$withval
],[
         with_esmtp=yes
])

AC_MSG_CHECKING([whether to build ESMTP support])
if test "x$with_esmtp" != xno  ; then
     AC_MSG_RESULT([yes])
     test "$with_esmtp" != yes && LIBS="$LIBS -L$with_esmtp/lib"
     AC_CHECK_LIB(esmtp, smtp_start_session, LIBS="$LIBS -lesmtp 
-lpthread",
         AC_MSG_ERROR([*** You enabled ESMTP but esmtp library is not 
found.]))
     AC_CHECK_LIB(esmtp, smtp_option_require_all_recipients, 
AC_DEFINE(ENABLE_ESMTP),
         AC_MSG_ERROR([*** You enabled ESMTP but esmtp library doesn't 
support
             'require_all_recipients'. Please get a Balsa aware
             libESMTP from http://balsa.gnome.org/main.html or compile
             libESMTP with './configure 
--enable-require-all-recipients'.]))
     AC_CHECK_LIB(esmtp, smtp_starttls_set_password_cb,
         AC_DEFINE(HAVE_SMTP_TLS_CLIENT_CERTIFICATE))
     AC_CHECK_HEADER(libesmtp.h, ,
                 AC_MSG_ERROR([*** You enabled ESMTP but libestmp.h 
header
             is not found. Either it is installed in a not standard 
location
             or you are missing a libesmtp-devel package (or 
corresponding).]))
else
     AC_MSG_RESULT([no])
fi
--------- cut here ---------------

I guess that it might be better to use libesmtp-config script instead 
but if there are a trap, I would appreciate a warning.

Can anybody post some examples?

-Pawel
-- 
Pawel Salek (pawsa(at)theochem.kth.se)
http://www.theochem.kth.se/~pawsa/
Theoretical Chemistry Division, KTH