about summary refs log tree commit diff
path: root/sysdeps/unix/common
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/common')
-rw-r--r--sysdeps/unix/common/Dist1
-rw-r--r--sysdeps/unix/common/Makefile35
-rwxr-xr-xsysdeps/unix/common/configure195
-rw-r--r--sysdeps/unix/common/configure.in21
-rw-r--r--sysdeps/unix/common/glue-ctype.c91
5 files changed, 343 insertions, 0 deletions
diff --git a/sysdeps/unix/common/Dist b/sysdeps/unix/common/Dist
new file mode 100644
index 0000000000..0c47cabcfa
--- /dev/null
+++ b/sysdeps/unix/common/Dist
@@ -0,0 +1 @@
+glue-ctype.c
diff --git a/sysdeps/unix/common/Makefile b/sysdeps/unix/common/Makefile
new file mode 100644
index 0000000000..ea3a8d58f2
--- /dev/null
+++ b/sysdeps/unix/common/Makefile
@@ -0,0 +1,35 @@
+# Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307 USA.
+
+ifndef inhibit-glue
+ifeq ($(subdir),ctype)
+
+sysdep_routines := $(sysdep_routines) ctype-glue
+
+generated := $(generated) glue-ctype ctype-glue.c
+
+$(objpfx)ctype-glue.c: $(objpfx)glue-ctype
+	@rm -f $@
+	$(dir $<)$(notdir $<) > $@-t
+	mv $@-t $@
+
+$(objpfx)glue-ctype: $(sysdep_dir)/unix/common/glue-ctype.c
+	$(native-compile)
+
+endif
+endif
diff --git a/sysdeps/unix/common/configure b/sysdeps/unix/common/configure
new file mode 100755
index 0000000000..7bbc9cb2e5
--- /dev/null
+++ b/sysdeps/unix/common/configure
@@ -0,0 +1,195 @@
+# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
+
+if test -z "$inhibit_glue"; then
+
+# Find out what this system calls `sys_siglist'.
+
+echo "$as_me:$LINENO: checking for sys_siglist" >&5
+echo $ECHO_N "checking for sys_siglist... $ECHO_C" >&6
+if test "${ac_cv_check_symbol_sys_siglist+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+extern char *sys_siglist[]; puts(*sys_siglist);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  	    ac_cv_check_symbol_sys_siglist=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_check_symbol_sys_siglist=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+
+if test "$ac_cv_check_symbol_sys_siglist" = yes; then
+  ac_tr_symbol=`echo sys_siglist | tr '[a-z]' '[A-Z]'`
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_${ac_tr_symbol} 1
+_ACEOF
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_check_symbol_sys_siglist" >&5
+echo "${ECHO_T}$ac_cv_check_symbol_sys_siglist" >&6
+echo "$as_me:$LINENO: checking for _sys_siglist" >&5
+echo $ECHO_N "checking for _sys_siglist... $ECHO_C" >&6
+if test "${ac_cv_check_symbol__sys_siglist+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+extern char *_sys_siglist[]; puts(*_sys_siglist);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  	    ac_cv_check_symbol__sys_siglist=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_check_symbol__sys_siglist=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+
+if test "$ac_cv_check_symbol__sys_siglist" = yes; then
+  ac_tr_symbol=`echo _sys_siglist | tr '[a-z]' '[A-Z]'`
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_${ac_tr_symbol} 1
+_ACEOF
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_check_symbol__sys_siglist" >&5
+echo "${ECHO_T}$ac_cv_check_symbol__sys_siglist" >&6
+
+# Find out the name of the table the system's <ctype.h> uses for character
+# classification.  This is used by sysdeps/unix/common/glue-ctype.c.
+echo "$as_me:$LINENO: checking ctype array name for glue" >&5
+echo $ECHO_N "checking ctype array name for glue... $ECHO_C" >&6
+if test "${libc_cv_ctype_glue+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  for ctype in _ctype_ __ctype_ __ctype _ctype__ _ctype _locp; do
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+int
+main ()
+{
+$ctype[13];
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  libc_cv_ctype_glue="$ctype"; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+done
+fi
+
+echo "$as_me:$LINENO: result: $libc_cv_ctype_glue" >&5
+echo "${ECHO_T}$libc_cv_ctype_glue" >&6
+cat >>confdefs.h <<_ACEOF
+#define HAVE_`echo $libc_cv_ctype_glue | tr 'a-z' 'A-Z'` 1
+_ACEOF
+
+
+fi
diff --git a/sysdeps/unix/common/configure.in b/sysdeps/unix/common/configure.in
new file mode 100644
index 0000000000..9597d68f3d
--- /dev/null
+++ b/sysdeps/unix/common/configure.in
@@ -0,0 +1,21 @@
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+
+if test -z "$inhibit_glue"; then
+
+# Find out what this system calls `sys_siglist'.
+AC_CHECK_SYMBOL(sys_siglist)
+AC_CHECK_SYMBOL(_sys_siglist)
+
+# Find out the name of the table the system's <ctype.h> uses for character
+# classification.  This is used by sysdeps/unix/common/glue-ctype.c.
+AC_MSG_CHECKING(ctype array name for glue)
+AC_CACHE_VAL(libc_cv_ctype_glue, [dnl
+for ctype in _ctype_ __ctype_ __ctype _ctype__ _ctype _locp; do
+AC_TRY_LINK([#include <ctype.h>],
+	    [$ctype[13];],
+	    [libc_cv_ctype_glue="$ctype"; break])
+done])
+AC_MSG_RESULT($libc_cv_ctype_glue)
+AC_DEFINE_UNQUOTED(HAVE_`echo $libc_cv_ctype_glue | tr '[a-z]' '[A-Z]'`)
+
+fi
diff --git a/sysdeps/unix/common/glue-ctype.c b/sysdeps/unix/common/glue-ctype.c
new file mode 100644
index 0000000000..2e065a77c9
--- /dev/null
+++ b/sysdeps/unix/common/glue-ctype.c
@@ -0,0 +1,91 @@
+/* Copyright (C) 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Different systems have different names for the array.
+   This order is important for some systems.  */
+
+#if !defined(TABLE) && defined(HAVE__LOCP)
+/* OSF/1 has the name _ctype defined as a macro, which points down into
+   the _locp structure.  Jesus.  We'll hope this works.  We need to
+   check for LOCP first, since there is no symbol actually named _ctype
+   in their library.  */
+#include <sys/types.h> /* for wchar_t used by localdef.h */
+#include <sys/localedef.h>
+extern loc_t *_locp;
+#define TABLE		(_locp->lc_chrtbl)->lc_ctype
+#undef _ctype
+#define TABLE_NAME	_ctype
+#endif
+#ifdef	HAVE__CTYPE__
+#define	TABLE	_ctype__
+#endif
+#if !defined(TABLE) && defined(HAVE__CTYPE)
+#define TABLE   _ctype
+#endif
+#if !defined(TABLE) && defined(HAVE__CTYPE_)
+#define	TABLE	_ctype_
+#endif
+#if !defined(TABLE) && defined(HAVE___CTYPE_)
+#define	TABLE	__ctype_
+#endif
+#if !defined(TABLE) && defined(HAVE___CTYPE)
+#define	TABLE	__ctype
+#endif
+
+#if defined (__STDC__) && __STDC__
+#define	STRINGIFY(arg)	#arg
+#else
+#define	STRINGIFY(arg)	"arg"
+#endif
+
+#define EVALLED_STRINGIFY(x)	STRINGIFY (x)
+
+int
+main ()
+{
+#ifdef TABLE
+
+  int i;
+
+#ifndef HAVE__LOCP
+  /* This won't work for the define to look into _locp.  */
+  extern unsigned char TABLE[];
+#endif
+
+#ifdef TABLE_NAME
+  printf ("const unsigned char %s[] =\n  {\n", EVALLED_STRINGIFY (TABLE_NAME));
+#else
+  printf ("const unsigned char %s[] =\n  {\n", EVALLED_STRINGIFY (TABLE));
+#endif
+
+  for (i = -1; i < 256; ++i)
+    printf ("    %d,\n", (int) ((TABLE+1)[i]));
+
+  puts ("  };");
+
+#else
+
+  puts ("/* I don't know what the ctype table is called on this system.");
+  puts ("   If there is a table, and you want the ctype glue to work,");
+  puts ("   edit configure.in and glue-ctype.c in sysdeps/unix/common/");
+  puts ("   to check for the right name.  */");
+
+#endif
+
+  exit (0);
+}