[patch] make sure static linking with included libs always works

2005-08-02 Thread Mike Frysinger
some compilers (like Darwin's gcc-4) will attempt to locate a shared library 
in the lib search path before searching for a static one ... the default 
behavior of gcc on linux is to search all library paths for static or shared 
versions of a library and use whichever it finds first (defaulting to shared 
if a path contains both static and shared)

so, doing '-L./lib/readline -lreadline' on Darwin will have the compiler 
search ./lib/readline then the system paths looking for a shared version of 
libreadline ... if it fails, it restarts looking for a static lib.  gcc would 
find libreadline.a in ./lib/readline first and just use that.  who knows what 
different compilers do :).

find attached a patch that will cause the build system to do -lreadline if 
building against the system readline or use ./lib/readline/libreadline.a if 
building against the included version ... no complications this way
-mike
--- configure.in
+++ configure.in
@@ -477,8 +477,8 @@
 
 if test $opt_readline = yes; then
 	AC_DEFINE(READLINE)
-	READLINE_LIB=-lreadline
 	if test "$opt_with_installed_readline" != "no" ; then
+		READLINE_LIB=-lreadline
 		case "$opt_with_installed_readline" in
 		yes)	RL_INCLUDE= ;;
 		*)	case "$RL_INCLUDEDIR" in
@@ -490,6 +490,7 @@
 		READLINE_DEP=
 	else
 		RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
+		READLINE_LIB='$(RL_LIBDIR)/libreadline.a'
 		READLINE_DEP='$(READLINE_LIBRARY)'
 	fi
 else
@@ -503,8 +504,8 @@
 	if test $opt_bang_history = yes; then
 		AC_DEFINE(BANG_HISTORY)
 	fi
-	HISTORY_LIB=-lhistory
  	if test "$opt_with_installed_readline" != "no"; then
+		HISTORY_LIB=-lhistory
 		HIST_LIBDIR=$RL_LIBDIR
 		HISTORY_DEP=
 		case "$opt_with_installed_readline" in
@@ -517,6 +518,7 @@
 		esac
 	else
 		HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
+		HISTORY_LIB='$(HIST_LIBDIR)/libhistory.a'
 		HISTORY_DEP='$(HISTORY_LIBRARY)'
 	fi
 else
___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash


Suggested patch for strftime for hpux10.20, hpux11.00

2005-08-02 Thread rdbrown
Configuration Information [Automatically generated, do not change]:
Machine: hppa2.0n
OS: hpux11.00
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='hppa2.0n' 
-DCONF_OSTYPE='hpux11.00' -DCONF_MACHTYPE='hppa2.0n-hp-hpux11.00' 
-DCONF_VENDOR='hp' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H -DHPUX  -I.  -I. -I./include -I./lib  
-I/usr/local/include -g -O2
uname output: HP-UX S6393250 B.11.00 A 9000/785 2013328359 two-user license
Machine Type: hppa2.0n-hp-hpux11.00

Bash Version: 3.0
Patch Level: 16
Release Status: release

Description:
bash-3.0 fails to build because lib/sh/strftime.c assumes
that the altzone external is available on hpux11.00.
hpux11.11 provides strftime so configure will find it.
Prototype get_string_value for warning removal.

Fix:
--- lib/sh/strftime.c.orig  2005-08-03 00:02:38.0 +1000
+++ lib/sh/strftime.c   2005-07-31 00:22:30.0 +1000
@@ -95,12 +95,16 @@ static int iso8601wknum(const struct tm 
 #if !defined(OS2) && !defined(MSDOS) && defined(HAVE_TZNAME)
 extern char *tzname[2];
 extern int daylight;
-#if defined(SOLARIS) || defined(mips) || defined (M_UNIX)
+#if defined(SOLARIS) || defined(mips) || defined (M_UNIX) 
 extern long int timezone, altzone;
 #else
+#if defined(__hpux)
+extern long int timezone;
+#else
 extern int timezone, altzone;
 #endif
 #endif
+#endif
 
 #undef min /* just in case */
 
@@ -137,6 +141,9 @@ strftime(char *s, size_t maxsize, const 
static char *savetz = NULL;
static int savetzlen = 0;
char *tz;
+#if defined (SHELL)
+   extern char *get_string_value(const char *);
+#endif /* SHELL */
 #endif /* POSIX_SEMANTICS */
 #ifndef HAVE_TM_ZONE
 #ifndef HAVE_TM_NAME
@@ -480,7 +487,11 @@ strftime(char *s, size_t maxsize, const 
 * Systems with tzname[] probably have timezone as
 * secs west of GMT.  Convert to mins east of GMT.
 */
+#if defined(__hpux)
+   off = -timezone / 60;
+#else
off = -(daylight ? timezone : altzone) / 60;
+#endif
 #else /* !HAVE_TZNAME */
off = -zone.tz_minuteswest;
 #endif /* !HAVE_TZNAME */



___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash