]> granicus.if.org Git - neomutt/commitdiff
Begin removing deprecated autoconf 2.13 backward compatibility code.
authorBrendan Cully <brendan@kublai.com>
Mon, 31 Jan 2005 02:40:14 +0000 (02:40 +0000)
committerBrendan Cully <brendan@kublai.com>
Mon, 31 Jan 2005 02:40:14 +0000 (02:40 +0000)
Add AC_CHECK_TYPES macros for uin32/64 types, use uint64_t instead of long long
in hcache code.

acconfig.h [deleted file]
configure.in
hcache.c
imap/imap_private.h
imap/message.c
m4/types.m4 [new file with mode: 0644]
protos.h

diff --git a/acconfig.h b/acconfig.h
deleted file mode 100644 (file)
index 206a664..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-
-/* program to use for shell commands */
-#define EXECSHELL "/bin/sh"
-
-/* Define to `int' if <signal.h> doesn't define.  */
-#undef sig_atomic_t
-
-@BOTTOM@
-/* Define if you have start_color, as a function or macro.  */
-#undef HAVE_START_COLOR
-
-/* Define if you have typeahead, as a function or macro.  */
-#undef HAVE_TYPEAHEAD
-
-/* Define if you have bkgdset, as a function or macro.  */
-#undef HAVE_BKGDSET
-
-/* Define if you have curs_set, as a function or macro.  */
-#undef HAVE_CURS_SET
-
-/* Define if you have meta, as a function or macro.  */
-#undef HAVE_META
-
-/* Define if you have use_default_colors, as a function or macro.  */
-#undef HAVE_USE_DEFAULT_COLORS
-
-/* Define if you have resizeterm, as a function or macro.  */
-#undef HAVE_RESIZETERM
-
-/* Some systems declare sig_atomic_t as volatile, some others -- no.
- * This define will have value `sig_atomic_t' or `volatile sig_atomic_t'
- * accordingly. */
-#undef SIG_ATOMIC_VOLATILE_T
-
-/* Define as 1 if iconv() only converts exactly and we should treat
- * all return values other than (size_t)(-1) as equivalent. */
-#undef ICONV_NONTRANS
-
index 445125246b3819deaa86ce782f580ee7934cdec6..83e4a711ebe8a53832c6fe97bdc3092d9abec2c3 100644 (file)
@@ -3,27 +3,24 @@ dnl Process this file with autoconf to produce a configure script.
 dnl !!! WHEN ADDING NEW CONFIGURE TESTS, PLEASE ADD CODE TO MAIN.C !!!
 dnl !!! TO DUMP THEIR RESULTS WHEN MUTT -V IS CALLED            !!!
 
-AC_PREREQ(2.12)
-AC_INIT(mutt.h)
-AM_CONFIG_HEADER(config.h)
+AC_PREREQ([2.54])
+AC_INIT([mutt.h])
+AM_CONFIG_HEADER([config.h])
 
 mutt_cv_version=`cat $srcdir/VERSION`
 
-
 AM_INIT_AUTOMAKE(mutt, $mutt_cv_version)
 AC_GNU_SOURCE
 
-ifdef([AC_LIBOBJ], , [define([AC_LIBOBJ], [LIB[]OBJS="$LIBOBJS $1.o"])])
-
 ALL_LINGUAS="de ru it es uk fr pl nl cs id sk ko el zh_TW zh_CN pt_BR eo gl sv da lt tr ja hu et ca bg"
 
 AC_CANONICAL_HOST
 
-AC_MSG_CHECKING(for prefix)
+AC_MSG_CHECKING([for prefix])
 if test x$prefix = xNONE; then
-        mutt_cv_prefix=$ac_default_prefix
+  mutt_cv_prefix=$ac_default_prefix
 else
-        mutt_cv_prefix=$prefix
+  mutt_cv_prefix=$prefix
 fi
 AC_MSG_RESULT($mutt_cv_prefix)
 
@@ -58,35 +55,33 @@ else
         DEBUGGER=no
 fi
 
-AC_SUBST(DEBUGGER)
-
-# The following templates should be used with newer automakes
-# instead of acconfig.h
-#
-#AH_TEMPLATE([sig_atomic_t],
-#            [/* Define to `int' if <signal.h> doesn't define.])
-#AH_TEMPLATE([HAVE_START_COLOR],
-#            [Define if you have start_color, as a function or macro.])
-#AH_TEMPLATE([HAVE_TYPEAHEAD],
-#            [Define if you have typeahead, as a function or macro.])
-#AH_TEMPLATE([HAVE_BKGDSET],
-#            [Define if you have bkgdset, as a function or macro.])
-#AH_TEMPLATE([HAVE_CURS_SET],
-#            [Define if you have curs_set, as a function or macro.])
-#AH_TEMPLATE([HAVE_META],
-#            [Define if you have meta, as a function or macro.])
-#AH_TEMPLATE([HAVE_USE_DEFAULT_COLORS],
-#            [Define if you have use_default_colors, as a function or macro.])
-#AH_TEMPLATE([HAVE_RESIZETERM],
-#            [Define if you have resizeterm, as a function or macro.])
-#AH_TEMPLATE([SIG_ATOMIC_VOLATILE_T],
-#            [Some systems declare sig_atomic_t as volatile, some others -- no.
-#             This define will have value `sig_atomic_t' or
-#             `volatile sig_atomic_t' accordingly.])
-#AH_TEMPLATE([ICONV_NONTRANS],
-#            [Define as 1 if iconv() only converts exactly and we should treat
-#             all return values other than (size_t)(-1) as equivalent.])
-
+AC_SUBST([DEBUGGER])
+
+AH_TEMPLATE([sig_atomic_t],
+            [/* Define to `int' if <signal.h> doesn't define.])
+AH_TEMPLATE([HAVE_START_COLOR],
+            [Define if you have start_color, as a function or macro.])
+AH_TEMPLATE([HAVE_TYPEAHEAD],
+            [Define if you have typeahead, as a function or macro.])
+AH_TEMPLATE([HAVE_BKGDSET],
+            [Define if you have bkgdset, as a function or macro.])
+AH_TEMPLATE([HAVE_CURS_SET],
+            [Define if you have curs_set, as a function or macro.])
+AH_TEMPLATE([HAVE_META],
+            [Define if you have meta, as a function or macro.])
+AH_TEMPLATE([HAVE_USE_DEFAULT_COLORS],
+            [Define if you have use_default_colors, as a function or macro.])
+AH_TEMPLATE([HAVE_RESIZETERM],
+            [Define if you have resizeterm, as a function or macro.])
+AH_TEMPLATE([SIG_ATOMIC_VOLATILE_T],
+            [Some systems declare sig_atomic_t as volatile, some others -- no.
+             This define will have value `sig_atomic_t' or
+             `volatile sig_atomic_t' accordingly.])
+AH_TEMPLATE([ICONV_NONTRANS],
+            [Define as 1 if iconv() only converts exactly and we should treat
+             all return values other than (size_t)(-1) as equivalent.])
+
+MUTT_C99_INTTYPES
 
 ac_aux_path_sendmail=/usr/sbin:/usr/lib
 AC_PATH_PROG(SENDMAIL, sendmail, /usr/sbin/sendmail, $PATH:$ac_aux_path_sendmail)
@@ -166,14 +161,14 @@ else
 fi
 # We now require all OPS
 OPS="$OPS \$(srcdir)/OPS.PGP \$(srcdir)/OPS.SMIME \$(srcdir)/OPS.CRYPT "
-AC_SUBST(OPS)
+AC_SUBST([OPS])
 
 
 AC_SUBST(PGPAUX_TARGET)
 AC_SUBST(SMIMEAUX_TARGET)
 
 AC_DEFINE_UNQUOTED(SUBVERSION,"$SUBVERSION",[ Is this the international version? ])
-AC_SUBST(SUBVERSION)
+AC_SUBST([SUBVERSION])
 
 AC_PATH_PROG(ISPELL, ispell, no)
 if test $ISPELL != no; then
@@ -327,33 +322,6 @@ fi
 
 AC_DECL_SYS_SIGLIST
 
-dnl For MD5 and SHA1 on 64-bit systems
-AC_C_BIGENDIAN
-AC_CHECK_HEADERS(inttypes.h stdint.h)
-dnl This is the method autoconf-2.50's new AC_CHECK_TYPE macro uses.
-dnl We need to be backwards compatible to autoconf 2.13, though. -lh
-AC_MSG_CHECKING(for uint32_t)
-AC_TRY_COMPILE([
-#include <sys/types.h>
-#if HAVE_INTTYPES_H
-#include <inttypes.h>
-#else
-#if HAVE_STDINT_H
-#include <stdint.h>
-#endif
-#endif],
-[if ((uint32_t *) 0)
-  return 0;
-if (sizeof (uint32_t))
-  return 0;
-],[
-    AC_DEFINE(HAVE_UINT32_T,1,[ Define if you have the uint32_t type. ])
-    AC_MSG_RESULT(yes)
-  ], AC_MSG_RESULT(no)
-)
-AC_CHECK_SIZEOF(int)
-AC_CHECK_SIZEOF(long)
-
 AC_TYPE_PID_T
 AC_CHECK_TYPE(ssize_t, int)
 
index 4fc8e7c7c723fe08d384fa09e3188a498da71e74..2193236beb29a8e46dc36b7fbbc7bd19cbb9cf8c 100644 (file)
--- a/hcache.c
+++ b/hcache.c
@@ -60,7 +60,7 @@ static struct header_cache
 typedef union
 {
   struct timeval timeval;
-  unsigned long long uid_validity;
+  uint64_t uid_validity;
 } validate;
 
 static void *
@@ -277,7 +277,7 @@ restore_buffer(BUFFER ** b, const unsigned char *d, int *off)
   restore_char(&(*b)->data, d, off);
   restore_int(&offset, d, off);
   (*b)->dptr = (*b)->data + offset;
-  restore_int(&(*b)->dsize, d, off);
+  restore_int((unsigned int *) &(*b)->dsize, d, off);
   restore_int((unsigned int *) &(*b)->destroy, d, off);
 }
 
@@ -547,7 +547,7 @@ mutt_hcache_per_folder(const char *path, const char *folder)
  * db_store */
 static void *
 mutt_hcache_dump(void *_db, HEADER * h, int *off,
-                unsigned long long uid_validity)
+                uint64_t uid_validity)
 {
   struct header_cache *db = _db;
   unsigned char *d = NULL;
@@ -556,7 +556,7 @@ mutt_hcache_dump(void *_db, HEADER * h, int *off,
   d = lazy_malloc(sizeof (validate));
 
   if (uid_validity)
-    memcpy(d, &uid_validity, sizeof (long long));
+    memcpy(d, &uid_validity, sizeof (uint64_t));
   else
   {
     struct timeval now;
@@ -693,7 +693,7 @@ mutt_hcache_fetch(void *db, const char *filename,
 
 int
 mutt_hcache_store(void *db, const char *filename, HEADER * header,
-                 unsigned long long uid_validity,
+                 uint64_t uid_validity,
                  size_t(*keylen) (const char *fn))
 {
   struct header_cache *h = db;
@@ -883,7 +883,7 @@ mutt_hcache_fetch(void *db, const char *filename,
 
 int
 mutt_hcache_store(void *db, const char *filename, HEADER * header,
-                 unsigned long long uid_validity,
+                 uint64_t uid_validity,
                  size_t(*keylen) (const char *fn))
 {
   DBT key;
index c29bca20b2205b79dfa49bc061696780de91d2b9..056fbcfc2cade652fc5911c52f1c128b4028f63e 100644 (file)
@@ -180,7 +180,7 @@ typedef struct
   IMAP_CACHE cache[IMAP_CACHE_LEN];
   unsigned int noclose : 1;
 #ifdef USE_HCACHE
-  unsigned long long uid_validity;
+  uint64_t uid_validity;
 #endif
   
   /* all folder flags - system flags AND keywords */
index 4eae3b84958ccb9b4bc1f89abe746e46810472f5..183933f413c6a1082b973ef5205c6dcb08fb12e0 100644 (file)
@@ -65,7 +65,7 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend)
 
 #if USE_HCACHE
   void *hc   = NULL;
-  unsigned long long *uid_validity = NULL;
+  uint64_t *uid_validity = NULL;
   char uid_buf[64];
 #endif /* USE_HCACHE */
 
@@ -150,7 +150,7 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend)
       fputs ("\n\n", fp);
 
       sprintf(uid_buf, "/%u", h.data->uid); /* XXX --tg 21:41 04-07-11 */
-      uid_validity = (unsigned long long *) mutt_hcache_fetch (hc, uid_buf, &imap_hcache_keylen);
+      uid_validity = (uint64_t *) mutt_hcache_fetch (hc, uid_buf, &imap_hcache_keylen);
 
       if (uid_validity != NULL
       && *uid_validity == idata->uid_validity) {
diff --git a/m4/types.m4 b/m4/types.m4
new file mode 100644 (file)
index 0000000..5f219fb
--- /dev/null
@@ -0,0 +1,36 @@
+dnl types.m4
+dnl macros for type checks not covered by autoconf
+
+dnl MUTT_C99_INTTYPES
+dnl Brendan Cully
+dnl
+# MUTT_C99_INTTYPES
+# Check for C99 integer type definitions, or define if missing
+AC_DEFUN([MUTT_C99_INTTYPES],
+[dnl
+AC_CHECK_HEADERS([inttypes.h])
+AC_CHECK_TYPE([uint32_t],
+  [AC_DEFINE(HAVE_C99_INTTYPES, 1, [Define if you have the C99 integer types])],
+  [AC_CHECK_SIZEOF(short)
+   AC_CHECK_SIZEOF(int)
+   AC_CHECK_SIZEOF(long)
+   AC_CHECK_SIZEOF(long long)])
+AH_VERBATIM([X_HAVE_C99_INTTYPES],
+  [#ifndef HAVE_C99_INTTYPES
+#  if SIZEOF_SHORT == 4
+typedef unsigned short uint32_t;
+#  elif SIZEOF_INT == 4
+typedef unsigned int uint32_t;
+#  elif SIZEOF_LONG == 4
+typedef unsigned long uint32_t;
+#  endif
+#  if SIZEOF_INT == 8
+typedef unsigned int uint64_t;
+#  elif SIZEOF_LONG == 8
+typedef unsigned long uint64_t;
+#  elif SIZEOF_LONG_LONG == 8
+typedef unsigned long long uint64_t;
+#  endif
+#endif
+  ])
+])
index 366fe6048e149ef3ab27bdb3bdd73252900eb399..5e99f6432fda7c9b424353e651ebb37f6ee0b3b2 100644 (file)
--- a/protos.h
+++ b/protos.h
  */ 
 
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+
 #include "mbyte.h"
 
 #ifdef DEBUG
@@ -107,7 +115,7 @@ void *mutt_hcache_open(const char *path, const char *folder);
 void mutt_hcache_close(void *db);
 HEADER *mutt_hcache_restore(const unsigned char *d, HEADER **oh);
 void *mutt_hcache_fetch(void *db, const char *filename, size_t (*keylen)(const char *fn));
-int mutt_hcache_store(void *db, const char *filename, HEADER *h, unsigned long long uid_validity, size_t (*keylen)(const char *fn));
+int mutt_hcache_store(void *db, const char *filename, HEADER *h, uint64_t uid_validity, size_t (*keylen)(const char *fn));
 int mutt_hcache_delete(void *db, const char *filename, size_t (*keylen)(const char *fn));
 #endif /* USE_HCACHE */