Do not use libiberty's getpagesize on Android
authorJoel Brobecker <brobecker@adacore.com>
Fri, 6 Nov 2015 21:39:19 +0000 (13:39 -0800)
committerJoel Brobecker <brobecker@adacore.com>
Fri, 6 Nov 2015 21:39:58 +0000 (13:39 -0800)
Building libiberty on Android currently fails with the error message
shown below.  This was discovered by trying to build GDBserver
for Android, which stopped building after libiberty became
a GDBserver dependency.

Here is the error message:

[...]/getpagesize.c:64:1: error: redefinition of 'getpagesize'
In file included from /[...]/getpagesize.c:34:0:
/[...]/usr/include/unistd.h:171:23: note: previous definition of 'getpagesize' was here

And looking at the definition, one can see that it defined as
a static inline function...

   static __inline__ int getpagesize(void) {
     extern unsigned int __page_size;
     return __page_size;
   }

... which explains why the AC_CHECK_FUNCS test failed to detect
the function, since there is no associated symbol to be linked in.

This patch prevents getpagesize.c to be compiled in by hard-coding
the fact that getpagesize is available on android hosts.

libiberty/ChangeLog:

        * configure.ac: Set AC_CV_FUNC_GETPAGESIZE to "yes" on
        Android hosts.
        * configure: Regenerate.

libiberty/ChangeLog
libiberty/configure
libiberty/configure.ac

index 5b9a8cf2d9c3fa9ea5638fb0f6a78b9903814de5..0688ba8c58ea65409a2190086f9703891ab97824 100644 (file)
@@ -1,3 +1,9 @@
+2015-11-06  Joel Brobecker  <brobecker@adacore.com>
+
+       * configure.ac: Set AC_CV_FUNC_GETPAGESIZE to "yes" on
+       Android hosts.
+       * configure: Regenerate.
+
 2015-09-30  Nick Clifton  <nickc@redhat.com>
 
        Import the following patches from the GCC mainline:
index d8890a11de77d9a10815919f812f9361a0e953bb..720dc5e80beb936f3d08d593955727ca13e34f4d 100755 (executable)
@@ -6248,6 +6248,12 @@ if test -z "${setobjs}"; then
 
   case "${host}" in
 
+  *-*-android*)
+    # On android, getpagesize is defined in unistd.h as a static inline
+    # function, which AC_CHECK_FUNCS does not handle properly.
+    ac_cv_func_getpagesize=yes
+    ;;
+
   *-*-mingw32*)
     # Under mingw32, sys_nerr and sys_errlist exist, but they are
     # macros, so the test below won't find them.
index 868be8e72d1a969f94339042c98233d353d30b4c..e21e3aa5809b12f0616d376c69608fc5c941dbd4 100644 (file)
@@ -600,6 +600,12 @@ if test -z "${setobjs}"; then
 
   case "${host}" in
 
+  *-*-android*)
+    # On android, getpagesize is defined in unistd.h as a static inline
+    # function, which AC_CHECK_FUNCS does not handle properly.
+    ac_cv_func_getpagesize=yes
+    ;;
+
   *-*-mingw32*)
     # Under mingw32, sys_nerr and sys_errlist exist, but they are
     # macros, so the test below won't find them.
This page took 0.030918 seconds and 4 git commands to generate.