libctf: add linking of the variable section
[deliverable/binutils-gdb.git] / libctf / configure.ac
index 2df10935c05b82ad8675a4bfc7e48442d13f1fb6..2a1a80b7ecbb667f56dbc40293e73c788dc25d58 100644 (file)
@@ -56,6 +56,7 @@ ACX_PROG_CC_WARNING_OPTS([-Wall], [ac_libctf_warn_cflags])
 
 AC_FUNC_MMAP
 AC_SEARCH_LIBS(dlopen, dl)
+AM_ZLIB
 
 # Similar to GDB_AC_CHECK_BFD.
 OLD_CFLAGS=$CFLAGS
@@ -86,9 +87,68 @@ if test $ac_cv_libctf_bfd_elf = yes; then
            [Whether libbfd was configured for an ELF target.])
 fi
 
-AC_CHECK_HEADERS(byteswap.h)
+AC_C_BIGENDIAN
+AC_CHECK_HEADERS(byteswap.h endian.h)
 AC_CHECK_FUNCS(pread)
 
+dnl Check for qsort_r.  (Taken from gnulib.)
+AC_CHECK_FUNCS_ONCE([qsort_r])
+if test $ac_cv_func_qsort_r = yes; then
+  AC_CACHE_CHECK([for qsort_r signature], [ac_cv_libctf_qsort_r_signature],
+    [AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM([[#undef qsort_r
+                          #include <stdlib.h>
+                          void qsort_r (void *, size_t, size_t,
+                                        int (*) (void const *, void const *,
+                                                 void *),
+                                        void *);
+                          void (*p) (void *, size_t, size_t,
+                                     int (*) (void const *, void const *,
+                                              void *),
+                                     void *) = qsort_r;
+                        ]])],
+       [ac_cv_libctf_qsort_r_signature=GNU],
+       [AC_LINK_IFELSE(
+          [AC_LANG_PROGRAM([[#undef qsort_r
+                            #include <stdlib.h>
+                             void qsort_r (void *, size_t, size_t, void *,
+                                           int (*) (void *,
+                                                    void const *,
+                                                    void const *));
+                             void (*p) (void *, size_t, size_t, void *,
+                                        int (*) (void *, void const *,
+                                                 void const *)) = qsort_r;
+                           ]])],
+          [ac_cv_libctf_qsort_r_signature=BSD],
+          [ac_cv_libctf_qsort_r_signature=unknown])])])
+fi
+
+case x$ac_cv_libctf_qsort_r_signature in
+  xGNU)     AC_DEFINE([HAVE_QSORT_R_ARG_LAST], 1,
+            [Whether a qsort_r exists with a void *arg as its last arg.]);;
+  xBSD)     AC_DEFINE([HAVE_QSORT_R_COMPAR_LAST], 1,
+            [Whether a qsort_r exists with the compar function as its last arg.]);;
+  *) ac_cv_libctf_qsort_r_signature=unknown;;
+esac
+
+AM_CONDITIONAL(NEED_CTF_QSORT_R, test "${ac_cv_libctf_qsort_r_signature}" = unknown)
+
+AC_CACHE_CHECK([for O_CLOEXEC], [ac_cv_libctf_macro_O_CLOEXEC],
+  [AC_LINK_IFELSE(
+    [AC_LANG_PROGRAM([[#include <fcntl.h>
+                       #ifndef O_CLOEXEC
+                         choke me;
+                       #endif
+                     ]],
+                     [[return O_CLOEXEC;]])],
+    [ac_cv_libctf_macro_O_CLOEXEC=yes],
+    [ac_cv_libctf_macro_O_CLOEXEC=no])])
+
+if test $ac_cv_libctf_macro_O_CLOEXEC = yes; then
+  AC_DEFINE([HAVE_O_CLOEXEC], 1,
+           [Whether the platform has a definition of O_CLOEXEC.])
+fi
+
 AC_CONFIG_FILES(Makefile)
 AC_CONFIG_HEADERS(config.h)
 AC_OUTPUT
This page took 0.038235 seconds and 4 git commands to generate.