diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2013-08-29 19:35:45 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2013-08-29 19:35:45 +0300 |
commit | 86e23f74da247cd661c69e4bb1a5327001cc3317 (patch) | |
tree | 0959db64aacf740e0683f3cc23257c710fc80327 | |
parent | 8d5656873bcc35003371334353c43c25d6673fb9 (diff) | |
download | egawk-86e23f74da247cd661c69e4bb1a5327001cc3317.tar.gz egawk-86e23f74da247cd661c69e4bb1a5327001cc3317.tar.bz2 egawk-86e23f74da247cd661c69e4bb1a5327001cc3317.zip |
Fix issue with old readline lib on Mac OS X.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | TODO | 9 | ||||
-rw-r--r-- | configh.in | 3 | ||||
-rwxr-xr-x | configure | 44 | ||||
-rw-r--r-- | debug.c | 15 | ||||
-rw-r--r-- | m4/ChangeLog | 8 | ||||
-rw-r--r-- | m4/readline.m4 | 6 |
7 files changed, 78 insertions, 16 deletions
@@ -1,3 +1,12 @@ +2013-08-29 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (HAVE_HISTORY_LIST): Move checks and defines to the top. + (do_save, serialize): Adjust #if checks to depend on having both + readline and the history functions. Needed for Mac OS X whose + native readline is a very old version. Sigh. + * configh.in, configure: Regenerated due to change in m4/readline.m4. + Issue reported by Hermann Peifer and Larry Baker. + 2013-08-26 Arnold D. Robbins <arnold@skeeve.com> * regcomp.c (parse_dup_op): Remove RE_TOKEN_INIT_BUG code (change of @@ -15,15 +15,6 @@ TODO Minor Cleanups and Code Improvements ------------------------------------ - Put FAKE_FD_VALUE into a head included from awk.h and extension/ - dirfd.h. - - Mac OS X readline doesn't have history_list which is used from debug.c - functions do_save and serialize. - See http://ftp.samba.org/pub/unpacked/samba_3_current/source4/lib/smbreadline/readline.m4 - for some help. Reported by Larry Baker, larry.baker@stanfordalumni.org - - API: ??? #if !defined(GAWK) && !defined(GAWK_OMIT_CONVENIENCE_MACROS) @@ -66,6 +66,9 @@ /* Define to 1 if you have the `grantpt' function. */ #undef HAVE_GRANTPT +/* Do we have history_list? */ +#undef HAVE_HISTORY_LIST + /* Define if you have the iconv() function and it works. */ #undef HAVE_ICONV @@ -10462,6 +10462,50 @@ $as_echo "#define HAVE_LIBREADLINE 1" >>confdefs.h LIBREADLINE=$_combo + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for history_list in -lreadline" >&5 +$as_echo_n "checking for history_list in -lreadline... " >&6; } +if ${ac_cv_lib_readline_history_list+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lreadline $_combo $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char history_list (); +int +main () +{ +return history_list (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_readline_history_list=yes +else + ac_cv_lib_readline_history_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_history_list" >&5 +$as_echo "$ac_cv_lib_readline_history_list" >&6; } +if test "x$ac_cv_lib_readline_history_list" = xyes; then : + +$as_echo "#define HAVE_HISTORY_LIST 1" >>confdefs.h + +fi + + break fi done @@ -108,6 +108,12 @@ static BREAKPOINT breakpoints = { &breakpoints, &breakpoints, 0 }; static int sess_history_base = 0; #endif +#ifndef HAVE_HISTORY_LIST +#define HIST_ENTRY void +#define history_list() NULL +#endif + + /* 'list' command */ static int last_printed_line = 0; static int last_print_count; /* # of lines printed */ @@ -4058,7 +4064,7 @@ do_dump_instructions(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) int do_save(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) { -#ifdef HAVE_LIBREADLINE +#if defined(HAVE_LIBREADLINE) && defined(HAVE_HISTORY_LIST) FILE *fp; HIST_ENTRY **hist_list; int i; @@ -4282,11 +4288,6 @@ serialize_subscript(char *buf, int buflen, struct list_item *item) static void serialize(int type) { -#ifndef HAVE_LIBREADLINE -#define HIST_ENTRY void -#define history_list() NULL -#endif - static char *buf = NULL; static int buflen = 0; int bl; @@ -4400,7 +4401,7 @@ enlarge_buffer: cndn = &wd->cndn; break; case HISTORY: -#ifdef HAVE_LIBREADLINE +#if defined(HAVE_LIBREADLINE) && defined(HAVE_HISTORY_LIST) h = (HIST_ENTRY *) ptr; nchar = strlen(h->line); if (nchar >= buflen - bl) diff --git a/m4/ChangeLog b/m4/ChangeLog index 59ddc228..3996eb53 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,11 @@ +2013-08-29 Arnold D. Robbins <arnold@skeeve.com> + + * readline.m4: Add additional code to check for history_list() + function. Patterned after checks in: + http://ftp.samba.org/pub/unpacked/samba_3_current/source4/lib/smbreadline/readline.m4 + Thanks to Larry Baker (larry.baker@stanfordalumni.org) for the + pointer. + 2013-05-09 Arnold D. Robbins <arnold@skeeve.com> * 4.1.0: Release tar ball made. diff --git a/m4/readline.m4 b/m4/readline.m4 index 76605af8..f24e95bf 100644 --- a/m4/readline.m4 +++ b/m4/readline.m4 @@ -72,6 +72,12 @@ dnl action if cross compiling: AC_DEFINE(HAVE_LIBREADLINE,1, [Define to 1 if you have a fully functional readline library.]) AC_SUBST(LIBREADLINE,$_combo) + + AC_CHECK_LIB(readline, history_list, + [AC_DEFINE(HAVE_HISTORY_LIST, 1, [Do we have history_list?])], + [], + [$_combo]) + break fi done |