diff options
author | jim <jim@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-13 13:50:27 +0000 |
---|---|---|
committer | jim <jim@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-13 13:50:27 +0000 |
commit | ae783fa5215db6ec4d9f24275091b071377ed070 (patch) | |
tree | 9529e3992c8d4040ddea9963b42de69f6b835e4b | |
parent | f117153f29f3a9b27a1740a6dda53feb3d66e918 (diff) | |
download | libapr-ae783fa5215db6ec4d9f24275091b071377ed070.tar.gz |
More Darwin mojo magic. Use Apple's apr.h edits as a guide
and provide "hooks" to allow for other OS's to override at
app-compile time some values and be safe.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.4.x@824762 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | build/apr_hints.m4 | 3 | ||||
-rw-r--r-- | configure.in | 20 | ||||
-rw-r--r-- | include/apr.h.in | 12 | ||||
-rw-r--r-- | include/apr_os_override.h | 70 | ||||
-rw-r--r-- | include/arch/darwin/apr_darwin_types.h | 77 |
5 files changed, 173 insertions, 9 deletions
diff --git a/build/apr_hints.m4 b/build/apr_hints.m4 index 680cbf4b6..25d1e4d5d 100644 --- a/build/apr_hints.m4 +++ b/build/apr_hints.m4 @@ -203,6 +203,9 @@ dnl # Not a problem in 10.20. Otherwise, who knows? 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*) diff --git a/configure.in b/configure.in index a342c8412..df7de7790 100644 --- a/configure.in +++ b/configure.in @@ -25,6 +25,12 @@ sinclude(build/ltoptions.m4) sinclude(build/ltversion.m4) sinclude(build/lt~obsolete.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 */ @@ -34,10 +40,15 @@ AH_BOTTOM([ #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 @@ -1738,15 +1749,6 @@ elif test "$ac_cv_type_off_t" = "yes"; then else AC_ERROR([could not determine the size of off_t]) fi - # Per OS tuning... - case $host in - *apple-darwin10.*) - # off_t is a long long, but long == long long - if test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_long_long"; then - off_t_fmt='#define APR_OFF_T_FMT "lld"' - fi - ;; - esac else # Fallback on int off_t_value=apr_int32_t diff --git a/include/apr.h.in b/include/apr.h.in index 9f1fb6f99..acb096092 100644 --- a/include/apr.h.in +++ b/include/apr.h.in @@ -277,8 +277,18 @@ typedef unsigned @short_value@ apr_uint16_t; 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; @@ -505,6 +515,8 @@ typedef int uid_t; typedef int gid_t; #endif +#include "apr_os_override.h" + #ifdef __cplusplus } #endif diff --git a/include/apr_os_override.h b/include/apr_os_override.h new file mode 100644 index 000000000..bfef893c7 --- /dev/null +++ b/include/apr_os_override.h @@ -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 */ diff --git a/include/arch/darwin/apr_darwin_types.h b/include/arch/darwin/apr_darwin_types.h new file mode 100644 index 000000000..1fc12fa71 --- /dev/null +++ b/include/arch/darwin/apr_darwin_types.h @@ -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 */ |