Amazing the difference a paren can make, including fix my last commit.
[sxemacs] / m4 / sxe-libc.m4
index a8aa1fb..30a351f 100644 (file)
@@ -51,6 +51,7 @@ AC_DEFUN([SXE_CHECK_LIBC], [dnl
        if test "$have_glibc" = "yes"; then
                AC_DEFINE([_GNU_SOURCE], [1],
                        [Enable GNU extensions on systems that have them.])
+               AC_DEFINE([HAVE_GLIBC], [1], [Define if libc is glibc])
                AH_VERBATIM([_ALL_SOURCE], [dnl
                        /* WTF?! */
                        #ifndef _ALL_SOURCE
@@ -120,69 +121,54 @@ AC_DEFUN([SXE_CHECK_LIBC_VERSION], [dnl
        libc_version=""
        AC_MSG_CHECKING(for standard C library version information)
 
-       case "$ac_cv_build" in
-       *-*-linux*)
-               dnl #### who would ever _not_ be running the distro's libc?
-               dnl Whose silly question is this? -hroptatyr
-               dnl Maybe it would be better to get/augment this info with ldd?
-               if test -f /etc/redhat-release ; then
-                       libc_version=`rpm -q glibc`
-               elif test -f /etc/debian_version ; then
-                       libc_version=`dpkg-query --showformat='${version}' --show libc6`
-                       libc_version="GNU libc $libc_version (Debian)"
-               elif test -f /etc/slackware-version ; then
-                       slackver=`cat /etc/slackware-version`
-                       libc_version=`/lib/libc.so.6|head -1|cut -d ' ' -f7|tr -d ,`
-                       if test "x$libc_version" = "x"; then
-                               libc_version=`/lib64/libc.so.6|head -1|cut -d ' ' -f7|tr -d ,`
-                       fi
-                       libc_version="GNU libc $libc_version ($slackver)"
-               dnl need SuSE et al checks here...
-               fi
-               dnl #### Tested on Debian, does this actually work elsewhere?  ;-)
-               dnl #### NO! -hroptatyr
-               dnl if test -z "$libc_version"; then
-               dnl   libc_version=`ls /lib/libc-*.so | sed -e 's,/lib/libc-\(.*\)\.so,\1,'`
-               dnl fi
-
-               if test -z "$libc_version"; then
+       if test "$have_glibc" = "yes"; then
                AC_RUN_IFELSE([AC_LANG_SOURCE([[
-int main() { return 0; }]])], [dnl
-libc_file_we_use=`$LDD ./conftest | grep libc | sed -e "s/.*=>\(.*\) .*$/\1/"`],
-                       [],[libc_file_we_use=])
-               libc_version=`$libc_file_we_use 2>/dev/null | sed "/version/q" | tr -cd "0-9.()"`
+#include <stdio.h>
+#include <gnu/libc-version.h>
+int main(void) { puts (gnu_get_libc_version()); return 0; }]])], [dnl
+libc_version=`./conftest`], [libc_version=""],
+        [AC_MSG_WARN([Cross-compiling? Good luck. Let us know how it goes.])])
+               if test -f /etc/os-release; then
+                       source /etc/os-release
+                       libc_version="GNU libc $libc_version (${PRETTY_NAME})"
+               else
+                       libc_version="GNU libc $libc_version (Unknown OS)"
                fi
-               ;;
-
-       *-*-aix*)
-               libc_version="bos.rte.libc `lslpp -Lqc bos.rte.libc | cut -f3 -d:`"
-               ;;
-
-       *-*-solaris*)
-               libc=`pkginfo -l SUNWcsl | grep VERSION: | awk '{print $2}'`
-               libc_version="SUNWcsl $libc"
-               ;;
-
-       mips-sgi-irix*)
-               libc_version="IRIX libc `uname -sRm`"
-               ;;
-
-       alpha*-dec-osf*)
-               dnl Another ugly case
-               (cd /usr/.smdb.;
-                       libc_version=` grep -h libc.so *.inv | awk '$9 == "f" {print $12}' | tr '\n' ','`
-               )
-               ;;
-
-       *-apple-darwin*)
-               dnl MacOS guys, does this work?
-               libc_version="`$LDD /usr/lib/libc.dylib | head -n1 | sed -e 's/.*current version[ ]*\([0-9.]*\).*$/\1/'`"
-               ;;
+       fi
 
-       *)
-               libc_version=""
-               ;;
-       esac
+       dnl Amazingly some people don't run Linux, or so I'm told. --SY
+       if test -z "$libc_version"; then
+               case "$ac_cv_build" in
+               *-*-aix*)
+                       libc_version="bos.rte.libc `lslpp -Lqc bos.rte.libc | cut -f3 -d:`"
+                       ;;
+
+               *-*-solaris*)
+                       libc=`pkginfo -l SUNWcsl | grep VERSION: | awk '{print $2}'`
+                       libc_version="SUNWcsl $libc"
+                       ;;
+
+               mips-sgi-irix*)
+                       libc_version="IRIX libc `uname -sRm`"
+                       ;;
+
+               alpha*-dec-osf*)
+                       dnl Another ugly case
+                       (cd /usr/.smdb.;
+                               libc_version=` grep -h libc.so *.inv | awk '$9 == "f" {print $12}' | tr '\n' ','`
+                       )
+                       ;;
+
+               *-apple-darwin*)
+                       dnl MacOS guys, does this work?
+                       libc_version="`$LDD /usr/lib/libc.dylib | head -n1 | sed -e 's/.*current version[ ]*\([0-9.]*\).*$/\1/'`"
+                       ;;
+
+               *)
+                       libc_version=""
+                       ;;
+               esac
+       fi
 
        AC_MSG_RESULT($libc_version)
 
@@ -226,10 +212,12 @@ AC_DEFUN([SXE_CHECK_BASIC_TYPES], [dnl
        ## checks for typedefs
        AC_TYPE_INT16_T
        AC_TYPE_INT32_T
+       AC_TYPE_INT64_T
        AC_TYPE_INT8_T
        AC_TYPE_MODE_T
        AC_TYPE_OFF_T
        AC_TYPE_PID_T
+       AC_TYPE_INTPTR_T
        ## next one is obsolete, it is safe to assume that RETSIGTYPE
        ## is always `void' these days
        dnl AC_TYPE_SIGNAL
@@ -256,6 +244,7 @@ AC_DEFUN([SXE_CHECK_BASIC_TYPES], [dnl
        AC_CHECK_SIZEOF([long long int], [0])
        AC_CHECK_SIZEOF([wchar_t], [0])
        AC_CHECK_SIZEOF([void *], [0])
+       AC_CHECK_SIZEOF([float], [0])
        AC_CHECK_SIZEOF([double], [0])
        AC_CHECK_SIZEOF([long double], [0])
        AC_CHECK_SIZEOF([size_t], [0])
@@ -350,8 +339,6 @@ AC_DEFUN([SXE_CHECK_SIGNALS], [dnl
 ])dnl SXE_CHECK_SIGNALS
 
 AC_DEFUN([SXE_CHECK_INTPTR_T], [dnl
-       dnl not AC_CHECK_TYPE; lisp.h does hairy conditional typedef
-       dnl why not? let's test it...
        SXE_CHECK_HEADERS([inttypes.h])
        AC_CHECK_TYPE([intptr_t], [], [], [
 #if defined HAVE_SYS_TYPES_H