diff --git configure.ac configure.ac index 254ee9f..032c46e 100644 --- configure.ac +++ configure.ac @@ -955,171 +955,145 @@ dnl needed by Camel (SSL and S/MIME). dnl dnl The Evolution security extensions are only built if these libraries are found dnl ******************************************************************************** + +dnl these 2 enable's are inverses of each other msg_ssl="no" msg_smime="no" -dnl these 2 enable's are inverses of each other +dnl Use the neutral nspr/nss-config tools +check_config="no" -AC_ARG_ENABLE([nss], - AS_HELP_STRING([--enable-nss=@<:@yes/no/static@:>@], - [Attempt to use Mozilla libnss for SSL support.]), - [enable_nss=$enableval],[enable_nss=yes]) +AC_ARG_ENABLE([ssl], + AS_HELP_STRING([--enable-ssl], + [Attempt to use Mozilla libnss & libnspr (for SSL support).]), + [enable_ssl=$enableval],[enable_ssl=yes]) AC_ARG_ENABLE([smime], AS_HELP_STRING([--enable-smime], - [Attempt to use Mozilla libnss for SMIME support (this requires --enable-nss)]), + [Attempt to use Mozilla libnss & libnspr for SMIME support (this requires --enable-ssl)]), [enable_smime=$enableval],[enable_smime=yes]) -AC_ARG_WITH([nspr-includes], - AS_HELP_STRING([--with-nspr-includes=PATH], - [Location of Mozilla nspr4 includes.])) - -AC_ARG_WITH([nspr-libs], - AS_HELP_STRING([--with-nspr-libs=PATH], - [Location of Mozilla nspr4 libs.])) +dnl .pc files are not included in the official sources - but they make it a lot easier. +dnl this is the reason it comes before the "official" check with nss/nspr-config -AC_ARG_WITH([nss-includes], - AS_HELP_STRING([--with-nss-includes=PATH], - [Location of Mozilla nss3 includes.])) - -AC_ARG_WITH([nss-libs], - AS_HELP_STRING([--with-nss-libs=PATH], - [Location of Mozilla nss3 libs.])) + AC_MSG_CHECKING([Mozilla NSPR pkg-config module name]) + mozilla_nspr_pcs="nspr mozilla-nspr firefox-nspr xulrunner-nspr seamonkey-nspr" + for pc in $mozilla_nspr_pcs; do + if $PKG_CONFIG --exists $pc; then + AC_MSG_RESULT([$pc]) + mozilla_nspr=$pc + break; + fi + done + + AC_MSG_CHECKING([Mozilla NSS pkg-config module name]) + mozilla_nss_pcs="nss mozilla-nss firefox-nss xulrunner-nss seamonkey-nss" + for pc in $mozilla_nss_pcs; do + if $PKG_CONFIG --exists $pc; then + AC_MSG_RESULT([$pc]) + mozilla_nss=$pc + break; + fi + done -if test "x${enable_nss}" = "xyes" || test "x${enable_nss}" = "xstatic"; then - if test -n "${with_nspr_includes}" || test -n "${with_nspr_libs}" || test -n "${with_nss_includes}" || test -n "${with_nss_libs}" || test "x${enable_nss}" = "xstatic"; then - check_manually="yes" + if test -n "${mozilla_nspr}" -a -n "${mozilla_nss}"; then + if test "x${enable_ssl}" = "xyes"; then + msg_ssl="yes (Mozilla NSS)" + if test "x$enable_smime" = "xyes"; then + AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled]) + msg_smime="yes (Mozilla NSS)" + fi + fi + AC_DEFINE(HAVE_SSL,1,[Define if you have a supported SSL library]) + NSPR_CFLAGS=`pkg-config --cflags ${mozilla_nspr}` + NSPR_LIBS=`pkg-config --libs ${mozilla_nspr}` + NSS_CFLAGS=`pkg-config --cflags ${mozilla_nss}` + NSS_LIBS=`pkg-config --libs ${mozilla_nss}` else - check_manually="no" + check_config="yes" fi - if test "x${check_manually}" = "xno"; then - AC_MSG_CHECKING([Mozilla NSPR pkg-config module name]) - mozilla_nspr_pcs="nspr mozilla-nspr firefox-nspr xulrunner-nspr seamonkey-nspr" - for pc in $mozilla_nspr_pcs; do - if $PKG_CONFIG --exists $pc; then - AC_MSG_RESULT([$pc]) - mozilla_nspr=$pc - break; - fi - done - - AC_MSG_CHECKING([Mozilla NSS pkg-config module name]) - mozilla_nss_pcs="nss mozilla-nss firefox-nss xulrunner-nss seamonkey-nss" - for pc in $mozilla_nss_pcs; do - if $PKG_CONFIG --exists $pc; then - AC_MSG_RESULT([$pc]) - mozilla_nss=$pc - break; - fi - done - - if test -n "$mozilla_nspr" -a -n "$mozilla_nss"; then - msg_ssl="yes (Mozilla NSS)" +dnl pkg-config was not able to find nss/nspr ( or static building ) +dnl we should use the neutral tool for this nspr / nss-config. + + if test "$check_config" = "yes"; then + AC_CHECK_PROGS(nsprc, nspr-config, no) + AC_CHECK_PROGS(nssc, nss-config, no) + if test "$nsprc" = "nspr-config" -a "$nssc" = "nss-config"; then + AC_MSG_RESULT([yes, setting flags]) + NSPR_CFLAGS=`nspr-config --cflags` + NSPR_LIBS=`nspr-config --libs` + NSS_CFLAGS=`nss-config --cflags` + NSS_LIBS=`nss-config --libs` if test "x$enable_smime" = "xyes"; then AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled]) msg_smime="yes (Mozilla NSS)" fi - AC_DEFINE(HAVE_NSS,1,[Define if you have NSS]) AC_DEFINE(HAVE_SSL,1,[Define if you have a supported SSL library]) - AC_DEFINE_UNQUOTED(MOZILLA_NSS_LIB_DIR,"`$PKG_CONFIG --variable=libdir $mozilla_nss`",[Define to the full path of mozilla nss library]) - MANUAL_NSPR_CFLAGS="" - MANUAL_NSPR_LIBS="" - MANUAL_NSS_CFLAGS="" - MANUAL_NSS_LIBS="" else - check_manually="yes" - mozilla_nspr="" - mozilla_nss="" + AC_MSG_FAILURE([I haven't found nss/nspr-config or a pkgconfig file. + I won't go on. If you have nspr/nss installed, please give me the + paths or check your bindir / prefix path!]) fi fi - if test "x${check_manually}" = "xyes"; then - mozilla_nss="" - have_nspr_includes="no" - if test "x${with_nspr_includes}" != "xno"; then - CPPFLAGS_save="$CPPFLAGS" +dnl We should have now all the necessary cflags / libs +dnl Now test and set the right config flags - AC_MSG_CHECKING([for Mozilla nspr4 includes in $with_nspr_includes]) - AC_MSG_RESULT([""]) + if test -n "${NSPR_CFLAGS}"; then - CPPFLAGS="$CPPFLAGS -I$with_nspr_includes" - AC_CHECK_HEADERS([nspr.h prio.h],[ moz_nspr_includes="yes" ],, + CFLAGS_save="$CFLAGS" + CFLAGS="$CFLAGS $NSPR_CFLAGS" + AC_CHECK_HEADERS([nspr.h prio.h], + [ have_nspr_includes="yes" ],[ have_nspr_includes="no" ], [[ #if HAVE_NSPR_H #include #include #endif ]]) - CPPFLAGS="$CPPFLAGS_save" - - if test "x{$moz_nspr_includes}" != "xno" -a "x{$moz_nspr_includes}" != "x" ; then - have_nspr_includes="yes" - MANUAL_NSPR_CFLAGS="-I$with_nspr_includes" + CFLAGS="$CFLAGS_save" + + AC_MSG_CHECKING([that NSPR CFLAGS are correct]) + if test "x{$have_nspr_includes}" = "xno"; then + AC_MSG_RESULT([no]) + AC_MSG_FAILURE([I couldn't compile against the test headers. Please + check if you really have libnss/libnspr devel packages installed. + If this is the case and you'll see this error, blame me and file a bug!]) + else + AC_MSG_RESULT([yes]) fi - else - AC_MSG_CHECKING([for Mozilla nspr4 includes]) - AC_MSG_RESULT([no]) - fi + fi + + if test -n "${NSPR_LIBS}" -a "x${have_nspr_includes}" = "xyes"; then - have_nspr_libs="no" - if test "x${with_nspr_libs}" != "xno" -a "x${have_nspr_includes}" != "xno"; then CFLAGS_save="$CFLAGS" LDFLAGS_save="$LDFLAGS" - if test "$enable_nss" = "static"; then - if test -z "${with_nspr_libs}"; then - AC_MSG_ERROR([Static linkage requested, but path to nspr libraries not set.] - [Please specify the path to libnspr4.a] - [Example: --with-nspr-libs=/usr/lib]) - else - nsprlibs="$DL_LIB $with_nspr_libs/libplc4.a $with_nspr_libs/libplds4.a $with_nspr_libs/libnspr4.a $PTHREAD_LIB" - fi - else - nsprlibs="$DL_LIB -lplc4 -lplds4 -lnspr4 $PTHREAD_LIB" - fi + CFLAGS="$CFLAGS $NSPR_CFLAGS" + LDFLAGS="$LDFLAGS $NSPR_LIBS" - AC_CACHE_CHECK([for Mozilla nspr libraries], [ac_cv_moz_nspr_libs], - [ - LIBS_save="$LIBS" - CFLAGS="$CFLAGS $MANUAL_NSPR_CFLAGS" + AC_LINK_IFELSE([AC_LANG_CALL([],[PR_Init])], + [have_nspr_libs="yes"], [have_nspr_libs="no"]) - if test "x${with_nspr_libs}" != "x"; then - LIBS="$nsprlibs" - LDFLAGS="$LDFLAGS -L$with_nspr_libs" - else - LIBS="$nsprlibs" - LDFLAGS="$LDFLAGS" - fi + CFLAGS="$CFLAGS_save" + LDFLAGS="$LDFLAGS_save" - AC_LINK_IFELSE([AC_LANG_CALL([], [PR_Init])], - [ac_cv_moz_nspr_libs="yes"], [ac_cv_moz_nspr_libs="no"]) - CFLAGS="$CFLAGS_save" - LDFLAGS="$LDFLAGS_save" - LIBS="$LIBS_save" - ]) - if test "x$ac_cv_moz_nspr_libs" != "xno"; then - have_nspr_libs="yes" - MANUAL_NSPR_LIBS="-L$with_nspr_libs $nsprlibs" + AC_MSG_CHECKING([that NSPR LIBS are correct]) + if test "x${have_nspr_libs}" = "xyes"; then + AC_MSG_RESULT([yes]) else - MANUAL_NSPR_CLFAGS="" + AC_MSG_RESULT([no]) + AC_MSG_FAILURE([I couldn't link. Please + check if you really have libnss/libnspr devel packages installed. + If this is the case and you'll see this error, blame me and file a bug!]) fi - else - AC_MSG_CHECKING([for Mozilla nspr4 libraries]) - AC_MSG_RESULT([no]) - fi - - if test "x${with_nss_includes}" != "xno" -a "x${have_nspr_libs}" != "xno"; then - CPPFLAGS_save="$CPPFLAGS" + fi - AC_MSG_CHECKING([for Mozilla nss3 includes in $with_nss_includes]) - AC_MSG_RESULT([""]) + if test -n "${NSS_CFLAGS}" -a "x${have_nspr_includes}" = "xyes"; then - if test "x${with_nspr_includes}" != "x"; then - CPPFLAGS="$CPPFLAGS -I$with_nspr_includes -I$with_nss_includes" - else - CPPFLAGS="$CPPFLAGS -I$with_nss_includes" - fi + CFLAGS_save="$CFLAGS" + CFLAGS="$CFLAGS $NSPR_CFLAGS $NSS_CFLAGS" AC_CHECK_HEADERS(nss.h ssl.h smime.h, [ have_nss_includes="yes" ], @@ -1132,91 +1106,50 @@ if test "x${enable_nss}" = "xyes" || test "x${enable_nss}" = "xstatic"; then #endif ]) - CPPFLAGS="$CPPFLAGS_save" + CFLAGS="$CFLAGS_save" + AC_MSG_CHECKING([that nss includes are correct]) if test "x${have_nss_includes}" = "xyes"; then - have_nss_includes="yes" - MANUAL_NSS_CFLAGS="-I$with_nss_includes" + AC_MSG_RESULT([yes]) else - MANUAL_NSPR_CFLAGS="" - MANUAL_NSPR_LIBS="" + AC_MSG_RESULT([no]) + AC_MSG_FAILURE([I couldn't compile against the test headers. Please + check if you really have libnss/libnspr devel packages installed. + If this is the case and you'll see this error, blame me and file a bug!]) fi - else - AC_MSG_CHECKING([for Mozilla nss3 includes]) - AC_MSG_RESULT([no]) - fi + fi + + if test -n "${NSS_CFLAGS}" -a "x${have_nss_includes}" = "xyes"; then - if test "x${with_nss_libs}" != "xno" -a "x${have_nss_includes}" != "xno"; then + CFLAGS_save="$CFLAGS" LDFLAGS_save="$LDFLAGS" - if test "$enable_nss" = "static"; then - if test -z "${with_nss_libs}"; then - AC_MSG_ERROR([Static linkage requested, but path to nss libraries not set.] - [Please specify the path to libnss3.a] - [Example: --with-nspr-libs=/usr/lib/mozilla]) - else - nsslibs="-ldb1 $with_nss_libs/libnssckfw.a $with_nss_libs/libasn1.a $with_nss_libs/libcrmf.a $with_nss_libs/libswfci.a $with_nss_libs/libjar.a $with_nss_libs/libpkcs12.a $with_nss_libs/libpkcs7.a $with_nss_libs/libpki1.a $with_nss_libs/libsmime.a $with_nss_libs/libssl.a $with_nss_libs/libnss.a $with_nss_libs/libpk11wrap.a $with_nss_libs/libsoftokn.a $with_nss_libs/libfreebl.a $with_nss_libs/libnsspki.a $with_nss_libs/libnssdev.a $with_nss_libs/libcryptohi.a $with_nss_libs/libcerthi.a $with_nss_libs/libcertdb.a $with_nss_libs/libsecutil.a $with_nss_libs/libnssb.a" - case "$host" in - *solaris*) - nsslibs="$nsslibs $with_nss_libs/libfreebl.a" - ;; - esac - fi - else - nsslibs="-lssl3 -lsmime3 -lnss3" - fi + CFLAGS="$CFLAGS $NSS_CFLAGS $NSPR_CFLAGS" + LDFLAGS="$LDFLAGS $NSS_LIBS $NSPR_LIBS" - AC_CACHE_CHECK([for Mozilla nss libraries], [ac_cv_moz_nss_libs], - [ - LIBS_save="$LIBS" - LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs -L$with_nss_libs $nsslibs" - LIBS="$nsslibs $nsprlibs" - AC_LINK_IFELSE([AC_LANG_CALL([], [NSS_Init])], - [ac_cv_moz_nss_libs="yes"], [ac_cv_moz_nss_libs="no"]) - if test "$ac_cv_moz_nss_libs" = no; then - nsslibs="-lssl3 -lsmime3 -lnss3" - LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs -L$with_nss_libs $nsslibs" - AC_LINK_IFELSE([AC_LANG_CALL([], [NSS_Init])], - [ac_cv_moz_nss_libs="yes"], [ac_cv_moz_nss_libs="no"]) - fi - LDFLAGS="$LDFLAGS_save" - LIBS="$LIBS_save" - ]) - if test "$ac_cv_moz_nss_libs" != no; then - AC_DEFINE(HAVE_NSS) - AC_DEFINE(HAVE_SSL) - AC_DEFINE_UNQUOTED(MOZILLA_NSS_LIB_DIR,"$with_nss_libs", [Define to the full path of mozilla nss library]) - if test "$enable_nss" = "static"; then - msg_ssl="yes (Mozilla NSS:static)" - else - msg_ssl="yes (Mozilla NSS)" - fi # static_nss - if test "$enable_smime" = "yes"; then - AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled]) - msg_smime="yes (Mozilla NSS)" - fi - MANUAL_NSS_LIBS="-L$with_nss_libs $nsslibs" + AC_LINK_IFELSE([AC_LANG_CALL([], [NSS_Init])], + [have_nss_libs="yes"], [have_nss_libs="no"]) + + CFLAGS="$CFLAGS_save" + LDFLAGS="$LDFLAGS_SAVE" + + AC_MSG_CHECKING([that nss libs are correct]) + if test "x${have_nss_libs}" = "xyes"; then + AC_MSG_RESULT([yes]) else - MANUAL_NSS_CFLAGS="" - MANUAL_NSPR_CFLAGS="" - MANUAL_NSPR_LIBS="" + AC_MSG_RESULT([no]) + AC_MSG_FAILURE([I couldn't compile against the test headers. Please + check if you really have libnss/libnspr devel packages installed. + If this is the case and you'll see this error, blame me and file a bug!]) fi - else - AC_MSG_CHECKING([for Mozilla nss libraries]) - AC_MSG_RESULT([no]) - fi - - MANUAL_NSS_CFLAGS="$MANUAL_NSPR_CFLAGS $MANUAL_NSS_CFLAGS" - MANUAL_NSS_LIBS="$MANUAL_NSPR_LIBS $MANUAL_NSS_LIBS" fi -fi AM_CONDITIONAL(ENABLE_SMIME, [test "x$msg_smime" != "xno"]) -AC_SUBST(MANUAL_NSPR_CFLAGS) -AC_SUBST(MANUAL_NSPR_LIBS) -AC_SUBST(MANUAL_NSS_CFLAGS) -AC_SUBST(MANUAL_NSS_LIBS) +AC_SUBST(NSPR_CFLAGS) +AC_SUBST(NSPR_LIBS) +AC_SUBST(NSS_CFLAGS) +AC_SUBST(NSS_LIBS) dnl ************************************************** dnl Check if we should build the weather calendar plugin @@ -1295,7 +1228,7 @@ if test x$no_x != xyes ; then evolution_save_libs="$LIBS" CFLAGS="$X_CFLAGS" LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS" - AC_CHECK_LIB(X11, XFree, :, AC_MSG_ERROR([libX11 not found])) + AC_CHECK_LIB([X11], [XFree], [:], [AC_MSG_ERROR([libX11 not found])]) CFLAGS="$evolution_save_cflags" LIBS="$evolution_save_libs" X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS" @@ -1350,8 +1283,8 @@ dnl --- Flags to get all the GNOME stuff FULL_GNOME_DEPS="libbonoboui-2.0 gconf-2.0 gthread-2.0 gobject-2.0 libgnomeui-2.0 libglade-2.0" -CPPFLAGS_save="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags-only-I libgnomeui-2.0`" +CFLAGS_save="$CFLAGS" +CFLAGS="$CFLAGS `$PKG_CONFIG --cflags-only-I libgnomeui-2.0`" AC_CHECK_HEADERS(libgnomeui/gnome-icon-lookup.h,,, [[ #if HAVE_LIBGNOMEUI_GNOME_ICON_LOOKUP_H @@ -1364,7 +1297,7 @@ AC_CHECK_HEADERS(libgnomeui/gnome-thumbnail.h,,, #include #endif ]]) -CPPFLAGS="$CPPFLAGS_save" +CFLAGS="$CFLAGS_save" PKG_CHECK_MODULES([HAL], [hal >= hal_minimum_version], [HAVE_HAL="yes"], [HAVE_HAL="no"]) if test "x$HAVE_HAL" = "xyes"; then @@ -1466,18 +1399,9 @@ EVO_SET_COMPILE_FLAGS(CAMEL_GROUPWISE, camel-provider-$EDS_PACKAGE libedataserve AC_SUBST(CAMEL_GROUPWISE_CFLAGS) AC_SUBST(CAMEL_GROUPWISE_LIBS) -if test "x$mozilla_nss" != "x"; then - EVO_SET_COMPILE_FLAGS(MOZILLA_NSS, $mozilla_nss) - MOZILLA_L_DIR=`pkg-config --libs-only-L $mozilla_nss` -else - if test "x$MOZILLA_MANUAL_LIBS" != "x"; then - MOZILLA_L_DIR="-L$with_nss_lib" - fi -fi - EVO_SET_COMPILE_FLAGS(CERT_UI, libedataserverui-$EDS_PACKAGE libglade-2.0 gthread-2.0, - $MANUAL_NSS_CFLAGS $MOZILLA_NSS_CFLAGS, - $MOZILLA_L_DIR $MANUAL_NSS_LIBS $MOZILLA_NSS_LIBS) + $NSS_CFLAGS, + $NSS_LIBS) AC_SUBST(CERT_UI_CFLAGS) AC_SUBST(CERT_UI_LIBS) @@ -1494,7 +1418,7 @@ else E_UTIL_X11_CFLAGS="" E_UTIL_X11_LIBS="" fi -EVO_SET_COMPILE_FLAGS(E_UTIL, libbonoboui-2.0 libglade-2.0 libgnomeui-2.0 libedataserver-$EDS_PACKAGE libedataserverui-$EDS_PACKAGE camel-$EDS_PACKAGE $mozilla_nspr, $THREADS_CFLAGS $MANUAL_NSPR_CFLAGS $E_UTIL_X11_CFLAGS, $THREADS_LIBS $MANUAL_NSPR_LIBS $E_UTIL_X11_LIBS) +EVO_SET_COMPILE_FLAGS(E_UTIL, libbonoboui-2.0 libglade-2.0 libgnomeui-2.0 libedataserver-$EDS_PACKAGE libedataserverui-$EDS_PACKAGE camel-$EDS_PACKAGE, $THREADS_CFLAGS $NSPR_CFLAGS $E_UTIL_X11_CFLAGS, $THREADS_LIBS $NSPR_LIBS $E_UTIL_X11_LIBS) AC_SUBST(E_UTIL_CFLAGS) AC_SUBST(E_UTIL_LIBS) @@ -1563,7 +1487,7 @@ fi dnl --- evolution-mail flags -EVO_SET_COMPILE_FLAGS(EVOLUTION_MAIL, camel-provider-$EDS_PACKAGE libgnomeui-2.0 libbonoboui-2.0 libglade-2.0 gio-2.0 gconf-2.0 gobject-2.0 libgtkhtml-$GTKHTML_PACKAGE gtkhtml-editor bonobo-activation-2.0 $mozilla_nss libebook-$EDS_PACKAGE libedataserverui-$EDS_PACKAGE) +EVO_SET_COMPILE_FLAGS(EVOLUTION_MAIL, camel-provider-$EDS_PACKAGE libgnomeui-2.0 libbonoboui-2.0 libglade-2.0 gio-2.0 gconf-2.0 gobject-2.0 libgtkhtml-$GTKHTML_PACKAGE gtkhtml-editor bonobo-activation-2.0 libebook-$EDS_PACKAGE libedataserverui-$EDS_PACKAGE) AC_SUBST(EVOLUTION_MAIL_CFLAGS) AC_SUBST(EVOLUTION_MAIL_LIBS)