]> granicus.if.org Git - sudo/commitdiff
Update long long checks to use AC_CHECK_TYPES and to cache values.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 12 May 2007 12:56:46 +0000 (12:56 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 12 May 2007 12:56:46 +0000 (12:56 +0000)
aclocal.m4
configure
configure.in

index 3fb45374914a7b51a5f0d12eea566163897e3eb3..a70e3845538d789a38117840050b3fa66e104927 100644 (file)
@@ -280,13 +280,24 @@ AC_DEFINE_UNQUOTED(MAX_UID_T_LEN, $sudo_cv_uid_t_len, [Define to the max length
 ])
 
 dnl
-dnl check for "long long"
-dnl XXX hard to cache since it includes 2 tests
+dnl Check for presence of long long and for sizeof(long long) == sizeof(long)
 dnl
-AC_DEFUN(SUDO_LONG_LONG, [AC_MSG_CHECKING(for long long support)
-AC_TRY_LINK(, [long long foo = 1000; foo /= 10;], AC_DEFINE(HAVE_LONG_LONG, 1, [Define if your compiler supports the "long long" type.])
-[AC_TRY_RUN([main() {if (sizeof(long long) == sizeof(long)) exit(0); else exit(1);}], AC_DEFINE(LONG_IS_QUAD, 1, [Define if sizeof(long) == sizeof(long long).]))]
-AC_MSG_RESULT(yes), AC_MSG_RESULT(no))])
+AC_DEFUN(SUDO_TYPE_LONG_LONG,
+[AC_CHECK_TYPES(long long, [AC_DEFINE(HAVE_LONG_LONG, 1, [Define if your compiler supports the "long long" type.])]
+[AC_MSG_CHECKING(for long and long long equivalence)
+AC_CACHE_VAL(sudo_cv_type_long_is_quad,
+[AC_TRY_RUN([
+main() {
+if (sizeof(long long) == sizeof(long)) exit(0);
+else exit(1);
+}], [sudo_cv_type_long_is_quad=yes],
+[sudo_cv_type_long_is_quad=no], [sudo_cv_type_long_is_quad=no])
+rm -f core core.* *.core])dnl
+AC_MSG_RESULT($sudo_cv_type_long_is_quad)
+if test $sudo_cv_type_long_is_quad = yes; then
+  AC_DEFINE(LONG_IS_QUAD, 1, [Define if sizeof(long) == sizeof(long long).])
+fi
+])])
 
 dnl
 dnl append a libpath to an LDFLAGS style variable
index 9872ec1db5f36f336726dbc7b8ee39ff078a0bde..28029190c9e11b89f6c76a37be7a1abf6c027533 100755 (executable)
--- a/configure
+++ b/configure
@@ -13707,26 +13707,32 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-echo "$as_me:$LINENO: checking for long long support" >&5
-echo $ECHO_N "checking for long long support... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
+echo "$as_me:$LINENO: checking for long long" >&5
+echo $ECHO_N "checking for long long... $ECHO_C" >&6
+if test "${ac_cv_type_long_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-
+$ac_includes_default
 int
 main ()
 {
-long long foo = 1000; foo /= 10;
+if ((long long *) 0)
+  return 0;
+if (sizeof (long long))
+  return 0;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -13740,23 +13746,41 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
+        { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
+  ac_cv_type_long_long=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_long_long=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
+echo "${ECHO_T}$ac_cv_type_long_long" >&6
+if test $ac_cv_type_long_long = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_LONG_LONG 1
+_ACEOF
+
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_LONG_LONG 1
 _ACEOF
 
-if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+echo "$as_me:$LINENO: checking for long and long long equivalence" >&5
+echo $ECHO_N "checking for long and long long equivalence... $ECHO_C" >&6
+if test "${sudo_cv_type_long_is_quad+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  sudo_cv_type_long_is_quad=no
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -13764,7 +13788,11 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-main() {if (sizeof(long long) == sizeof(long)) exit(0); else exit(1);}
+
+main() {
+if (sizeof(long long) == sizeof(long)) exit(0);
+else exit(1);
+}
 _ACEOF
 rm -f conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
@@ -13777,30 +13805,31 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-
-cat >>confdefs.h <<\_ACEOF
-#define LONG_IS_QUAD 1
-_ACEOF
-
+  sudo_cv_type_long_is_quad=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+( exit $ac_status )
+sudo_cv_type_long_is_quad=no
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+rm -f core core.* *.core
+fi
+echo "$as_me:$LINENO: result: $sudo_cv_type_long_is_quad" >&5
+echo "${ECHO_T}$sudo_cv_type_long_is_quad" >&6
+if test $sudo_cv_type_long_is_quad = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define LONG_IS_QUAD 1
+_ACEOF
 
-echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
 fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
+
+fi
+
 echo "$as_me:$LINENO: checking for sa_len field in struct sockaddr" >&5
 echo $ECHO_N "checking for sa_len field in struct sockaddr... $ECHO_C" >&6
 if test "${sudo_cv_sock_sa_len+set}" = set; then
@@ -15572,14 +15601,17 @@ esac
 fi
 done
 
-echo "$as_me:$LINENO: checking for working fnmatch with FNM_CASEFOLD" >&5
-echo $ECHO_N "checking for working fnmatch with FNM_CASEFOLD... $ECHO_C" >&6
-if test "${sudo_cv_func_fnmatch+set}" = set; then
+echo "$as_me:$LINENO: checking for working POSIX fnmatch" >&5
+echo $ECHO_N "checking for working POSIX fnmatch... $ECHO_C" >&6
+if test "${ac_cv_func_fnmatch_works+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  rm -f conftestdata; > conftestdata
-if test "$cross_compiling" = yes; then
-  sudo_cv_func_fnmatch=no
+  # Some versions of Solaris, SCO, and the GNU C Library
+   # have a broken or incompatible fnmatch.
+   # So we run a test program.  If we are cross-compiling, take no chance.
+   # Thanks to John Oleynick, Franc,ois Pinard, and Paul Eggert for this test.
+   if test "$cross_compiling" = yes; then
+  ac_cv_func_fnmatch_works=cross
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -15588,7 +15620,23 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <fnmatch.h>
-main() { exit(fnmatch("/*/bin/echo *", "/usr/bin/echo just a test", FNM_CASEFOLD)); }
+#         define y(a, b, c) (fnmatch (a, b, c) == 0)
+#         define n(a, b, c) (fnmatch (a, b, c) == FNM_NOMATCH)
+
+int
+main ()
+{
+exit
+          (!(y ("a*", "abc", 0)
+             && n ("d*/*1", "d/s/1", FNM_PATHNAME)
+             && y ("a\\\\bc", "abc", 0)
+             && n ("a\\\\bc", "abc", FNM_NOESCAPE)
+             && y ("*x", ".x", 0)
+             && n ("*x", ".x", FNM_PERIOD)
+             && 1));
+  ;
+  return 0;
+}
 _ACEOF
 rm -f conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
@@ -15601,29 +15649,32 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  sudo_cv_func_fnmatch=yes
+  ac_cv_func_fnmatch_works=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-sudo_cv_func_fnmatch=no
+ac_cv_func_fnmatch_works=no
 fi
 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-rm -f core core.* *.core
 fi
+echo "$as_me:$LINENO: result: $ac_cv_func_fnmatch_works" >&5
+echo "${ECHO_T}$ac_cv_func_fnmatch_works" >&6
+if test $ac_cv_func_fnmatch_works = yes; then
 
-echo "$as_me:$LINENO: result: $sudo_cv_func_fnmatch" >&5
-echo "${ECHO_T}$sudo_cv_func_fnmatch" >&6
-if test $sudo_cv_func_fnmatch = yes; then
-  cat >>confdefs.h <<\_ACEOF
+cat >>confdefs.h <<\_ACEOF
 #define HAVE_FNMATCH 1
 _ACEOF
 
-else
-  case $LIBOBJS in
+fi
+
+
+
+if test "$ac_cv_func_fnmatch_works" = no; then
+    case $LIBOBJS in
     "fnmatch.$ac_objext"   | \
   *" fnmatch.$ac_objext"   | \
     "fnmatch.$ac_objext "* | \
@@ -15632,7 +15683,6 @@ else
 esac
 
 fi
-
 echo "$as_me:$LINENO: checking for isblank" >&5
 echo $ECHO_N "checking for isblank... $ECHO_C" >&6
 if test "${sudo_cv_func_isblank+set}" = set; then
index 2c6654f5ae7eb1263bdb170633ab83d5b0f26637..91d6bebcbf08f40620ffc841aff0729ec35228df 100644 (file)
@@ -1677,7 +1677,7 @@ SUDO_TYPE_DEV_T
 SUDO_TYPE_INO_T
 SUDO_FULL_VOID
 SUDO_UID_T_LEN
-SUDO_LONG_LONG
+SUDO_TYPE_LONG_LONG
 SUDO_SOCK_SA_LEN
 dnl
 dnl only set RETSIGTYPE if it is not set already