apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barry Scott <ba...@barrys-emacs.org>
Subject Re: Mac OS X Universal builds and APR
Date Sat, 24 Oct 2009 12:16:31 GMT

On 22 Oct 2009, at 20:47, Barry Scott wrote:

>
> On 20 Oct 2009, at 22:30, Jeff Trawick wrote:
>
>> On Tue, Oct 20, 2009 at 4:54 PM, Barry Scott <barry@barrys- 
>> emacs.org> wrote:
>>>
>>> On 20 Oct 2009, at 04:18, Branko ─îibej wrote:
>>>
>>>> Barry Scott wrote:
>>>>>
>>>>> I think the problem is that configure is used to find out things  
>>>>> that
>>>>> change arch to arch
>>>>> like void * size rather then using preprocessor detection of those
>>>>> things.
>>>>
>>>> I wonder, how do you detect the size of void* with the  
>>>> preprocessor in
>>>> C? The preprocessor doesn't understand sizeof.
>>>
>>> You detect that its a build on mac os x and then use the CPU  
>>> feature macros
>>> that the compiler defines to choose 4 or 8. You end up writing  
>>> code like
>>> this:
>>>
>>> #ifdef __APPLE__
>>> #ifdef __x86_64__
>>> its Mac intel 64
>>> #endif
>>> etc...


I have build subversion and apr twice for i386 and x86_64.
Then I'm writting scripts to merge the two trees of build files
into a single FAT binary kit with FAT libs and header files.

The binary code can be handled this way. But the headers
cannot as some are different. I'm going to have to do something
like:

copy i386 version of apr.h to i386-apr.h
copy x86_64 version of apr.h to x86_64.apr.h

create a wrapper apr.h

#ifdef __LP64__
#include "x86_64-apr.h"
#else
#include "i386-apr.h"
#endif

Below is details of the diffs I see.

Here is a diff between building for i386 and x86_64.

diff -u /usr/local/svn-1.6.6-i386-pad-pad-pad-pad-pad-pad-pad-pad-pad- 
pad-pad-pad-pad-pad-pad-pad-pad-pad-pad-pad-pad/./include/apr-1/apu.h / 
usr/local/svn-1.6.6-x86_64-pad-pad-pad-pad-pad-pad-pad-pad-pad-pad-pad- 
pad-pad-pad-pad-pad-pad-pad-pad-pad-pad/./include/apr-1/apu.h
--- /usr/local/svn-1.6.6-i386-pad-pad-pad-pad-pad-pad-pad-pad-pad-pad- 
pad-pad-pad-pad-pad-pad-pad-pad-pad-pad-pad/./include/apr-1/apu.h	 
2009-10-24 12:54:18.000000000 +0100
+++ /usr/local/svn-1.6.6-x86_64-pad-pad-pad-pad-pad-pad-pad-pad-pad- 
pad-pad-pad-pad-pad-pad-pad-pad-pad-pad-pad-pad/./include/apr-1/apu.h	 
2009-10-24 12:54:26.000000000 +0100
@@ -100,7 +100,7 @@
  #define APU_HAVE_SQLITE2       0
  #define APU_HAVE_ORACLE        0
  #define APU_HAVE_FREETDS       0
-#define APU_HAVE_ODBC          0
+#define APU_HAVE_ODBC          1

  #define APU_HAVE_APR_ICONV     0
  #define APU_HAVE_ICONV         1

It seems that ODBC is not in both i386 and x86_64.

diff -u /usr/local/svn-1.6.6-i386-pad-pad-pad-pad-pad-pad-pad-pad-pad- 
pad-pad-pad-pad-pad-pad-pad-pad-pad-pad-pad-pad/./include/apr-1/apr.h / 
usr/local/svn-1.6.6-x86_64-pad-pad-pad-pad-pad-pad-pad-pad-pad-pad-pad- 
pad-pad-pad-pad-pad-pad-pad-pad-pad-pad/./include/apr-1/apr.h
--- /usr/local/svn-1.6.6-i386-pad-pad-pad-pad-pad-pad-pad-pad-pad-pad- 
pad-pad-pad-pad-pad-pad-pad-pad-pad-pad-pad/./include/apr-1/apr.h	 
2009-10-24 12:54:17.000000000 +0100
+++ /usr/local/svn-1.6.6-x86_64-pad-pad-pad-pad-pad-pad-pad-pad-pad- 
pad-pad-pad-pad-pad-pad-pad-pad-pad-pad-pad-pad/./include/apr-1/apr.h	 
2009-10-24 12:54:25.000000000 +0100
@@ -239,7 +239,7 @@
  #define APR_HAS_UNICODE_FS        0
  #define APR_HAS_PROC_INVOKED      0
  #define APR_HAS_USER              1
-#define APR_HAS_LARGE_FILES       1
+#define APR_HAS_LARGE_FILES       0
  #define APR_HAS_XTHREAD_FILES     0
  #define APR_HAS_OS_UUID           1

@@ -277,8 +277,8 @@
  typedef  int             apr_int32_t;
  typedef  unsigned int    apr_uint32_t;

-typedef  long long            apr_int64_t;
-typedef  unsigned long long   apr_uint64_t;
+typedef  long            apr_int64_t;
+typedef  unsigned long   apr_uint64_t;

  typedef  size_t          apr_size_t;
  typedef  ssize_t         apr_ssize_t;
@@ -286,7 +286,7 @@
  typedef  socklen_t       apr_socklen_t;
  typedef  ino_t           apr_ino_t;

-#define APR_SIZEOF_VOIDP 4
+#define APR_SIZEOF_VOIDP 8

  #if APR_SIZEOF_VOIDP == 8
  typedef  apr_uint64_t            apr_uintptr_t;
@@ -448,19 +448,19 @@
  #define APR_SIZE_T_FMT "lu"

  /* And APR_OFF_T_FMT */
-#define APR_OFF_T_FMT APR_INT64_T_FMT
+#define APR_OFF_T_FMT "ld"

  /* And APR_PID_T_FMT */
  #define APR_PID_T_FMT "d"

  /* And APR_INT64_T_FMT */
-#define APR_INT64_T_FMT "lld"
+#define APR_INT64_T_FMT "ld"

  /* And APR_UINT64_T_FMT */
-#define APR_UINT64_T_FMT "llu"
+#define APR_UINT64_T_FMT "lu"

  /* And APR_UINT64_T_HEX_FMT */
-#define APR_UINT64_T_HEX_FMT "llx"
+#define APR_UINT64_T_HEX_FMT "lx"

  /* Does the proc mutex lock threads too */
  #define APR_PROC_MUTEX_IS_GLOBAL      0

Most of the diff here can be avoided by using stdint.h as far as I can  
see.
Only one I'm not sure of is APR_HAS_LARGE_FILES. Is that set based on
64bit or not?

Barry



Mime
View raw message