Dear All,

When we build bash for some targets the INCLUDES variable for BUILD_CC
contains the path to target readline headers. This path points to the
target headers which not preferred for utilities which prepared for build
machine.

Also when we have installed readline on the target the configure script
avoids cross_compilation problems with AC_TRY_RUN and substitutes wrong
(very old) version of libreadline. If we sure that we installed correct
readline version we can change configure script for cross compilation
process.

Please look at attached patches. If this solution can be used for common
case then please apply these patches for the future versions of bash.

Best Regards,
Andrey K.
diff -b --unified -Nr bash-4.2-orig/Makefile.in bash-4.2/Makefile.in
--- bash-4.2-orig/Makefile.in	2010-12-01 03:22:42.000000000 +0300
+++ bash-4.2/Makefile.in	2014-03-16 13:07:47.973897424 +0400
@@ -142,14 +142,17 @@
 BASE_CCFLAGS = $(PROFILE_FLAGS) $(SYSTEM_FLAGS) $(LOCAL_DEFS) \
 	  $(DEFS) $(LOCAL_CFLAGS) $(INCLUDES)
 
+BASE_CCFLAGS_FOR_BUILD = $(PROFILE_FLAGS) $(SYSTEM_FLAGS) $(LOCAL_DEFS) $(DEFS) $(LOCAL_CFLAGS) $(INCLUDES_FOR_BUILD)
+
 CCFLAGS = $(BASE_CCFLAGS) $(CPPFLAGS) $(CFLAGS)
 
-CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
+CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
 
 LDFLAGS = @LDFLAGS@ $(STATIC_LD) $(LOCAL_LDFLAGS) $(PROFILE_FLAGS) $(CFLAGS)
 LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD)
 
 INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC)
+INCLUDES_FOR_BUILD = -I. -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC)
 
 # Maybe add: -Wextra
 GCC_LINT_FLAGS = -O -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wno-parentheses \
diff -b --unified -Nr bash-4.2-orig/builtins/Makefile.in bash-4.2/builtins/Makefile.in
--- bash-4.2-orig/builtins/Makefile.in	2010-12-21 16:37:18.000000000 +0300
+++ bash-4.2/builtins/Makefile.in	2014-03-16 13:07:47.973897424 +0400
@@ -86,13 +86,17 @@
 MKDIRS = ${topdir}/support/mkdirs
 
 INCLUDES = -I. -I.. @RL_INCLUDE@ -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib -I$(srcdir) ${INTL_INC}
+INCLUDES_FOR_BUILD = -I. -I.. -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib -I$(srcdir) ${INTL_INC}
 
 BASE_CCFLAGS = ${PROFILE_FLAGS} $(DEFS) $(LOCAL_DEFS) $(SYSTEM_FLAGS) \
 	 ${INCLUDES} $(LOCAL_CFLAGS)
 
+BASE_CCFLAGS_FOR_BUILD = ${PROFILE_FLAGS} $(DEFS) $(LOCAL_DEFS) $(SYSTEM_FLAGS) \
+	 ${INCLUDES_FOR_BUILD} $(LOCAL_CFLAGS)
+
 CCFLAGS = $(BASE_CCFLAGS) $(CPPFLAGS) $(CFLAGS)
 
-CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
+CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
 
 GCC_LINT_FLAGS = -Wall -Wshadow -Wpointer-arith -Wcast-qual \
 		 -Wcast-align -Wstrict-prototypes -Wconversion \
diff -b --unified -Nr bash-4.2-orig/aclocal.m4 bash-4.2/aclocal.m4
--- bash-4.2-orig/aclocal.m4	2010-07-05 23:36:21.000000000 +0400
+++ bash-4.2/aclocal.m4	2014-03-16 13:07:48.157897417 +0400
@@ -1828,7 +1828,7 @@
 ],
 ac_cv_rl_version=`cat conftest.rlv`,
 ac_cv_rl_version='0.0',
-ac_cv_rl_version='4.2')])
+ac_cv_rl_version='6.2')])
 
 CFLAGS="$_save_CFLAGS"
 LDFLAGS="$_save_LDFLAGS"
diff -b --unified -Nr bash-4.2-orig/configure bash-4.2/configure
--- bash-4.2-orig/configure	2011-02-08 01:03:22.000000000 +0300
+++ bash-4.2/configure	2014-03-16 13:07:48.157897417 +0400
@@ -5563,7 +5563,7 @@
   $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
-  ac_cv_rl_version='4.2'
+  ac_cv_rl_version='6.2'
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
diff -b --unified -Nr bash-4.3-orig/Makefile.in bash-4.3/Makefile.in
--- bash-4.3-orig/Makefile.in	2014-01-26 01:27:30.000000000 +0400
+++ bash-4.3/Makefile.in	2014-03-16 13:07:48.360897408 +0400
@@ -146,14 +146,17 @@
 BASE_CCFLAGS = $(PROFILE_FLAGS) $(SYSTEM_FLAGS) $(LOCAL_DEFS) \
 	  $(DEFS) $(LOCAL_CFLAGS) $(INCLUDES)
 
+BASE_CCFLAGS_FOR_BUILD = $(PROFILE_FLAGS) $(SYSTEM_FLAGS) $(LOCAL_DEFS) $(DEFS) $(LOCAL_CFLAGS) $(INCLUDES_FOR_BUILD)
+
 CCFLAGS = $(BASE_CCFLAGS) $(CPPFLAGS) $(CFLAGS)
 
-CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
+CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
 
 LDFLAGS = @LDFLAGS@ $(STATIC_LD) $(LOCAL_LDFLAGS) $(PROFILE_FLAGS) $(CFLAGS)
 LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD)
 
 INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC)
+INCLUDES_FOR_BUILD = -I. -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC)
 
 # Maybe add: -Wextra
 GCC_LINT_FLAGS = -O -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wno-parentheses \
diff -b --unified -Nr bash-4.3-orig/builtins/Makefile.in bash-4.3/builtins/Makefile.in
--- bash-4.3-orig/builtins/Makefile.in	2012-05-25 17:29:19.000000000 +0400
+++ bash-4.3/builtins/Makefile.in	2014-03-16 13:07:48.360897408 +0400
@@ -88,13 +88,17 @@
 HELPFILES_TARGET = @HELPFILES_TARGET@
 
 INCLUDES = -I. -I.. @RL_INCLUDE@ -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib -I$(srcdir) ${INTL_INC}
+INCLUDES_FOR_BUILD = -I. -I.. -I$(topdir) -I$(BASHINCDIR) -I$(topdir)/lib -I$(srcdir) ${INTL_INC}
 
 BASE_CCFLAGS = ${PROFILE_FLAGS} $(DEFS) $(LOCAL_DEFS) $(SYSTEM_FLAGS) \
 	 ${INCLUDES} $(LOCAL_CFLAGS)
 
+BASE_CCFLAGS_FOR_BUILD = ${PROFILE_FLAGS} $(DEFS) $(LOCAL_DEFS) $(SYSTEM_FLAGS) \
+	 ${INCLUDES_FOR_BUILD} $(LOCAL_CFLAGS)
+
 CCFLAGS = $(BASE_CCFLAGS) $(CPPFLAGS) $(CFLAGS)
 
-CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
+CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
 
 GCC_LINT_FLAGS = -Wall -Wshadow -Wpointer-arith -Wcast-qual \
 		 -Wcast-align -Wstrict-prototypes -Wconversion \
diff -b --unified -Nr bash-4.3-orig/aclocal.m4 bash-4.3/aclocal.m4
--- bash-4.3-orig/aclocal.m4	2013-10-21 02:37:50.000000000 +0400
+++ bash-4.3/aclocal.m4	2014-03-16 13:07:48.562897399 +0400
@@ -1854,7 +1854,7 @@
 ],
 ac_cv_rl_version=`cat conftest.rlv`,
 ac_cv_rl_version='0.0',
-ac_cv_rl_version='4.2')])
+ac_cv_rl_version='6.3')])
 
 CFLAGS="$_save_CFLAGS"
 LDFLAGS="$_save_LDFLAGS"
diff -b --unified -Nr bash-4.3-orig/configure bash-4.3/configure
--- bash-4.3-orig/configure	2014-02-11 19:38:00.000000000 +0400
+++ bash-4.3/configure	2014-03-16 13:07:48.561897399 +0400
@@ -5278,7 +5278,7 @@
   $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then :
-  ac_cv_rl_version='4.2'
+  ac_cv_rl_version='6.3'
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */

Reply via email to