Hello,
with this patch I successfully compiled Bash 4.2 using a DJGPP cross-compiler running under Linux (Ubuntu 12.10). May this be applied?

Regards,
Fabrizio
diff -ru bash-4.2/execute_cmd.c bash-4.2patch/execute_cmd.c
--- bash-4.2/execute_cmd.c	2011-02-09 23:32:25.000000000 +0100
+++ bash-4.2patch/execute_cmd.c	2013-03-02 13:43:21.342462272 +0100
@@ -2202,7 +2202,11 @@
   /* If the `lastpipe' option is set with shopt, and job control is not
      enabled, execute the last element of non-async pipelines in the
      current shell environment. */
-  if (lastpipe_opt && job_control == 0 && asynchronous == 0 && pipe_out == NO_PIPE && prev > 0)
+  if (lastpipe_opt
+#if defined (JOB_CONTROL)
+ && job_control == 0
+#endif
+ && asynchronous == 0 && pipe_out == NO_PIPE && prev > 0)
     {
       lstdin = move_to_high_fd (0, 0, 255);
       if (lstdin > 0)
diff -ru bash-4.2/include/posixdir.h bash-4.2patch/include/posixdir.h
--- bash-4.2/include/posixdir.h	2008-08-12 16:01:57.000000000 +0200
+++ bash-4.2patch/include/posixdir.h	2013-03-02 14:30:39.610503840 +0100
@@ -50,7 +50,7 @@
 #  define d_fileno d_ino
 #endif
 
-#if defined (_POSIX_SOURCE) && (!defined (HAVE_STRUCT_DIRENT_D_INO) || defined (BROKEN_DIRENT_D_INO))
+#if (!defined (HAVE_STRUCT_DIRENT_D_INO) || defined (BROKEN_DIRENT_D_INO))
 /* Posix does not require that the d_ino field be present, and some
    systems do not provide it. */
 #  define REAL_DIR_ENTRY(dp) 1
diff -ru bash-4.2/lib/malloc/malloc.c bash-4.2patch/lib/malloc/malloc.c
--- bash-4.2/lib/malloc/malloc.c	2008-08-12 16:23:51.000000000 +0200
+++ bash-4.2patch/lib/malloc/malloc.c	2013-03-02 14:36:15.302508757 +0100
@@ -561,7 +561,7 @@
 
   /* Block all signals in case we are executed from a signal handler. */
   blocked_sigs = 0;
-#ifdef SHELL
+#if (defined SHELL && defined SIGCHLD)
   if (interrupt_immediately || signal_is_trapped (SIGINT) || signal_is_trapped (SIGCHLD))
 #endif
     {
diff -ru bash-4.2/lib/readline/signals.c bash-4.2patch/lib/readline/signals.c
--- bash-4.2/lib/readline/signals.c	2011-02-11 16:53:33.000000000 +0100
+++ bash-4.2patch/lib/readline/signals.c	2013-03-02 14:35:19.614507942 +0100
@@ -587,7 +587,7 @@
 {
   if (sigwinch_blocked)
     return;
-
+#ifdef SIGWINCH
 #if defined (HAVE_POSIX_SIGNALS)
   sigemptyset (&sigwinch_set);
   sigemptyset (&sigwinch_oset);
@@ -602,7 +602,7 @@
 #    endif /* HAVE_USG_SIGHOLD */
 #  endif /* !HAVE_BSD_SIGNALS */
 #endif /* !HAVE_POSIX_SIGNALS */
-
+#endif /* SIGWINCH */
   sigwinch_blocked = 1;
 }
 
diff -ru bash-4.2/lib/sh/getcwd.c bash-4.2patch/lib/sh/getcwd.c
--- bash-4.2/lib/sh/getcwd.c	2009-06-17 02:16:55.000000000 +0200
+++ bash-4.2patch/lib/sh/getcwd.c	2013-03-02 14:40:33.686512541 +0100
@@ -48,7 +48,7 @@
 
 #include <bashansi.h>
 
-#if defined (BROKEN_DIRENT_D_INO)
+#if (!defined (HAVE_STRUCT_DIRENT_D_FILENO) && !defined (HAVE_STRUCT_DIRENT_D_INO)) || defined (BROKEN_DIRENT_D_INO)
 #  include "command.h"
 #  include "general.h"
 #  include "externs.h"
@@ -71,7 +71,7 @@
 /* If the d_fileno member of a struct dirent doesn't return anything useful,
    we need to check inode number equivalence the hard way.  Return 1 if
    the inode corresponding to PATH/DIR is identical to THISINO. */
-#if defined (BROKEN_DIRENT_D_INO)
+#if (!defined (HAVE_STRUCT_DIRENT_D_FILENO) && !defined (HAVE_STRUCT_DIRENT_D_INO)) || defined (BROKEN_DIRENT_D_INO)
 static int
 _path_checkino (dotp, name, thisino)
      char *dotp;
@@ -206,7 +206,7 @@
 	      (d->d_name[1] == '\0' ||
 		(d->d_name[1] == '.' && d->d_name[2] == '\0')))
 	    continue;
-#if !defined (BROKEN_DIRENT_D_INO)
+#if (defined (HAVE_STRUCT_DIRENT_D_FILENO) || defined (HAVE_STRUCT_DIRENT_D_INO)) && !defined (BROKEN_DIRENT_D_INO)
 	  if (mount_point || d->d_fileno == thisino)
 #else
 	  if (mount_point || _path_checkino (dotp, d->d_name, thisino))
diff -ru bash-4.2/nojobs.c bash-4.2patch/nojobs.c
--- bash-4.2/nojobs.c	2010-07-05 21:58:08.000000000 +0200
+++ bash-4.2patch/nojobs.c	2013-03-02 13:44:37.426463386 +0100
@@ -446,6 +446,10 @@
 }
 #endif /* WAITPID */
 
+#if !defined (SA_RESTART)
+#  define SA_RESTART 0
+#endif
+
 #if !defined (HAVE_SIGINTERRUPT) && defined (HAVE_POSIX_SIGNALS)
 static int
 siginterrupt (sig, flag)
diff -ru bash-4.2/sig.c bash-4.2patch/sig.c
--- bash-4.2/sig.c	2010-11-23 14:21:22.000000000 +0100
+++ bash-4.2patch/sig.c	2013-03-02 14:07:41.198483652 +0100
@@ -663,11 +663,13 @@
   act.sa_handler = handler;
   act.sa_flags = 0;
 
+#ifdef SIGCHLD
   /* XXX - bash-4.2 */
   /* We don't want a child death to interrupt interruptible system calls, even
      if we take the time to reap children */
   if (sig == SIGCHLD)
     act.sa_flags |= SA_RESTART;		/* XXX */
+#endif
 
   sigemptyset (&act.sa_mask);
   sigemptyset (&oact.sa_mask);

Reply via email to