plug-ins: sendmail is also a runtime dependency.

Such as `xdg-email`, if --with-sendmail is set, sendmail presence should
actually be checked at runtime and not be a blocker during build.
This commit is contained in:
Jehan 2016-05-28 00:51:24 +02:00
parent ee0c51a43e
commit 0d8d5a0cfe
2 changed files with 20 additions and 30 deletions

View File

@ -1834,7 +1834,7 @@ have_email="no (xdg-email not found)"
AC_ARG_WITH(sendmail,[ --with-sendmail[=DIR] use sendmail instead of xdg-email])
have_sendmail=no
# Sendmail must be explicitely enabled.
# Sendmail must be explicitely enabled to replace xdg-email implementation.
if test "x$with_sendmail" != "x" && test "x$with_sendmail" != "xno"; then
if test "x$with_sendmail" = "xyes"; then
sendmail_path=$PATH:/usr/sbin:/usr/lib
@ -1845,14 +1845,13 @@ if test "x$with_sendmail" != "x" && test "x$with_sendmail" != "xno"; then
AC_PATH_PROG(SENDMAIL, sendmail, , $sendmail_path)
if test "x$SENDMAIL" != "x"; then
have_email="yes (sendmail)"
have_sendmail=yes
AC_DEFINE_UNQUOTED(SENDMAIL, "$SENDMAIL",
[The MTA used by the mail plug-in.])
else
AC_MSG_ERROR([
*** Check for sendmail failed, though it was explicitly enabled with --with-sendmail.
*** If you know where it is installed, you may configure --with-sendmail=/path/to/bin/.])
# Not having sendmail at runtime is not a blocker.
have_email="needs runtime dependency: sendmail"
fi
have_sendmail=yes
fi
if test "x$have_sendmail" = xno; then

View File

@ -111,6 +111,8 @@ MAIN ()
static void
query (void)
{
gchar *email_bin;
static const GimpParamDef args[] =
{
{ GIMP_PDB_INT32, "run-mode", "The run mode { RUN-INTERACTIVE (0), RUN-NONINTERACTIVE (1) }" },
@ -124,33 +126,18 @@ query (void)
{ GIMP_PDB_INT32, "encapsulation", "ignored" }
};
#ifndef SENDMAIL /* xdg-email */
/* check if xdg-email is installed
/* check if xdg-email or sendmail is installed
* TODO: allow setting the location of the executable in preferences
*/
gchar *argv[] = { "xdg-email", "--version", NULL };
gboolean have_xdg_email = FALSE;
if (g_spawn_sync (NULL,
argv,
NULL,
G_SPAWN_STDERR_TO_DEV_NULL |
G_SPAWN_STDOUT_TO_DEV_NULL |
G_SPAWN_SEARCH_PATH,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL))
{
have_xdg_email = TRUE;
}
if (! have_xdg_email)
return;
#ifdef SENDMAIL
email_bin = g_find_program_in_path ("sendmail");
#else
email_bin = g_find_program_in_path ("xdg-email");
#endif
if (email_bin == NULL)
return;
gimp_install_procedure (PLUG_IN_PROC,
N_("Send the image by email"),
#ifdef SENDMAIL
@ -171,6 +158,8 @@ query (void)
gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/File/Send");
gimp_plugin_icon_register (PLUG_IN_PROC, GIMP_ICON_TYPE_ICON_NAME,
(const guint8 *) GTK_STOCK_EDIT);
g_free (email_bin);
}
static void
@ -400,7 +389,7 @@ send_image (const gchar *filename,
#else /* SENDMAIL */
/* construct the "sendmail user@location" line */
mailcmd[0] = SENDMAIL;
mailcmd[0] = "sendmail";
mailcmd[1] = mail_info.receipt;
mailcmd[2] = NULL;
@ -806,7 +795,9 @@ sendmail_pipe (gchar **cmd,
gint fd;
GError *err = NULL;
if (! g_spawn_async_with_pipes (NULL, cmd, NULL, G_SPAWN_DO_NOT_REAP_CHILD,
if (! g_spawn_async_with_pipes (NULL, cmd, NULL,
G_SPAWN_DO_NOT_REAP_CHILD |
G_SPAWN_SEARCH_PATH,
NULL, NULL, pid, &fd, NULL, NULL, &err))
{
g_message (_("Could not start sendmail (%s)"), err->message);