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 2009/10/13 15:58:20 UTC

svn commit: r824767 - in /apr/apr/trunk: build/apr_hints.m4 configure.in include/apr.h.in include/apr_os_override.h include/arch/darwin/ include/arch/darwin/apr_darwin_types.h

Author: jim
Date: Tue Oct 13 13:58:19 2009
New Revision: 824767

URL: http://svn.apache.org/viewvc?rev=824767&view=rev
Log:
More Darwin mojo due to 64 and 32 bit multi-arches. The
deal is we need to install headers that work both when
installed and used for both 32 and 64 bit builds, ie:
at compile time. Uses Apple's own apr.h edits as a guide.

Added:
    apr/apr/trunk/include/apr_os_override.h   (with props)
    apr/apr/trunk/include/arch/darwin/
    apr/apr/trunk/include/arch/darwin/apr_darwin_types.h   (with props)
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=824767&r1=824766&r2=824767&view=diff
==============================================================================
--- apr/apr/trunk/build/apr_hints.m4 (original)
+++ apr/apr/trunk/build/apr_hints.m4 Tue Oct 13 13:58:19 2009
@@ -203,6 +203,9 @@
                 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=824767&r1=824766&r2=824767&view=diff
==============================================================================
--- apr/apr/trunk/configure.in (original)
+++ apr/apr/trunk/configure.in Tue Oct 13 13:58:19 2009
@@ -34,6 +34,12 @@
 sinclude(build/dbd.m4)
 sinclude(build/dso.m4)
 
+dnl Hard-coded top of apr_private.h:
+AH_TOP([
+#ifndef APR_PRIVATE_H
+#define APR_PRIVATE_H
+])
+
 dnl Hard-coded inclusion at the tail end of apr_private.h:
 AH_BOTTOM([
 /* switch this on if we have a BeOS version below BONE */
@@ -43,10 +49,15 @@
 #define BEOS_BONE 1
 #endif
 
+#ifdef DARWIN_10
+#include "../darwin/apr_darwin_types.h"
+#endif
+
 /*
  * Include common private declarations.
  */
 #include "../apr_private_common.h"
+#endif /* APR_PRIVATE_H */
 ])
 
 dnl Save user-defined environment settings for later restoration

Modified: apr/apr/trunk/include/apr.h.in
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr.h.in?rev=824767&r1=824766&r2=824767&view=diff
==============================================================================
--- apr/apr/trunk/include/apr.h.in (original)
+++ apr/apr/trunk/include/apr.h.in Tue Oct 13 13:58:19 2009
@@ -278,8 +278,18 @@
 typedef  @int_value@             apr_int32_t;
 typedef  unsigned @int_value@    apr_uint32_t;
 
+#ifdef DARWIN_10
+#ifdef __LP64__
+typedef  long            apr_int64_t;
+typedef  unsigned long   apr_uint64_t;
+#else
+typedef  long long            apr_int64_t;
+typedef  unsigned long long   apr_uint64_t;
+#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;
@@ -506,6 +516,8 @@
 typedef  int         gid_t;
 #endif
 
+#include "apr_os_override.h"
+
 #ifdef __cplusplus
 }
 #endif

Added: apr/apr/trunk/include/apr_os_override.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_os_override.h?rev=824767&view=auto
==============================================================================
--- apr/apr/trunk/include/apr_os_override.h (added)
+++ apr/apr/trunk/include/apr_os_override.h Tue Oct 13 13:58:19 2009
@@ -0,0 +1,70 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef APR_OS_OVERRIDE_H
+#define APR_OS_OVERRIDE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#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 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* APR_OS_OVERRIDE_H */

Propchange: apr/apr/trunk/include/apr_os_override.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: apr/apr/trunk/include/arch/darwin/apr_darwin_types.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/arch/darwin/apr_darwin_types.h?rev=824767&view=auto
==============================================================================
--- apr/apr/trunk/include/arch/darwin/apr_darwin_types.h (added)
+++ apr/apr/trunk/include/arch/darwin/apr_darwin_types.h Tue Oct 13 13:58:19 2009
@@ -0,0 +1,77 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef APR_DARWIN_TYPES_H
+#define APR_DARWIN_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#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
+ */
+#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
+
+#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
+#else
+ #define APR_INT64_STRFN strtoll
+ #define SIZEOF_LONG    4
+ #define SIZEOF_SIZE_T  4
+ #define SIZEOF_SSIZE_T 4
+ #define SIZEOF_VOIDP   4
+#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 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* APR_DARWIN_TYPES_H */

Propchange: apr/apr/trunk/include/arch/darwin/apr_darwin_types.h
------------------------------------------------------------------------------
    svn:eol-style = native



Re: svn commit: r824767 - in /apr/apr/trunk: build/apr_hints.m4 configure.in include/apr.h.in include/apr_os_override.h include/arch/darwin/ include/arch/darwin/apr_darwin_types.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Oct 13, 2009, at 11:18 AM, Joe Orton wrote:

> On Tue, Oct 13, 2009 at 01:58:20PM -0000, Jim Jagielski wrote:
>> Author: jim
>> Date: Tue Oct 13 13:58:19 2009
>> New Revision: 824767
>>
>> URL: http://svn.apache.org/viewvc?rev=824767&view=rev
>> Log:
>> More Darwin mojo due to 64 and 32 bit multi-arches. The
>> deal is we need to install headers that work both when
>> installed and used for both 32 and 64 bit builds, ie:
>> at compile time. Uses Apple's own apr.h edits as a guide.
>
> This is nuts, -1.

Reverting... we will just rely on others to fix our brokenness
with not being able to correctly handle Darwin and not even try.


Re: svn commit: r824767 - in /apr/apr/trunk: build/apr_hints.m4 configure.in include/apr.h.in include/apr_os_override.h include/arch/darwin/ include/arch/darwin/apr_darwin_types.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Oct 13, 2009, at 8:24 PM, William A. Rowe, Jr. wrote:

> Joe Orton wrote:
>> On Tue, Oct 13, 2009 at 01:58:20PM -0000, Jim Jagielski wrote:
>>> Author: jim
>>> Date: Tue Oct 13 13:58:19 2009
>>> New Revision: 824767
>>>
>>> URL: http://svn.apache.org/viewvc?rev=824767&view=rev
>>> Log:
>>> More Darwin mojo due to 64 and 32 bit multi-arches. The
>>> deal is we need to install headers that work both when
>>> installed and used for both 32 and 64 bit builds, ie:
>>> at compile time. Uses Apple's own apr.h edits as a guide.
>>
>> This is nuts, -1.  Set a flag in apr_hints.m4 to force the compiler  
>> to
>> pick a single ABI (whichever is the platform default), or fail and  
>> make
>> the user do that.  A compiler which is building for two completely
>> different ABIs simultaneously invalidates the results of the  
>> configure
>> script.  You have no way to tell whether any given configure test  
>> (now
>> and in the future) has the same result across both ABIs - you'd  
>> have to
>> check it manually for every single test.
>
> Joe; what you fail to realize is that your definition of 'nuts' is  
> precisely
> Apple's definition of an ABI (parallel, multiple platform  
> architectures).
>
> Not SXS style assemblies, but a single unified binary with multiple  
> states
> depending on the particular architecture (1 of many) being compiled.
>

Yep... but I can't implement anything due to the veto.

Re: svn commit: r824767 - in /apr/apr/trunk: build/apr_hints.m4 configure.in include/apr.h.in include/apr_os_override.h include/arch/darwin/ include/arch/darwin/apr_darwin_types.h

Posted by Joe Orton <jo...@redhat.com>.
On Wed, Oct 14, 2009 at 08:00:20AM -0400, Jim Jagielski wrote:
> On Oct 14, 2009, at 7:00 AM, Joe Orton wrote:
>> Reducing half of our configure-time tests to build-time compiler macro
>> tests for one platform is not going to be maintainable.  Why is it
>> useful for Joe Random APR User to be building for more than one ABI in
>> the first place?  Why the heck would he care?  Just pick a default and
>> run with it by setting $CC to select an ABI.
>
> If APR is built with i386, and installed, then any apps built for
> 64 bit will core dump on it. The reverse is true as well.

If APR changes $CC to force a platform ABI choice as I suggested, then 
any apps built against APR will be (must be) built using the same $CC, 
inherited via `apr-N-config --cc`.  Otherwise all bets are off, as has 
always been true.

> The default is to build for *both*. And when this is done, then
> the bit sizes locked in apr.h may or may not be correct depending
> on how you build the app that will be *using* it. The __LP64__
> tests in the apr.h (etal) files is to ensure that depending on
> how people are building *against an installed APR* will have
> the right values. Otherwise, anyone shipping an APR lib must
> built it for just 1 architecture and ensure that any consumers
> build against just that architecture.

Packagers/redistributors can build APR twice (or N times) and merge the 
results to get a "fat" binary - this is a problem for Darwin packagers, 
not for upstream.  From a 10 second google, this seems to be how Apple 
recommend you do it:

http://developer.apple.com/opensource/buildingopensourceuniversal.html

I would not be averse to including (configure --enable-flag conditional) 
a solution like the apr-wrapper.h we use in Fedora to allow distribution 
of a single arch-independent apr.h which will DTRT on multiple 
platforms, if there's wider support for that.  But that wouldn't 
distract from the need to build the thing twice and merge the results.

> At the very least we should create an APR define that specifies
> what bitsize was used

APR_SIZEOF_VOIDP?

Regards, Joe

Re: svn commit: r824767 - in /apr/apr/trunk: build/apr_hints.m4 configure.in include/apr.h.in include/apr_os_override.h include/arch/darwin/ include/arch/darwin/apr_darwin_types.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Oct 14, 2009, at 7:00 AM, Joe Orton wrote:

> On Tue, Oct 13, 2009 at 07:24:55PM -0500, William Rowe wrote:
>> Joe; what you fail to realize is that your definition of 'nuts' is  
>> precisely
>> Apple's definition of an ABI (parallel, multiple platform  
>> architectures).
>
> Eh?  The Reality Distortion Field does not extend to the definition of
> "ABI".  Apple support multiple platform ABIs and can build executables
> which contain multiple chunks of object code, each compiled for a
> different ABI/architecture.
>
> If the compiler is doing this by default, the results of the configure
> script *cannot* be relied upon to be accurate accross all the ABIs the
> compiler is using.  What do you disagree with in that statement?
>
> This starts at AC_CHECK_SIZEOF and goes all the way to the detection  
> of
> e.g. an expat library.  How do you know whether the detected expat is
> built for all the ABIs your compiler is building for?  Answer: you
> don't, you're guessing, and a configure script for which all the  
> results
> are only half true is worse than useless.
>
> Reducing half of our configure-time tests to build-time compiler macro
> tests for one platform is not going to be maintainable.  Why is it
> useful for Joe Random APR User to be building for more than one ABI in
> the first place?  Why the heck would he care?  Just pick a default and
> run with it by setting $CC to select an ABI.
>

If APR is built with i386, and installed, then any apps built for
64 bit will core dump on it. The reverse is true as well.

The default is to build for *both*. And when this is done, then
the bit sizes locked in apr.h may or may not be correct depending
on how you build the app that will be *using* it. The __LP64__
tests in the apr.h (etal) files is to ensure that depending on
how people are building *against an installed APR* will have
the right values. Otherwise, anyone shipping an APR lib must
built it for just 1 architecture and ensure that any consumers
build against just that architecture.

At the very least we should create an APR define that specifies
what bitsize was used when built for DARWIN, so at least consumers
can start testing that ("Oh, I see that apr.h defines APR_DARWIN_32
so that means that the installed APR was built for the -arch i386
arch, so I better not try to build subversion with -arch x86_64").

Re: svn commit: r824767 - in /apr/apr/trunk: build/apr_hints.m4 configure.in include/apr.h.in include/apr_os_override.h include/arch/darwin/ include/arch/darwin/apr_darwin_types.h

Posted by Joe Orton <jo...@redhat.com>.
On Tue, Oct 13, 2009 at 07:24:55PM -0500, William Rowe wrote:
> Joe; what you fail to realize is that your definition of 'nuts' is precisely
> Apple's definition of an ABI (parallel, multiple platform architectures).

Eh?  The Reality Distortion Field does not extend to the definition of 
"ABI".  Apple support multiple platform ABIs and can build executables 
which contain multiple chunks of object code, each compiled for a 
different ABI/architecture.

If the compiler is doing this by default, the results of the configure 
script *cannot* be relied upon to be accurate accross all the ABIs the 
compiler is using.  What do you disagree with in that statement?  

This starts at AC_CHECK_SIZEOF and goes all the way to the detection of 
e.g. an expat library.  How do you know whether the detected expat is 
built for all the ABIs your compiler is building for?  Answer: you 
don't, you're guessing, and a configure script for which all the results 
are only half true is worse than useless.

Reducing half of our configure-time tests to build-time compiler macro 
tests for one platform is not going to be maintainable.  Why is it 
useful for Joe Random APR User to be building for more than one ABI in 
the first place?  Why the heck would he care?  Just pick a default and 
run with it by setting $CC to select an ABI.

Regards, Joe

Re: svn commit: r824767 - in /apr/apr/trunk: build/apr_hints.m4 configure.in include/apr.h.in include/apr_os_override.h include/arch/darwin/ include/arch/darwin/apr_darwin_types.h

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Joe Orton wrote:
> On Tue, Oct 13, 2009 at 01:58:20PM -0000, Jim Jagielski wrote:
>> Author: jim
>> Date: Tue Oct 13 13:58:19 2009
>> New Revision: 824767
>>
>> URL: http://svn.apache.org/viewvc?rev=824767&view=rev
>> Log:
>> More Darwin mojo due to 64 and 32 bit multi-arches. The
>> deal is we need to install headers that work both when
>> installed and used for both 32 and 64 bit builds, ie:
>> at compile time. Uses Apple's own apr.h edits as a guide.
> 
> This is nuts, -1.  Set a flag in apr_hints.m4 to force the compiler to 
> pick a single ABI (whichever is the platform default), or fail and make 
> the user do that.  A compiler which is building for two completely 
> different ABIs simultaneously invalidates the results of the configure 
> script.  You have no way to tell whether any given configure test (now 
> and in the future) has the same result across both ABIs - you'd have to 
> check it manually for every single test.

Joe; what you fail to realize is that your definition of 'nuts' is precisely
Apple's definition of an ABI (parallel, multiple platform architectures).

Not SXS style assemblies, but a single unified binary with multiple states
depending on the particular architecture (1 of many) being compiled.


Re: svn commit: r824767 - in /apr/apr/trunk: build/apr_hints.m4 configure.in include/apr.h.in include/apr_os_override.h include/arch/darwin/ include/arch/darwin/apr_darwin_types.h

Posted by Joe Orton <jo...@redhat.com>.
On Tue, Oct 13, 2009 at 01:58:20PM -0000, Jim Jagielski wrote:
> Author: jim
> Date: Tue Oct 13 13:58:19 2009
> New Revision: 824767
> 
> URL: http://svn.apache.org/viewvc?rev=824767&view=rev
> Log:
> More Darwin mojo due to 64 and 32 bit multi-arches. The
> deal is we need to install headers that work both when
> installed and used for both 32 and 64 bit builds, ie:
> at compile time. Uses Apple's own apr.h edits as a guide.

This is nuts, -1.  Set a flag in apr_hints.m4 to force the compiler to 
pick a single ABI (whichever is the platform default), or fail and make 
the user do that.  A compiler which is building for two completely 
different ABIs simultaneously invalidates the results of the configure 
script.  You have no way to tell whether any given configure test (now 
and in the future) has the same result across both ABIs - you'd have to 
check it manually for every single test.

Regards, Joe