On Sat, 25 Aug 2007, Bruce Korb wrote:
Martin Koeppe wrote:
Thank you, Martin. I'll change compat.h to read as follows:
#if ! defined(HAVE_UINTPTR_T) && ! defined(uintptr_t)
typedef unsigned long uintptr_t;
#endif
This would work. However, I think you could equally well remove those 3
lines, as configure ensures that if HAVE_UINTPTR_T is not defined then
always uintptr_t gets defined. And if the system should already #define
uintptr_t as a macro, then HAVE_UINTPTR_T would be set, too, so the #if
above is always false.
True. I didn't do it only because I was certain of this variation
and I have to remember and consider all the contexts within which
this code gets built.
But I think the typedef is nicer than a macro,
They are. :)
Similar typedefs should be written to compat/compat.h and removed from
the end of config-h.in for mode_t, pid_t, scm_primitive_eval_x,
scm_t_port, size_t, uid_t, wchar_t, wint_t.
Or if you prefer replacement macros, the HAVE_* macros aren't really
needed, are they?, and should not be generated then at all.
Side effect of the autoconf testing.
I think, however, that it is better to have the replacement types in
compat.h, not in libopts.*. configure should only detect what is there
and what isn't, and compat.h decides what to do.
It is partly an issue of the amount of playtime I have.
If you were kind enough to put together a patch that did this,
I'd then check it to ensure that everything was still working
and add it to the source base, with grateful appreciation.
Hi Bruce,
here is the patch. I successfully tested it on Linux and on Interix,
which doesn't have uintptr_t. The update to configure and config-h.in
is not included, run autoconf and autoheader. I'm also not sure, how
libopts.defs can regenerate libopts.m4, so I patched both files.
For future versions, if you want to continue with typedefs, make sure
that after running autoheader in config-h.in there are no "#undef
some_type_name" things. I first missed to also change snprintfv.m4, so
I had one new test for size_t in configure.in and one old test in
snprintfv.m4, which would have been the same wrong thing if size_t is
missing somewhere as I noted for missing uintptr_t. I now renewed the
test in snprintfv.m4 also, I could have removed it, too. Don't know
which is better, i.e. how separate snprintv.m4 is from autogen.
Wait, as I now changed snprintfv.m4 anyway, I also changed the type
checks for wchar_t and wint_t which I first didn't touch. However, now
autoconf places the check into configure, but autoheader doesn't list
HAVE_WCHAR_T in config-h.in for me. I don't know why. So the attached
patch is probably broken. If I however move the type tests from
snprintfv.m4 to configure.in, everything is fine. I don't know if you
would allow this, however. Alternatively one could leave the 2 tests
for wchar_t/wint_t as macro in snprintfv.m4. But if you later add
wchar_t to autogen and add the type check to configure.in also, it
gets broken then again.
Martin
--- autogen-5.9.2.orig/compat/compat.h
+++ autogen-5.9.2/compat/compat.h
@@ -305,6 +305,29 @@
#ifndef HAVE_UINTPTR_T
typedef unsigned long uintptr_t;
#endif
+#ifndef HAVE_SIZE_T
+ typedef unsigned int size_t;
+#endif
+#ifndef HAVE_WCHAR_T
+ typedef unsigned int wchar_t;
+#endif
+#ifndef HAVE_WINT_T
+ typedef unsigned int wint_t;
+#endif
+
+#ifndef HAVE_MODE_T
+ typedef signed int mode_t;
+#endif
+#ifndef HAVE_PID_T
+ typedef signed int pid_t;
+#endif
+#ifndef HAVE_UID_T
+ typedef signed int uid_t;
+#endif
+#ifndef HAVE_GID_T
+ typedef signed int gid_t;
+#endif
+
/* redefine these for BSD style string libraries */
#ifndef HAVE_STRCHR
--- autogen-5.9.2.orig/config/libopts.m4
+++ autogen-5.9.2/config/libopts.m4
@@ -67,14 +67,11 @@
# ========================
AC_CHECK_HEADERS(stdint.h inttypes.h, break)
AC_CHECK_TYPES([int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
- intptr_t, uint_t])
+ intptr_t, uintptr_t, uint_t])
- # ====================
- # uintptr type & sizes
- # ====================
- AC_CHECK_TYPES([uintptr_t], ,
- [AC_DEFINE([uintptr_t], unsigned long,
- [Alternate uintptr_t for systems without it.])])
+ # =====
+ # sizes
+ # =====
AC_CHECK_SIZEOF(char*, 4)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
--- autogen-5.9.2.orig/config/libopts.def
+++ autogen-5.9.2/config/libopts.def
@@ -307,14 +307,11 @@
# ========================
AC_CHECK_HEADERS(stdint.h inttypes.h, break)
AC_CHECK_TYPES([int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
- intptr_t, uint_t])
+ intptr_t, uintptr_t, uint_t])
- # ====================
- # uintptr type & sizes
- # ====================
- AC_CHECK_TYPES([uintptr_t], ,
- [AC_DEFINE([uintptr_t], unsigned long,
- [Alternate uintptr_t for systems without it.])])
+ # =====
+ # sizes
+ # =====
AC_CHECK_SIZEOF(char*, 4)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
--- autogen-5.9.2.orig/configure.in
+++ autogen-5.9.2/configure.in
@@ -124,10 +124,6 @@
# ----------------------------------------------------------------------
# Checks for typedefs, structures, and compiler characteristics.
# ----------------------------------------------------------------------
-AC_TYPE_MODE_T
-AC_TYPE_PID_T
-AC_TYPE_SIZE_T
-AC_TYPE_UID_T
AC_C_LONG_DOUBLE
if test x$ac_cv_type_long_double = xno; then
snv_long_double=double
@@ -137,7 +133,7 @@
AC_DEFINE_UNQUOTED([SNV_LONG_DOUBLE],$snv_long_double,
[Define this to the long+double type])
-AC_CHECK_TYPES([u_int, long long, uintmax_t])
+AC_CHECK_TYPES([u_int, long long, uintmax_t, mode_t, pid_t, size_t, uid_t,
gid_t])
AC_CHECK_SIZEOF(char*, 4)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
--- autogen-5.9.2.orig/config/snprintfv.m4 2007-07-28 22:01:51.000000000
+0200
+++ autogen-5.9.2/config/snprintfv.m4 2007-08-26 18:38:02.000000000 +0200
@@ -77,12 +77,8 @@
# ----------------------------------------------------------------------
# Checks for typedefs
# ----------------------------------------------------------------------
- AC_CHECK_TYPE(wchar_t, [], [
- AC_DEFINE_UNQUOTED([wchar_t], [unsigned int],
- [Define to `unsigned int' if not found])])
- AC_CHECK_TYPE(wint_t, [], [
- AC_DEFINE_UNQUOTED([wint_t], [unsigned int],
- [Define to `unsigned int' if not found])], [
+ AC_CHECK_TYPE(wchar_t)
+ AC_CHECK_TYPE(wint_t, [], [], [
AC_INCLUDES_DEFAULT
#if HAVE_RUNETYPE_H
# include <runetype.h>
@@ -91,9 +87,7 @@
# include <wchar.h>
#endif
])
- AC_CHECK_TYPE(long double)
- AC_CHECK_TYPE(intmax_t)
- AC_TYPE_SIZE_T
+ AC_CHECK_TYPES([long double, intmax_t, size_t])
# ----------------------------------------------------------------------
# Checks for library calls
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Autogen-users mailing list
Autogen-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/autogen-users