Source-Changes-HG archive

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

[src/trunk]: src/tools/compat Add test for alloca() and <alloca.h>, since Sun...



details:   https://anonhg.NetBSD.org/src/rev/8ff56214c399
branches:  trunk
changeset: 525991:8ff56214c399
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Tue Apr 23 00:13:50 2002 +0000

description:
Add test for alloca() and <alloca.h>, since Sun Workshop C 5.0 needs this.

diffstat:

 tools/compat/compat_defs.h |   14 +-
 tools/compat/config.h.in   |    3 +-
 tools/compat/configure     |  504 +++++++++++++++++++++++++++++++++++---------
 tools/compat/configure.ac  |    3 +-
 4 files changed, 413 insertions(+), 111 deletions(-)

diffs (truncated from 882 to 300 lines):

diff -r 1d5fc6b1dd11 -r 8ff56214c399 tools/compat/compat_defs.h
--- a/tools/compat/compat_defs.h        Mon Apr 22 23:40:10 2002 +0000
+++ b/tools/compat/compat_defs.h        Tue Apr 23 00:13:50 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_defs.h,v 1.13 2002/04/22 23:40:10 bjh21 Exp $   */
+/*     $NetBSD: compat_defs.h,v 1.14 2002/04/23 00:13:50 bjh21 Exp $   */
 
 #ifndef        __NETBSD_COMPAT_DEFS_H__
 #define        __NETBSD_COMPAT_DEFS_H__
@@ -355,6 +355,18 @@
 #define UINT32_MAX 0xffffffffU
 #endif
 
+/* <stdlib.h> */
+
+#ifndef __GNUC__
+# if HAVE_ALLOCA_H
+#  include <alloca.h>
+# else
+#  ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#  endif
+# endif
+#endif
+
 /* <sys/endian.h> */
 
 #ifndef HAVE_SYS_ENDIAN_H
diff -r 1d5fc6b1dd11 -r 8ff56214c399 tools/compat/config.h.in
--- a/tools/compat/config.h.in  Mon Apr 22 23:40:10 2002 +0000
+++ b/tools/compat/config.h.in  Tue Apr 23 00:13:50 2002 +0000
@@ -1,10 +1,11 @@
-/*     $NetBSD: config.h.in,v 1.16 2002/04/18 15:31:52 bjh21 Exp $     */
+/*     $NetBSD: config.h.in,v 1.17 2002/04/23 00:13:50 bjh21 Exp $     */
 
 #ifndef        __NETBSD_COMPAT_CONFIG_H__
 #define        __NETBSD_COMPAT_CONFIG_H__
 
 /* Values set by "configure" based on available functions in the host. */
 
+#undef HAVE_ALLOCA_H
 #undef HAVE_DIRENT_H
 #undef HAVE_ERR_H
 #undef HAVE_FEATURES_H
diff -r 1d5fc6b1dd11 -r 8ff56214c399 tools/compat/configure
--- a/tools/compat/configure    Mon Apr 22 23:40:10 2002 +0000
+++ b/tools/compat/configure    Tue Apr 23 00:13:50 2002 +0000
@@ -4153,116 +4153,169 @@
 fi
 
 # Library functions (where a .h check isn't enough).
-echo "$as_me:4156: checking for library containing fparseln" >&5
-echo $ECHO_N "checking for library containing fparseln... $ECHO_C" >&6
-if test "${ac_cv_search_fparseln+set}" = set; then
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments.  Useless!
+echo "$as_me:4158: checking for working alloca.h" >&5
+echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6
+if test "${ac_cv_working_alloca_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_func_search_save_LIBS=$LIBS
-ac_cv_search_fparseln=no
-cat >conftest.$ac_ext <<_ACEOF
+  cat >conftest.$ac_ext <<_ACEOF
 #line 4164 "configure"
 #include "confdefs.h"
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char fparseln ();
+#include <alloca.h>
 int
 main ()
 {
-fparseln ();
+char *p = (char *) alloca (2 * sizeof (int));
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4183: \"$ac_link\"") >&5
+if { (eval echo "$as_me:4176: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4186: \$? = $ac_status" >&5
+  echo "$as_me:4179: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:4189: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4182: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4192: \$? = $ac_status" >&5
+  echo "$as_me:4185: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_search_fparseln="none required"
+  ac_cv_working_alloca_h=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
+ac_cv_working_alloca_h=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-if test "$ac_cv_search_fparseln" = no; then
-  for ac_lib in util; do
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-    cat >conftest.$ac_ext <<_ACEOF
-#line 4204 "configure"
+fi
+echo "$as_me:4195: result: $ac_cv_working_alloca_h" >&5
+echo "${ECHO_T}$ac_cv_working_alloca_h" >&6
+if test $ac_cv_working_alloca_h = yes; then
+
+cat >>confdefs.h <<\EOF
+#define HAVE_ALLOCA_H 1
+EOF
+
+fi
+
+echo "$as_me:4205: checking for alloca" >&5
+echo $ECHO_N "checking for alloca... $ECHO_C" >&6
+if test "${ac_cv_func_alloca_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 4211 "configure"
 #include "confdefs.h"
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# else
+#  if HAVE_ALLOCA_H
+#   include <alloca.h>
+#  else
+#   ifdef _AIX
+ #pragma alloca
+#   else
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#    endif
+#   endif
+#  endif
+# endif
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char fparseln ();
+
 int
 main ()
 {
-fparseln ();
+char *p = (char *) alloca (1);
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4223: \"$ac_link\"") >&5
+if { (eval echo "$as_me:4243: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4226: \$? = $ac_status" >&5
+  echo "$as_me:4246: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:4229: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4249: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4232: \$? = $ac_status" >&5
+  echo "$as_me:4252: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_search_fparseln="-l$ac_lib"
-break
+  ac_cv_func_alloca_works=yes
 else
   echo "$as_me: failed program was:" >&5
 cat conftest.$ac_ext >&5
+ac_cv_func_alloca_works=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-  done
-fi
-LIBS=$ac_func_search_save_LIBS
-fi
-echo "$as_me:4245: result: $ac_cv_search_fparseln" >&5
-echo "${ECHO_T}$ac_cv_search_fparseln" >&6
-if test "$ac_cv_search_fparseln" != no; then
-  test "$ac_cv_search_fparseln" = "none required" || LIBS="$ac_cv_search_fparseln $LIBS"
-
-fi
-
-for ac_func in asprintf asnprintf basename dirfd dirname \
-       fgetln flock fparseln futimes getopt getopt_long \
-       isblank issetugid lchmod lchown lutimes pread pwcache_userdb \
-       pwrite setenv setgroupent setprogname setpassent \
-       snprintf strlcat strlcpy strsep vasprintf vasnprintf vsnprintf
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:4259: checking for $ac_func" >&5
+fi
+echo "$as_me:4262: result: $ac_cv_func_alloca_works" >&5
+echo "${ECHO_T}$ac_cv_func_alloca_works" >&6
+
+if test $ac_cv_func_alloca_works = yes; then
+
+cat >>confdefs.h <<\EOF
+#define HAVE_ALLOCA 1
+EOF
+
+else
+  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+# that cause trouble.  Some versions do not even contain alloca or
+# contain a buggy version.  If you still want to use their alloca,
+# use ar to extract alloca.o from them instead of compiling alloca.c.
+
+ALLOCA=alloca.$ac_objext
+
+cat >>confdefs.h <<\EOF
+#define C_ALLOCA 1
+EOF
+
+echo "$as_me:4283: checking whether \`alloca.c' needs Cray hooks" >&5
+echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6
+if test "${ac_cv_os_cray+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line 4289 "configure"
+#include "confdefs.h"
+#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "webecray" >/dev/null 2>&1; then
+  ac_cv_os_cray=yes
+else
+  ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+echo "$as_me:4307: result: $ac_cv_os_cray" >&5
+echo "${ECHO_T}$ac_cv_os_cray" >&6
+if test $ac_cv_os_cray = yes; then
+  for ac_func in _getb67 GETB67 getb67; do
+    as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:4312: checking for $ac_func" >&5
 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
 if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 4265 "configure"
+#line 4318 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.  */
@@ -4293,16 +4346,16 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4296: \"$ac_link\"") >&5
+if { (eval echo "$as_me:4349: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4299: \$? = $ac_status" >&5
+  echo "$as_me:4352: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:4302: \"$ac_try\"") >&5
+  { (eval echo "$as_me:4355: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4305: \$? = $ac_status" >&5
+  echo "$as_me:4358: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   eval "$as_ac_var=yes"
 else
@@ -4312,7 +4365,241 @@
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext



Home | Main Index | Thread Index | Old Index