You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by ji...@apache.org on 2010/12/18 15:56:58 UTC

svn commit: r1050645 - in /apr/apr/branches/1.5.x: build/apr_hints.m4 configure.in include/apr.h.in

Author: jim
Date: Sat Dec 18 14:56:58 2010
New Revision: 1050645

URL: http://svn.apache.org/viewvc?rev=1050645&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/branches/1.5.x/build/apr_hints.m4
    apr/apr/branches/1.5.x/configure.in
    apr/apr/branches/1.5.x/include/apr.h.in

Modified: apr/apr/branches/1.5.x/build/apr_hints.m4
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/build/apr_hints.m4?rev=1050645&r1=1050644&r2=1050645&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/build/apr_hints.m4 (original)
+++ apr/apr/branches/1.5.x/build/apr_hints.m4 Sat Dec 18 14:56:58 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/branches/1.5.x/configure.in
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/configure.in?rev=1050645&r1=1050644&r2=1050645&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/configure.in (original)
+++ apr/apr/branches/1.5.x/configure.in Sat Dec 18 14:56:58 2010
@@ -43,6 +43,66 @@ AH_BOTTOM([
 #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 */
+
+/*
  * Include common private declarations.
  */
 #include "../apr_private_common.h"

Modified: apr/apr/branches/1.5.x/include/apr.h.in
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/include/apr.h.in?rev=1050645&r1=1050644&r2=1050645&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/include/apr.h.in (original)
+++ apr/apr/branches/1.5.x/include/apr.h.in Sat Dec 18 14:56:58 2010
@@ -277,8 +277,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;
@@ -286,8 +322,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
@@ -442,6 +476,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 */
@@ -462,6 +497,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@