[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Problem in installing gawk on OS X 10.8.4 (Mountain Lion)
From: |
Aharon Robbins |
Subject: |
Re: [bug-gawk] Problem in installing gawk on OS X 10.8.4 (Mountain Lion) |
Date: |
Thu, 29 Aug 2013 09:47:41 +0300 |
User-agent: |
Heirloom mailx 12.5 6/20/10 |
Hi.
Here is an updated patch that I think will do the trick.
make distclean
git reset --hard
patch -p1 < this-patch
./bootstrap.sh && ./configure && make && make check
Please let me know how it goes.
Thanks,
Arnold
> Date: Wed, 28 Aug 2013 07:12:06 +0200
> From: Hermann Peifer <address@hidden>
> To: address@hidden
> Subject: Re: [bug-gawk] Problem in installing gawk on OS X 10.8.4 (Mountain
> Lion)
>
> > I think this patch will do the trick. You should should do 'make
> > distclean', then apply the patch. Then touch configh.in and configure
> > after applying it in the hope that the auto* machinery won't kick in. Then
> > run configure and rebuild.
> >
> > Please let me know if this works.
> >
>
> Hi,
>
> I applied the patch on OS X 10.7.5 and ended up with a compilation
> error. The steps are listed below.
>
> Hope this helps, Hermann
>
> $ git clone git://git.savannah.gnu.org/gawk.git gawk2
> Cloning into 'gawk2'...
> ...
>
> $ cd gawk2/
>
> $ patch -p1 < ../history_list.patch
> patching file configh.in
> patching file configure
> patching file debug.c
> patching file m4/readline.m4
>
> $ ./bootstrap.sh && ./configure && make
> ...
> gcc -DDEFPATH='".:/usr/local/share/awk"'
> -DDEFLIBPATH="\"/usr/local/lib/gawk\"" -DSHLIBEXT="\"so"\"
> -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR='"/usr/local/share/locale"' -I.
> -g -O2 -DNDEBUG -MT debug.o -MD -MP -MF .deps/debug.Tpo -c -o debug.o
> debug.c
> debug.c: In function ?do_save?:
> debug.c:4082: warning: dereferencing ?void *? pointer
> debug.c:4082: error: request for member ?line? in something not a
> structure or union
> debug.c: In function ?serialize?:
> debug.c:4406: warning: dereferencing ?void *? pointer
> debug.c:4406: error: request for member ?line? in something not a
> structure or union
> debug.c:4409: warning: dereferencing ?void *? pointer
> debug.c:4409: error: request for member ?line? in something not a
> structure or union
> debug.c:4409: warning: dereferencing ?void *? pointer
> debug.c:4409: error: request for member ?line? in something not a
> structure or union
> make[2]: *** [debug.o] Error 1
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
-------------------- cut here --------------------------
diff --git a/configh.in b/configh.in
index f6540a4..a535fd4 100644
--- a/configh.in
+++ b/configh.in
@@ -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
diff --git a/configure b/configure
index 0e5a930..03e0838 100755
--- a/configure
+++ b/configure
@@ -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
diff --git a/debug.c b/debug.c
index 29500f2..949ebb4 100644
--- a/debug.c
+++ b/debug.c
@@ -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/readline.m4 b/m4/readline.m4
index 76605af..f24e95b 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