Attached is a quick and dirty patch which allowed me to build
mailutils-1.2 on hpux10.20 with gcc 4.2.0.  I configured with
'--disable-nls' '--disable-pthread' since I didn't think thread
support would work.  Probably, it would work with hpux11.  I
believe that the changes that I have done are relevant to hpux11
as well although I haven't tried them.

There are probably cleaner ways to handle most of the issues.  In
particular, I wasn't successful in finding a way to only use the
included vsyslog.c when not available on the target.  There are
probably better implementations of vsyslog.c than what I found.

I encountered a couple of other issues not addressed by the attached
change.  1) the hpux versions of sysexits.h doesn't define EX_CONFIG.
2) Apparently, some old guile headers define error_t to int leading
to a build failure.  This guile problem is fixed in the latest version.

Since the changes are all minor configuration issues, hopefully you
will consider updating mailutils to support hpux.

Dave
-- 
J. David Anglin                                  [EMAIL PROTECTED]
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
diff -u3pr mailutils-1.2~/configure.ac mailutils-1.2/configure.ac
--- mailutils-1.2~/configure.ac Fri Jun 29 05:36:20 2007
+++ mailutils-1.2/configure.ac  Sun Oct  7 22:23:53 2007
@@ -61,6 +61,7 @@ AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_LIBTOOL_DLOPEN
 AC_PROG_LIBTOOL
+AC_PROG_RANLIB
 AC_PROG_YACC
 AM_PROG_LEX
 
@@ -245,7 +246,7 @@ AH_BOTTOM([
 # include <paths.h>
 #endif
 #ifndef _PATH_MAILDIR
-# if (defined(sun) && defined(__svr4__)) || defined(__SVR4)
+# if (defined(sun) && defined(__svr4__)) || defined(__SVR4) || defined(__hpux)
 #  define _PATH_MAILDIR "/var/mail"
 # else
 #  define _PATH_MAILDIR "/usr/spool/mail"
@@ -423,6 +424,15 @@ AC_CHECK_DECLS([strtok_r, strchrnul, str
 # include <strings.h>
 #endif])
 
+AC_CHECK_DECLS([vsyslog],
+ , , [
+#ifdef HAVE_SYSLOG_H
+# include <syslog.h>
+#endif
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif])
+
 AC_CHECK_DECLS(environ, , ,
   [ #include <unistd.h>
     #include <stdlib.h> ])
@@ -434,10 +444,16 @@ extern char *strtok_r (char *s, const ch
 #if !HAVE_DECL_STRSIGNAL
 extern char *strsignal (int);
 #endif
+#if !HAVE_DECL_VSYSLOG
+#ifdef HAVE_STDARG_H
+# include <stdarg.h>
+#endif
+void vsyslog (int, const char *, va_list);
+#endif
 ])
 
 AC_CHECK_FUNCS(mkstemp sigaction sysconf getdelim setreuid \
- setresuid seteuid setlocale vfork _exit)
+ setresuid setegid seteuid setlocale strsignal vfork _exit)
 
 AC_FUNC_FSEEKO
 AC_FUNC_SETVBUF_REVERSED
diff -u3pr mailutils-1.2~/dotlock/dotlock.c mailutils-1.2/dotlock/dotlock.c
--- mailutils-1.2~/dotlock/dotlock.c    Wed Jun 27 08:07:40 2007
+++ mailutils-1.2/dotlock/dotlock.c     Sun Oct  7 22:31:03 2007
@@ -32,6 +32,12 @@
 #include <mailutils/locker.h>
 #include <mailutils/nls.h>
 
+#ifdef HAVE_SETEGID
+# define SETEGID setegid
+#else
+# define SETEGID setgid
+#endif
+
 const char *program_version = "GNU dotlock (" PACKAGE_STRING ")";
 static char doc[] =
 N_("GNU dotlock -- lock mail spool files")
@@ -135,7 +141,7 @@ main (int argc, char *argv[])
 
   /* Drop permissions during argument parsing. */
 
-  if (setegid (usergid) < 0)
+  if (SETEGID (usergid) < 0)
     return MU_DL_EX_ERROR;
 
   mu_argp_init (program_version, NULL);
@@ -157,7 +163,7 @@ main (int argc, char *argv[])
   if (retries != 0)
     mu_locker_set_retries (locker, retries);
 
-  if (setegid (mailgid) < 0)
+  if (SETEGID (mailgid) < 0)
     return MU_DL_EX_ERROR;
 
   if (unlock)
@@ -165,7 +171,7 @@ main (int argc, char *argv[])
   else
     err = mu_locker_lock (locker);
 
-  setegid(usergid);
+  SETEGID(usergid);
 
   mu_locker_destroy (&locker);
 
diff -u3pr mailutils-1.2~/examples/mta.c mailutils-1.2/examples/mta.c
--- mailutils-1.2~/examples/mta.c       Wed Jun 27 08:07:40 2007
+++ mailutils-1.2/examples/mta.c        Fri Oct  5 22:03:17 2007
@@ -60,6 +60,7 @@
 #include <sys/time.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <arpa/inet.h>
 #include <mu_asprintf.h>
 #include <getline.h>
 #include <mailutils/argcv.h>
diff -u3pr mailutils-1.2~/imap4d/signal.c mailutils-1.2/imap4d/signal.c
--- mailutils-1.2~/imap4d/signal.c      Wed Jun 27 08:07:40 2007
+++ mailutils-1.2/imap4d/signal.c       Sat Oct  6 01:13:39 2007
@@ -39,7 +39,11 @@ imap4d_sigchld (int signo)
 RETSIGTYPE
 imap4d_signal (int signo)
 {
+#ifdef HAVE_STRSIGNAL
   syslog (LOG_CRIT, _("Got signal %s"), strsignal (signo));
+#else
+  syslog (LOG_CRIT, _("Got signal %d"), signo);
+#endif
   /* Master process.  */
   if (util_is_master ())
     {
diff -u3pr mailutils-1.2~/lib/Makefile.am mailutils-1.2/lib/Makefile.am
--- mailutils-1.2~/lib/Makefile.am      Wed Jun 27 08:07:41 2007
+++ mailutils-1.2/lib/Makefile.am       Sat Oct  6 20:59:01 2007
@@ -25,9 +25,10 @@ INCLUDES = @MU_COMMON_INCLUDES@ @INTLINC
 libmuaux_la_SOURCES = \
  daemon.c\
  mailcap.c\
- mu_dbm.c
+ mu_dbm.c \
+ vsyslog.c
 
-EXTRA_DIST = utmp.c 
+EXTRA_DIST = utmp.c
 
 noinst_HEADERS =\
  mu_dbm.h\
diff -u3pr mailutils-1.2~/lib/obstack.c mailutils-1.2/lib/obstack.c
--- mailutils-1.2~/lib/obstack.c        Sun Sep 10 07:04:27 2006
+++ mailutils-1.2/lib/obstack.c Fri Oct  5 21:17:25 2007
@@ -55,7 +55,11 @@
 
 #ifndef ELIDE_CODE
 
+#ifdef __hpux
+#include <inttypes.h>
+#else
 # include <stdint.h>
+#endif
 
 /* Determine default alignment.  */
 union fooround
diff -u3pr mailutils-1.2~/mailbox/inttostr.h mailutils-1.2/mailbox/inttostr.h
--- mailutils-1.2~/mailbox/inttostr.h   Sun Sep 10 07:04:28 2006
+++ mailutils-1.2/mailbox/inttostr.h    Fri Oct  5 20:43:27 2007
@@ -19,7 +19,11 @@
 
 /* Written by Paul Eggert */
 
+#ifdef __hpux
+#include <inttypes.h>
+#else
 #include <stdint.h>
+#endif
 #include <sys/types.h>
 
 #include "intprops.h"
diff -u3pr mailutils-1.2~/mailbox/md5.h mailutils-1.2/mailbox/md5.h
--- mailutils-1.2~/mailbox/md5.h        Sun Sep 10 07:04:28 2006
+++ mailutils-1.2/mailbox/md5.h Fri Oct  5 20:31:47 2007
@@ -22,7 +22,11 @@
 #define _MD5_H 1
 
 #include <stdio.h>
+#ifdef __hpux
+#include <inttypes.h>
+#else
 #include <stdint.h>
+#endif
 
 #define MD5_DIGEST_SIZE 16
 #define MD5_BLOCK_SIZE 64
diff -u3pr mailutils-1.2~/mailbox/mutil.c mailutils-1.2/mailbox/mutil.c
--- mailutils-1.2~/mailbox/mutil.c      Wed Jun 27 15:38:09 2007
+++ mailutils-1.2/mailbox/mutil.c       Fri Oct  5 19:43:07 2007
@@ -36,7 +36,9 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+#ifndef __hpux
 #include <sys/select.h>
+#endif
 
 #ifdef HAVE_STRINGS_H
 #include <strings.h>
diff -u3pr mailutils-1.2~/pop3d/signal.c mailutils-1.2/pop3d/signal.c
--- mailutils-1.2~/pop3d/signal.c       Thu Jun 28 10:32:55 2007
+++ mailutils-1.2/pop3d/signal.c        Sat Oct  6 01:12:05 2007
@@ -50,7 +50,11 @@ pop3d_signal (int signo)
 {
   int code;
   
+#ifdef HAVE_STRSIGNAL
   syslog (LOG_CRIT, _("Got signal %s"), strsignal (signo));
+#else
+  syslog (LOG_CRIT, _("Got signal %d"), signo);
+#endif
 
   /* Master process.  */
   if (pop3d_is_master ())
--- /dev/null   Mon Oct  8 12:03:32 2007
+++ mailutils-1.2/lib/vsyslog.c Sat Oct  6 01:15:47 2007
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <sys/types.h>
+#include <stdarg.h>
+#include <syslog.h>
+
+void
+vsyslog(pri, fmt, ap)
+       int pri;
+       register const char *fmt;
+       va_list ap;
+{
+       char tbuf[2048];
+
+       (void) vsnprintf (tbuf, 2048, fmt, ap);
+       (void) syslog (pri, tbuf);
+       return;
+}
_______________________________________________
Bug-mailutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-mailutils

Reply via email to