apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1050644 - in /apr/apr/trunk: build/apr_hints.m4 configure.in include/apr.h.in
Date Sat, 18 Dec 2010 14:56:48 GMT
Author: jim
Date: Sat Dec 18 14:56:47 2010
New Revision: 1050644

URL: http://svn.apache.org/viewvc?rev=1050644&view=rev
Log:
(Try to) support Darwin's "universal" builds by allowing for
2 separate bit sizes for some types in the same binary/library
(which is what a universal build is). As such, the C header files
need to know how the *current* codebase is being built (which
links to apr) and choose the correct bit size depending on
the compiler flags.

Modified:
    apr/apr/trunk/build/apr_hints.m4
    apr/apr/trunk/configure.in
    apr/apr/trunk/include/apr.h.in

Modified: apr/apr/trunk/build/apr_hints.m4
URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/apr_hints.m4?rev=1050644&r1=1050643&r2=1050644&view=diff
==============================================================================
--- apr/apr/trunk/build/apr_hints.m4 (original)
+++ apr/apr/trunk/build/apr_hints.m4 Sat Dec 18 14:56:47 2010
@@ -203,6 +203,9 @@ dnl	       # Not a problem in 10.20.  Ot
                 APR_SETIFNULL(ac_cv_func_kqueue, [no]) 
                 APR_SETIFNULL(ac_cv_func_poll, [no]) # See issue 34332
             ;;
+            *-apple-darwin10.*)
+                APR_ADDTO(CPPFLAGS, [-DDARWIN_10])
+            ;;
         esac
 	;;
     *-dec-osf*)

Modified: apr/apr/trunk/configure.in
URL: http://svn.apache.org/viewvc/apr/apr/trunk/configure.in?rev=1050644&r1=1050643&r2=1050644&view=diff
==============================================================================
--- apr/apr/trunk/configure.in (original)
+++ apr/apr/trunk/configure.in Sat Dec 18 14:56:47 2010
@@ -54,6 +54,66 @@ AH_BOTTOM([
 #define BEOS_BONE 1
 #endif
 
+/*
+ * Darwin 10's default compiler (gcc42) builds for both 64 and
+ * 32 bit architectures unless specifically told not to.
+ * In those cases, we need to override types depending on how
+ * we're being built at compile time.
+ * NOTE: This is an ugly work-around for Darwin's
+ * concept of universal binaries, a single package
+ * (executable, lib, etc...) which contains both 32
+ * and 64 bit versions. The issue is that if APR is
+ * built universally, if something else is compiled
+ * against it, some bit sizes will depend on whether
+ * it is 32 or 64 bit. This is determined by the __LP64__
+ * flag. Since we need to support both, we have to
+ * handle OS X unqiuely.
+ */
+#ifdef DARWIN_10
+
+#undef APR_OFF_T_STRFN
+#undef APR_INT64_STRFN
+#undef SIZEOF_LONG
+#undef SIZEOF_SIZE_T
+#undef SIZEOF_SSIZE_T
+#undef SIZEOF_VOIDP
+#undef SIZEOF_STRUCT_IOVEC
+
+#ifdef __LP64__
+ #define APR_INT64_STRFN strtol
+ #define SIZEOF_LONG    8
+ #define SIZEOF_SIZE_T  8
+ #define SIZEOF_SSIZE_T 8
+ #define SIZEOF_VOIDP   8
+ #define SIZEOF_STRUCT_IOVEC 16
+#else
+ #define APR_INT64_STRFN strtoll
+ #define SIZEOF_LONG    4
+ #define SIZEOF_SIZE_T  4
+ #define SIZEOF_SSIZE_T 4
+ #define SIZEOF_VOIDP   4
+ #define SIZEOF_STRUCT_IOVEC 8
+#endif
+
+/*
+ * ./i386/_types.h:typedef long long __int64_t;
+ * ./sys/_types.h:typedef __int64_t	__darwin_off_t;
+ * ./sys/types.h:typedef __darwin_off_t		off_t;
+ * So off_t is always long long
+ */
+#undef APR_OFF_T_STRFN
+#define APR_OFF_T_STRFN APR_INT64_STRFN
+ 
+
+#undef SETPGRP_VOID
+#ifdef __DARWIN_UNIX03
+ #define SETPGRP_VOID 1
+#else
+/* #undef SETPGRP_VOID */
+#endif
+ 
+#endif /* DARWIN_10 */
+
 #endif /* APR_PRIVATE_H */
 ])
 

Modified: apr/apr/trunk/include/apr.h.in
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr.h.in?rev=1050644&r1=1050643&r2=1050644&view=diff
==============================================================================
--- apr/apr/trunk/include/apr.h.in (original)
+++ apr/apr/trunk/include/apr.h.in Sat Dec 18 14:56:47 2010
@@ -332,8 +332,44 @@ typedef  unsigned @short_value@  apr_uin
 typedef  @int_value@             apr_int32_t;
 typedef  unsigned @int_value@    apr_uint32_t;
 
-typedef  @long_value@            apr_int64_t;
-typedef  unsigned @long_value@   apr_uint64_t;
+#define APR_SIZEOF_VOIDP @voidp_size@
+
+/*
+ * Darwin 10's default compiler (gcc42) builds for both 64 and
+ * 32 bit architectures unless specifically told not to.
+ * In those cases, we need to override types depending on how
+ * we're being built at compile time.
+ * NOTE: This is an ugly work-around for Darwin's
+ * concept of universal binaries, a single package
+ * (executable, lib, etc...) which contains both 32
+ * and 64 bit versions. The issue is that if APR is
+ * built universally, if something else is compiled
+ * against it, some bit sizes will depend on whether
+ * it is 32 or 64 bit. This is determined by the __LP64__
+ * flag. Since we need to support both, we have to
+ * handle OS X unqiuely.
+ */
+#ifdef DARWIN_10
+#undef APR_SIZEOF_VOIDP
+#undef INT64_C
+#undef UINT64_C
+#ifdef __LP64__
+ typedef  long            apr_int64_t;
+ typedef  unsigned long   apr_uint64_t;
+ #define APR_SIZEOF_VOIDP     8
+ #define INT64_C(v)   (v ## L)
+ #define UINT64_C(v)  (v ## UL)
+#else
+ typedef  long long            apr_int64_t;
+ typedef  unsigned long long   apr_uint64_t;
+ #define APR_SIZEOF_VOIDP     4
+ #define INT64_C(v)   (v ## LL)
+ #define UINT64_C(v)  (v ## ULL)
+#endif
+#else
+ typedef  @long_value@            apr_int64_t;
+ typedef  unsigned @long_value@   apr_uint64_t;
+#endif
 
 typedef  @size_t_value@          apr_size_t;
 typedef  @ssize_t_value@         apr_ssize_t;
@@ -341,8 +377,6 @@ typedef  @off_t_value@           apr_off
 typedef  @socklen_t_value@       apr_socklen_t;
 typedef  @ino_t_value@           apr_ino_t;
 
-#define APR_SIZEOF_VOIDP @voidp_size@
-
 #if APR_SIZEOF_VOIDP == 8
 typedef  apr_uint64_t            apr_uintptr_t;
 #else
@@ -518,6 +552,7 @@ typedef  apr_uint32_t            apr_uin
  * to find the logic for this definition search for "ssize_t_fmt" in
  * configure.in.
  */
+
 @ssize_t_fmt@
 
 /* And APR_SIZE_T_FMT */
@@ -538,6 +573,49 @@ typedef  apr_uint32_t            apr_uin
 /* And APR_UINT64_T_HEX_FMT */
 @uint64_t_hex_fmt@
 
+/*
+ * Ensure we work with universal binaries on Darwin
+ */
+#ifdef DARWIN_10
+
+#undef APR_HAS_LARGE_FILES
+#undef APR_SIZEOF_VOIDP
+#undef APR_INT64_T_FMT
+#undef APR_UINT64_T_FMT
+#undef APR_UINT64_T_HEX_FMT
+
+#ifdef __LP64__
+ #define APR_HAS_LARGE_FILES  0
+ #define APR_SIZEOF_VOIDP     8
+ #define APR_INT64_T_FMT      "ld"
+ #define APR_UINT64_T_FMT     "lu"
+ #define APR_UINT64_T_HEX_FMT "lx"
+#else
+ #define APR_HAS_LARGE_FILES  1
+ #define APR_SIZEOF_VOIDP     4
+ #define APR_INT64_T_FMT      "lld"
+ #define APR_UINT64_T_FMT     "llu"
+ #define APR_UINT64_T_HEX_FMT "llx"
+#endif
+
+#undef APR_IS_BIGENDIAN
+#ifdef __BIG_ENDIAN__
+ #define APR_IS_BIGENDIAN	1
+#else
+ #define APR_IS_BIGENDIAN	0
+#endif
+
+/*
+ * ./i386/_types.h:typedef long long __int64_t;
+ * ./sys/_types.h:typedef __int64_t	__darwin_off_t;
+ * ./sys/types.h:typedef __darwin_off_t		off_t;
+ * So off_t is always long long
+ */
+#undef APR_OFF_T_FMT
+#define APR_OFF_T_FMT "lld"
+
+#endif /* DARWIN_10 */
+
 /* Does the proc mutex lock threads too */
 #define APR_PROC_MUTEX_IS_GLOBAL      @proc_mutex_is_global@
 



Mime
View raw message