]> granicus.if.org Git - zziplib/commitdiff
add stdint.h intptr_t emulation #29 #30
authorGuido Draheim <guidod@gmx.de>
Thu, 1 Mar 2018 17:52:42 +0000 (18:52 +0100)
committerGuido Draheim <guidod@gmx.de>
Thu, 1 Mar 2018 17:52:42 +0000 (18:52 +0100)
config.h.in
configure
configure.ac
zzip/stdint.h

index c9379b70d49ac186173a069827974e59edb9fb2f..bea5c35cad7006f9226735ef8918e6cb95c56102 100644 (file)
 /* The number of bytes in type int */
 #undef SIZEOF_INT
 
+/* The number of bytes in type int * */
+#undef SIZEOF_INT_P
+
 /* The number of bytes in type long */
 #undef SIZEOF_LONG
 
index d2f1f98e9bdb5e25f1792670a582dc67cb1d8463..e3ad91544711d24f21dd1bb950f2d6fe79f875db 100755 (executable)
--- a/configure
+++ b/configure
@@ -13095,6 +13095,46 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int *" >&5
+$as_echo_n "checking size of int *... " >&6; }
+if ${ac_cv_sizeof_int_p+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  for ac_size in 4 8 1 2 16  ; do # List sizes in rough order of prevalence.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include "confdefs.h"
+#include <sys/types.h>
+
+
+int
+main ()
+{
+switch (0) case 0: case (sizeof (int *) == $ac_size):;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sizeof_int_p=$ac_size
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  if test x$ac_cv_sizeof_int_p != x ; then break; fi
+done
+
+fi
+
+if test x$ac_cv_sizeof_int_p = x ; then
+  as_fn_error $? "cannot determine a size for int *" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int_p" >&5
+$as_echo "$ac_cv_sizeof_int_p" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT_P $ac_cv_sizeof_int_p
+_ACEOF
+
+
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
 $as_echo_n "checking whether byte ordering is bigendian... " >&6; }
 if ${ac_cv_c_bigendian+:} false; then :
index 774d1ccfd403e227c4372a5075b28e1301567294..bdbde30e196a1773b1b178bfd4f98ab46cdad0ac 100644 (file)
@@ -108,9 +108,10 @@ dnl AC_TYPE_SSIZE_T
 AC_CHECK_TYPE(ssize_t,int)
 AC_CHECK_TYPE(off64_t,_zzip_off_t)
 AC_CHECK_TYPE(__int64,long long)
-AC_COMPILE_CHECK_SIZEOF(short)
-AC_COMPILE_CHECK_SIZEOF(int)
-AC_COMPILE_CHECK_SIZEOF(long)
+AC_COMPILE_CHECK_SIZEOF([short])
+AC_COMPILE_CHECK_SIZEOF([int])
+AC_COMPILE_CHECK_SIZEOF([long])
+AC_COMPILE_CHECK_SIZEOF([int *])
 AC_C_BIGENDIAN
 AX_CHECK_ALIGNED_ACCESS_REQUIRED
 dnl -------------------------------------------------------------
index 4552c5b04e0035e8df8bd551c2a8122855f29e2d..9526976356c9cda23c31148a9a9bea7293a5a8bb 100644 (file)
     typedef unsigned long uint32_t;     typedef signed long int32_t;
 # endif
 
+/* either (long long) on Unix or (__int64) on Windows */
 typedef unsigned _zzip___int64 uint64_t; typedef _zzip___int64 int64_t;
-#endif
 
+# if defined ZZIP_SIZEOF_INT_P 
+#  if ZZIP_SIZEOF_INT_P == ZZIP_SIZEOF_LONG+0
+    typedef long intptr_t;
+#  elif ZZIP_SIZEOF_INT_P == ZZIP_SIZEOF_INT+0
+    typedef int intptr_t;
+#  else
+    typedef int64_t intptr_t;
+#  endif
+# endif
+
+#endif /* ZZIP_HAVE_... */
 #endif /*_ZZIP_STDINT_H*/