bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Building 64-bit version of ncurses on Solaris 8


From: Albert Chin
Subject: Re: Building 64-bit version of ncurses on Solaris 8
Date: Sat, 2 Feb 2002 01:23:26 -0600
User-agent: Mutt/1.2.5i

On Fri, Feb 01, 2002 at 07:41:45PM -0600, Albert Chin wrote:
> On Fri, Feb 01, 2002 at 08:09:38PM -0500, Thomas Dickey wrote:
> > If it's too inconvenient, I'll rewrite it.  (I don't know offhand why
> > it should need the math library, since the ordinary floating-point
> > stuff is adequate for sscanf's conversions - but it's something to
> > keep in mind).
> 
> I think it needs the math libraries because it implements more than
> just sscanf.
> 
> Ok, here's the first iteration of the patch. I am excluding the trio
> files for now as I want to make sure everything is OK with you first.
> BTW, how do I test the replacement vsscanf function?
> 
> I've done a test build on Solaris 8/SPARC 32-bit and 64-bit. The
> 64-bit failed in the test directory (because we're using cc to link in
> the test directory, we should link with $CCFLAGS to get -xarch=v9).
> No runtime testing though.

Here's iteration #2.

-- 
albert chin (address@hidden)

-- snip snip
--- ncurses/base/vsscanf.c.orig Fri Feb  1 15:35:26 2002
+++ ncurses/base/vsscanf.c      Fri Feb  1 15:51:13 2002
@@ -34,37 +34,16 @@
 
 #if !HAVE_VSSCANF
 
+#include "trio.h"
+
 MODULE_ID("$Id: vsscanf.c,v 1.14 2001/12/08 20:12:35 tom Exp $")
 
 /*VARARGS2*/
 NCURSES_EXPORT(int)
 vsscanf(const char *str, const char *format, va_list ap)
 {
-#if HAVE_VFSCANF || HAVE__DOSCAN
-    /*
-     * This code should work on anything descended from AT&T SVr1.
-     */
-    FILE strbuf;
-
-    strbuf._flag = _IOREAD;
-    strbuf._ptr = strbuf._base = (unsigned char *) str;
-    strbuf._cnt = strlen(str);
-    strbuf._file = _NFILE;
-
-#if HAVE_VFSCANF
-    return (vfscanf(&strbuf, format, ap));
-#else
-    return (_doscan(&strbuf, format, ap));
-#endif
-#else
-    /*
-     * You don't have a native vsscanf(3), and you don't have System-V
-     * compatible stdio internals.  You're probably using a BSD
-     * older than 4.4 or a really old Linux.  You lose.  Upgrade
-     * to a current C library to win.
-     */
-    return -1;                 /* not implemented */
-#endif
+    /* Emulate with trio function */
+    trio_vsscanf(str, format, ap);
 }
 #else
 extern
--- ncurses/modules.orig        Fri Feb  1 18:06:12 2002
+++ ncurses/modules     Fri Feb  1 18:22:10 2002
@@ -114,6 +114,11 @@
 tty_update     lib             $(serial)       ../include/term.h
 varargs                lib             $(trace)
 
+# trio libraries
+trio           lib             $(base)
+trionan                lib             $(base)
+triostr                lib             $(base)
+
 # Modules for porting
 memmove                lib             $(base)
 sigaction      lib             $(base)
--- ncurses/Makefile.in.orig    Fri Feb  1 20:30:26 2002
+++ ncurses/Makefile.in Fri Feb  1 20:30:40 2002
@@ -102,6 +102,7 @@
 
 LINK           = $(LIBTOOL) $(CC)
 LDFLAGS                = @LDFLAGS@ @LD_MODEL@ @LIBS@
+TRIO_DEP_LIBS  = @TRIO_DEP_LIBS@
 
 SHLIB_DIRS     = -L../lib
 SHLIB_LIST     = $(SHLIB_DIRS) @SHLIB_LIST@
--- test/Makefile.in.orig       Fri Feb  1 19:44:08 2002
+++ test/Makefile.in    Fri Feb  1 19:44:15 2002
@@ -69,7 +69,7 @@
 MATH_LIB       = @MATH_LIB@
 
 LD             = @LD@
-LINK           = @LINK_TESTS@ $(LIBTOOL) $(CC)
+LINK           = @LINK_TESTS@ $(LIBTOOL) $(CC) $(CFLAGS)
 
 LDFLAGS                = @LD_MODEL@ @TEST_ARGS@ @LIBS@ @EXTRA_LIBS@ 
@LOCAL_LDFLAGS@ @LDFLAGS@
 
--- configure.in.orig   Fri Feb  1 15:41:54 2002
+++ configure.in        Fri Feb  1 21:18:05 2002
@@ -977,25 +977,33 @@
 strstr \
 tcgetpgrp \
 times \
-vsnprintf \
 )
 if test "$with_getcap" = "yes" ; then
        CF_CGETENT
 fi
 
+# add replacements for vsnprintf and vsscanf if not found
+AC_CHECK_FUNCS(vsnprintf,[
+  AC_DEFINE(HAVE_VSNPRINTF)
+  AC_CHECK_FUNCS(vsscanf,[
+    HAVE_VSSCANF=1],[
+    HAVE_VSSCANF=0
+    AC_DEFINE_UNQUOTED(NEED_TRIO, 1,
+      [Define if we need the trio replacement *printf() functions])
+    AC_CHECK_FUNC(fabs, , AC_CHECK_LIB(m, fabs,
+      TRIO_DEP_LIBS="-lm"))])],[
+  HAVE_VSSCANF=0
+  AC_DEFINE_UNQUOTED(NEED_TRIO, 1,
+    [Define if we need the trio replacement *printf() functions])
+  AC_CHECK_FUNC(fabs, , AC_CHECK_LIB(m, fabs,
+    TRIO_DEP_LIBS="-lm"))])
+AC_SUBST(HAVE_VSSCANF)
+AC_SUBST(TRIO_DEP_LIBS)
+
 CF_ISASCII
 CF_STRUCT_SIGACTION
 CF_FUNC_TERMIOS
-CF_FUNC_VSSCANF
 CF_MKSTEMP
-
-# setup for prototype of fallback for vsscanf()
-if test "$cf_cv_func_vsscanf" = vsscanf ; then
-       HAVE_VSSCANF=1
-else
-       HAVE_VSSCANF=0
-fi
-AC_SUBST(HAVE_VSSCANF)
 
 dnl FIXME (may need this) AC_SYS_RESTARTABLE_SYSCALLS
 if test "$cross_compiling" = yes ; then
--- aclocal.m4.orig     Fri Feb  1 16:14:04 2002
+++ aclocal.m4  Fri Feb  1 20:34:31 2002
@@ -651,49 +651,6 @@
 test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl Check for vsscanf() function, which is in c9x but generally not in earlier
-dnl versions of C.  It is in the GNU C library, and can often be simulated by
-dnl other functions.
-AC_DEFUN([CF_FUNC_VSSCANF],
-[
-AC_CACHE_CHECK(for vsscanf function or workaround,cf_cv_func_vsscanf,[
-AC_TRY_LINK([
-#include <stdarg.h>
-#include <stdio.h>],[
-       va_list ap;
-       vsscanf("from", "%d", ap)],[cf_cv_func_vsscanf=vsscanf],[
-AC_TRY_LINK([
-#include <stdarg.h>
-#include <stdio.h>],[
-    FILE strbuf;
-    char *str = "from";
-
-    strbuf._flag = _IOREAD;
-    strbuf._ptr = strbuf._base = (unsigned char *) str;
-    strbuf._cnt = strlen(str);
-    strbuf._file = _NFILE;
-    return (vfscanf(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=vfscanf],[
-AC_TRY_LINK([
-#include <stdarg.h>
-#include <stdio.h>],[
-    FILE strbuf;
-    char *str = "from";
-
-    strbuf._flag = _IOREAD;
-    strbuf._ptr = strbuf._base = (unsigned char *) str;
-    strbuf._cnt = strlen(str);
-    strbuf._file = _NFILE;
-    return (_doscan(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=_doscan],[
-cf_cv_func_vsscanf=no])])])])
-
-case $cf_cv_func_vsscanf in #(vi
-vsscanf) AC_DEFINE(HAVE_VSSCANF);; #(vi
-vfscanf) AC_DEFINE(HAVE_VFSCANF);; #(vi
-_doscan) AC_DEFINE(HAVE__DOSCAN);;
-esac
-
-])dnl
-dnl ---------------------------------------------------------------------------
 dnl Test for availability of useful gcc __attribute__ directives to quiet
 dnl compiler warnings.  Though useful, not all are supported -- and contrary
 dnl to documentation, unrecognized directives cause older compilers to barf.
@@ -2284,8 +2241,13 @@
                ;;
        irix*)
                if test "$cf_cv_ld_rpath" = yes ; then
-                       cf_ld_rpath_opt="-Wl,-rpath,"
-                       EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS"
+                       if test "$GCC" != yes; then
+                               cf_ld_rpath_opt="-rpath "
+                               EXTRA_LDFLAGS="-rpath \$(libdir) $EXTRA_LDFLAGS"
+                       else
+                               cf_ld_rpath_opt="-Wl,-rpath,"
+                               EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) 
$EXTRA_LDFLAGS"
+                       fi
                fi
                # tested with IRIX 5.2 and 'cc'.
                if test "$GCC" != yes; then
--- mk-1st.awk.orig     Fri Feb  1 18:48:42 2002
+++ mk-1st.awk  Fri Feb  1 20:31:49 2002
@@ -195,7 +195,7 @@
                                if ( subset == "termlib") {
                                        printf "\t$(MK_SHARED_LIB) $(%s_OBJS) 
$(TINFO_LIST)\n", OBJS
                                } else {
-                                       printf "\t$(MK_SHARED_LIB) $(%s_OBJS) 
$(SHLIB_LIST)\n", OBJS
+                                       printf "\t$(MK_SHARED_LIB) $(%s_OBJS) 
$(SHLIB_LIST) $(TRIO_DEP_LIBS)\n", OBJS
                                }
                                sharedlinks("../lib")
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]