Bug 944935 - Cleanup some useless AC_CHECK_FUNCS tests in configure.in. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 11 Dec 2013 10:57:53 +0900
changeset 159815 924d56cc2c07d4cfdf8938b2727c0c2ec2a655f3
parent 159814 5dc2bc88108d38dc3baaa0782c0978cab8a6d089
child 159816 ada04e26c60e996dbdcb85b1f605ac7cb1e547b8
push idunknown
push userunknown
push dateunknown
reviewersgps
bugs944935
milestone29.0a1
Bug 944935 - Cleanup some useless AC_CHECK_FUNCS tests in configure.in. r=gps - HAVE_RANDOM is not checked at all. - HAVE_STRERROR is not checked in code built using the defines from the main configure. - HAVE_LCHOWN is only checked in nsinstall.c, which means the test is also wrong since it's checking for the target instead of the host. Also, lchown is only used of the -o and -g options of nsinstall, which, as far as I know, we don't use (and if we were, that would fail with nsinstall.py, which explicitly rejects them). - HAVE_FCHMOD is only checked in nsinstall.c, so same as above about the correctness of the check. If it's not available, nsinstall.c falls back to chmod, which is fine enough for our use. - HAVE_SNPRINTF is not checked. - HAVE_MEMMOVE is checked in parser/expat/lib/xmlparse.c, but it's also unconditionally defined in expat_config.h which is included from that file. - HAVE_SETBUF is checked in a couple files, but setbuf is C89 and C99, I think it's safe to assume all compilers we support are C89 and C99. Interestingly, windows does have it, but since we skip this check on windows, we don't use it. - HAVE_ISATTY, same as HAVE_SETBUF, except it's POSIX instead of C89/C99. - HAVE_FLOCKFILE is not checked at all. - HAVE_STRTOK_R is not checked. - HAVE_FT_SELECT_SIZE is not checked. - HAVE_DLADDR is not checked under js/src. - HAVE_GETPAGESIZE is not checked under js/src (it is in libffi, but ffi uses its own configure) - HAVE_LSTAT64, HAVE_STAT64, HAVE_STATVFS, HAVE_STATVFS64, HAVE_TRUNCATE64 are not checked under js/src. - HAVE_SBRK is not checked under js/src. Moreover, js/src/assembler/wtf/Platform.h defines it depending on the platform. - HAVE_SNPRINTF is not checked under js/src. - HAVE_HYPOT is not checked under js/src. - HAVE__UNWIND_BACKTRACE is not checked under js/src.
configure.in
ipc/testshell/XPCShellEnvironment.cpp
js/src/configure.in
js/xpconnect/shell/xpcshell.cpp
js/xpconnect/src/XPCShellImpl.cpp
--- a/configure.in
+++ b/configure.in
@@ -3029,20 +3029,17 @@ then
     AC_SUBST(MOZ_USE_PTHREADS)
 fi
 
 
 dnl Checks for library functions.
 dnl ========================================================
 AC_PROG_GCC_TRADITIONAL
 AC_FUNC_MEMCMP
-AC_CHECK_FUNCS(random strerror lchown fchmod snprintf memmove stat64 lstat64 truncate64 setbuf isatty)
-AC_CHECK_FUNCS(statvfs64 statvfs statfs64 statfs)
-AC_CHECK_FUNCS(flockfile getpagesize)
-AC_CHECK_FUNCS(localtime_r strtok_r)
+AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize localtime_r)
 
 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
                ac_cv_clock_monotonic,
                [for libs in "" -lrt; do
                     _SAVE_LIBS="$LIBS"
                     LIBS="$LIBS $libs"
                     AC_TRY_LINK([#include <time.h>],
@@ -7813,17 +7810,17 @@ if test "$USE_FC_FREETYPE"; then
                 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
             else
                 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
             fi
             AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
                                $HAVE_FT_BITMAP_SIZE_Y_PPEM,
                                [FT_Bitmap_Size structure includes y_ppem field])
 
-            AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
+            AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
 
             LIBS="$_SAVE_LIBS"
             CFLAGS="$_SAVE_CFLAGS"
         fi
 
         _SAVE_CPPFLAGS="$CPPFLAGS"
         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
--- a/ipc/testshell/XPCShellEnvironment.cpp
+++ b/ipc/testshell/XPCShellEnvironment.cpp
@@ -304,20 +304,17 @@ XPCShellEnvironment::ProcessFile(JSConte
     int lineno, startline;
     bool ok, hitEOF;
     char *bufp, buffer[4096];
     JSString *str;
 
     if (forceTTY) {
         file = stdin;
     }
-    else
-#ifdef HAVE_ISATTY
-    if (!isatty(fileno(file)))
-#endif
+    else if (!isatty(fileno(file)))
     {
         /*
          * It's not interactive - just execute it.
          *
          * Support the UNIX #! shell hack; gobble the first line if it starts
          * with '#'.  TODO - this isn't quite compatible with sharp variables,
          * as a legal js program (using sharp variables) might start with '#'.
          * But that would require multi-character lookahead.
@@ -470,21 +467,19 @@ XPCShellEnvironment::~XPCShellEnvironmen
     }
 }
 
 bool
 XPCShellEnvironment::Init()
 {
     nsresult rv;
 
-#ifdef HAVE_SETBUF
     // unbuffer stdout so that output is in the correct order; note that stderr
     // is unbuffered by default
     setbuf(stdout, 0);
-#endif
 
     nsCOMPtr<nsIJSRuntimeService> rtsvc =
         do_GetService("@mozilla.org/js/xpc/RuntimeService;1");
     if (!rtsvc) {
         NS_ERROR("failed to get nsJSRuntimeService!");
         return false;
     }
 
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -2342,21 +2342,16 @@ case $target in
     ;;
 *)
     AC_SEARCH_LIBS(dlopen, dl,
         MOZ_CHECK_HEADER(dlfcn.h,
         AC_DEFINE(HAVE_DLOPEN)))
     ;;
 esac
 
-_SAVE_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -D_GNU_SOURCE"
-AC_CHECK_FUNCS(dladdr)
-CFLAGS="$_SAVE_CFLAGS"
-
 if test ! "$GNU_CXX"; then
 
     case $target in
     *-aix*)
 	AC_CHECK_LIB(C_r, demangle)
 	;;
      *)
 	AC_CHECK_LIB(C, demangle)
@@ -2499,25 +2494,23 @@ then
     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
 fi
 
 
 dnl Checks for library functions.
 dnl ========================================================
 AC_PROG_GCC_TRADITIONAL
 AC_FUNC_MEMCMP
-AC_CHECK_FUNCS([fchmod flockfile getc_unlocked _getc_nolock getpagesize \
-                lchown localtime_r lstat64 memmove random sbrk snprintf \
-                stat64 statvfs statvfs64 strerror strtok_r truncate64])
+AC_CHECK_FUNCS([getc_unlocked _getc_nolock localtime_r])
 
 
 dnl Checks for math functions.
 dnl ========================================================
 AC_CHECK_LIB(m, sin)
-AC_CHECK_FUNCS([log2 log1p expm1 sqrt1pm1 acosh asinh atanh hypot trunc cbrt])
+AC_CHECK_FUNCS([log2 log1p expm1 sqrt1pm1 acosh asinh atanh trunc cbrt])
 
 
 dnl check for wcrtomb/mbrtowc
 dnl =======================================================================
 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
 AC_LANG_SAVE
 AC_LANG_CPLUSPLUS
 AC_CACHE_CHECK(for wcrtomb,
@@ -3633,23 +3626,16 @@ fi
 MOZ_DEMANGLE_SYMBOLS=
 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
     MOZ_DEMANGLE_SYMBOLS=1
     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
 fi
 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
 
 dnl ========================================================
-dnl = Support for gcc stack unwinding (from gcc 3.3)
-dnl ========================================================
-if test -z "$SKIP_LIBRARY_CHECKS"; then
-    MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
-fi
-
-dnl ========================================================
 dnl JIT observers
 dnl ========================================================
 
 MOZ_ARG_WITH_STRING(jitreport-granularity,
 [  --jitreport-granularity=N
                            Default granularity at which to report JIT code
                            to external tools
                              0 - no info
--- a/js/xpconnect/shell/xpcshell.cpp
+++ b/js/xpconnect/shell/xpcshell.cpp
@@ -27,21 +27,19 @@
 
 int
 main(int argc, char** argv, char** envp)
 {
 #ifdef XP_MACOSX
     InitAutoreleasePool();
 #endif
 
-#ifdef HAVE_SETBUF
     // unbuffer stdout so that output is in the correct order; note that stderr
     // is unbuffered by default
     setbuf(stdout, 0);
-#endif
 
 #ifdef HAS_DLL_BLOCKLIST
     DllBlocklist_Initialize();
 #endif
 
     int result = XRE_XPCShellMain(argc, argv, envp);
 
 #ifdef XP_MACOSX
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -880,20 +880,17 @@ ProcessFile(JSContext *cx, JS::Handle<JS
     JS::Rooted<JS::Value> result(cx);
     int lineno, startline;
     bool ok, hitEOF;
     char *bufp, buffer[4096];
     JSString *str;
 
     if (forceTTY) {
         file = stdin;
-    } else
-#ifdef HAVE_ISATTY
-    if (!isatty(fileno(file)))
-#endif
+    } else if (!isatty(fileno(file)))
     {
         /*
          * It's not interactive - just execute it.
          *
          * Support the UNIX #! shell hack; gobble the first line if it starts
          * with '#'.  TODO - this isn't quite compatible with sharp variables,
          * as a legal js program (using sharp variables) might start with '#'.
          * But that would require multi-character lookahead.