This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
PATCH for libiberty and systems providing sysconf but no _SC_PAGESIZE
- To: egcs-bugs at cygnus dot com
- Subject: PATCH for libiberty and systems providing sysconf but no _SC_PAGESIZE
- From: Manfred Hollstein <manfred at s-direktnet dot de>
- Date: Wed, 20 May 1998 12:37:17 +0200 (MET DST)
- Reply-To: manfred at s-direktnet dot de, Manfred dot Hollstein at ks dot sel dot alcatel dot de
configure defines HAVE_SYSCONF on my m88k-motorola-sysv; but unistd.h
fails to define the _SC_PAGESIZE macro. This patch add a fix for it; it
contains the additional check for unistd.h as someone else already
suggested.
manfred
Wed May 20 11:55:11 1998 Manfred Hollstein <manfred@s-direktnet.de>
* configure.in: Check for unistd.h as well.
* configure: Rebuild.
* config.in: Rebuild.
* getpagesize.c (GNU_OUR_PAGESIZE): Use sysconf only if _SC_PAGESIZE
is defined in unistd.h. Reformat conditional block for easier reading.
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19980520.orig/libiberty/configure.in egcs-19980520/libiberty/configure.in
--- egcs-19980520.orig/libiberty/configure.in Mon May 18 14:03:03 1998
+++ egcs-19980520/libiberty/configure.in Mon May 18 14:03:03 1998
@@ -104,7 +104,7 @@ AC_SUBST_FILE(host_makefile_frag)
# It's OK to check for header files. Although the compiler may not be
# able to link anything, it had better be able to at least compile
# something.
-AC_CHECK_HEADERS(sys/file.h sys/param.h stdlib.h string.h)
+AC_CHECK_HEADERS(sys/file.h sys/param.h stdlib.h string.h unistd.h)
# This is the list of functions which libiberty will provide if they
# are not available on the host.
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19980520.orig/libiberty/configure egcs-19980520/libiberty/configure
--- egcs-19980520.orig/libiberty/configure Sat May 16 08:21:02 1998
+++ egcs-19980520/libiberty/configure Sat May 16 08:21:02 1998
@@ -1019,7 +1019,7 @@ else
fi
echo "$ac_t""$CPP" 1>&6
-for ac_hdr in sys/file.h sys/param.h stdlib.h string.h
+for ac_hdr in sys/file.h sys/param.h stdlib.h string.h unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19980520.orig/libiberty/config.in egcs-19980520/libiberty/config.in
--- egcs-19980520.orig/libiberty/config.in Sat May 16 08:21:02 1998
+++ egcs-19980520/libiberty/config.in Sat May 16 08:21:02 1998
@@ -186,3 +186,6 @@
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19980520.orig/libiberty/getpagesize.c egcs-19980520/libiberty/getpagesize.c
--- egcs-19980520.orig/libiberty/getpagesize.c Mon May 18 14:05:25 1998
+++ egcs-19980520/libiberty/getpagesize.c Wed May 20 12:06:10 1998
@@ -35,31 +35,36 @@ BUGS
#include <sys/param.h>
#endif
-#ifdef HAVE_SYSCONF
+#undef GNU_OUR_PAGESIZE
+#if defined (HAVE_SYSCONF) && defined (HAVE_UNISTD_H)
#include <unistd.h>
+#ifdef _SC_PAGESIZE
#define GNU_OUR_PAGESIZE sysconf(_SC_PAGESIZE)
-#else
-#ifdef PAGESIZE
-#define GNU_OUR_PAGESIZE PAGESIZE
-#else /* no PAGESIZE */
-#ifdef EXEC_PAGESIZE
-#define GNU_OUR_PAGESIZE EXEC_PAGESIZE
-#else /* no EXEC_PAGESIZE */
-#ifdef NBPG
-#define GNU_OUR_PAGESIZE (NBPG * CLSIZE)
-#ifndef CLSIZE
-#define CLSIZE 1
-#endif /* CLSIZE */
-#else /* no NBPG */
-#ifdef NBPC
-#define GNU_OUR_PAGESIZE NBPC
-#else /* no NBPC */
-#define GNU_OUR_PAGESIZE 4096 /* Just punt and use reasonable value */
-#endif /* NBPC */
-#endif /* NBPG */
-#endif /* EXEC_PAGESIZE */
-#endif /* PAGESIZE */
-#endif /* HAVE_SYSCONF */
+#endif
+#endif
+
+#ifndef GNU_OUR_PAGESIZE
+# ifdef PAGESIZE
+# define GNU_OUR_PAGESIZE PAGESIZE
+# else /* no PAGESIZE */
+# ifdef EXEC_PAGESIZE
+# define GNU_OUR_PAGESIZE EXEC_PAGESIZE
+# else /* no EXEC_PAGESIZE */
+# ifdef NBPG
+# define GNU_OUR_PAGESIZE (NBPG * CLSIZE)
+# ifndef CLSIZE
+# define CLSIZE 1
+# endif /* CLSIZE */
+# else /* no NBPG */
+# ifdef NBPC
+# define GNU_OUR_PAGESIZE NBPC
+# else /* no NBPC */
+# define GNU_OUR_PAGESIZE 4096 /* Just punt and use reasonable value */
+# endif /* NBPC */
+# endif /* NBPG */
+# endif /* EXEC_PAGESIZE */
+# endif /* PAGESIZE */
+#endif /* GNU_OUR_PAGESIZE */
int
getpagesize ()