Details
Description
Extracting Axis2/C from axis2c-src-1.6.0.tar.gz and building on MacOS X 10.6.6 does not work with some adjustments.
(1) The build in utils uses unknown GCC option -Wno-long-double (configure.ac).
(2) The header util/include/platforms/unix/axutil_unix.h has an unusual declaration for usleep() that breaks on MacOS X.
(3) The source file util/src/dir_handler.c has some code to handle the non-POSIX-compliant MacOS X specification of scandir(), but it is incomplete at best.
This patch - available by email on request - fixes the problems for me. I've demonstrated the source code changes; I have problems with rebuilding the libtool after modifying configure.ac, which I assume are related to the libtool available to me. Manually editing the dozen or so Makefiles containing -Wno-long-double allows the build to proceed smoothly.
— axis2c-src-1.6.0/util/src/dir_handler.c 2009-04-05 21:49:04.000000000 -0700
+++ axis2c-src-1.6.0-mac/util/src/dir_handler.c 2011-01-07 16:01:28.000000000 -0800
@@ -28,20 +28,28 @@
#include <minizip/axis2_archive_extract.h>
#endif
+/*
+ * POSIX 1003.1-2008 requires:
+ * int alphasort(const struct dirent **d1, const struct dirent **d2);
+ * int scandir(const char *dir, struct dirent ***namelist,
+ * int (*sel)(const struct dirent *),
+ * int (*compar)(const struct dirent **, const struct dirent **));
+ * On MacOS X (10.6.6 and earlier), the 'sel' callback takes a non-const
+ * 'struct dirent *'. Other platforms are more strictly POSIX
+ * compliant. FILE_SELECT_ARGTYPE encapsulates this difference.
+ */
+#ifdef IS_MACOSX
+#define FILE_SELECT_ARGTYPE struct dirent
+#else
+#define FILE_SELECT_ARGTYPE const struct dirent
+#endif
extern int AXIS2_ALPHASORT(
);
-#ifdef IS_MACOSX
-int dir_select(
- struct dirent *entry);
-int file_select( - const struct dirent *entry);
-#else
int dir_select( - const struct dirent *entry);
+ FILE_SELECT_ARGTYPE *entry);
int file_select( - const struct dirent *entry);
-#endif
+ FILE_SELECT_ARGTYPE *entry);
/**
- List the dll files in the given service or module folder path
@@ -323,14 +331,8 @@
int
file_select(
- const struct dirent *entry)
+ FILE_SELECT_ARGTYPE *entry) { - - #ifdef IS_MACOSX - int file_select(struct dirent *entry); - #else - int file_select(const struct dirent *entry); - #endif /** FIXME: * This block of code has been sitting here doing nothing. * I have made the existing logic use this code portion. @@ -353,15 +355,9 @@ return (AXIS2_FALSE); }
-#ifdef IS_MACOSX
int
dir_select(
- struct dirent *entry)
-#else
-int
-dir_select( - const struct dirent *entry)
-#endif
+ FILE_SELECT_ARGTYPE *entry)
{
struct stat stat_p;
— axis2c-src-1.6.0/util/include/platforms/unix/axutil_unix.h 2009-04-05 21:48:47.000000000 -0700
+++ axis2c-src-1.6.0-mac/util/include/platforms/unix/axutil_unix.h 2011-01-07 15:40:52.000000000 -0800
@@ -122,7 +122,9 @@
/* for file access handling */
#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#ifndef IS_MACOSX
extern int usleep (__useconds_t __useconds);
+#endif /* IS_MACOSX */
#endif /*HAVE_UNISTD_H */
/* network handling */
— axis2c-src-1.6.0/util/configure.ac 2009-04-05 21:49:04.000000000 -0700
+++ axis2c-src-1.6.0-mac/util/configure.ac 2011-01-07 16:51:36.000000000 -0800
@@ -135,11 +135,24 @@
;;
darwin*)
darwin=yes
- if test x"$GCC" = xyes
- then
- CFLAGS="$CFLAGS -Wno-long-double"
- CXXFLAGS="$CXXFLAGS -Wno-long-double"
- fi
+ # GCC option -Wno-long-double is neither supported by GCC 4.2.1 as
+ # distributed by Apple (with Xcode 3.2.5) nor by GCC 4.5.2, with
+ # builds on MacOS X 10.6.[56]. Since Linux versions of GCC 4.1.2
+ # do not support the option either, it probably belongs to a time long
+ # past (though there was a faintly related item for GCC 4.6 dated
+ # 2011-01-04 at http://gcc.gnu.org/ml/gcc-bugs/2011-01/msg00258.html).
+ # I could find no mention of adding or removing -Wno-long-double in
+ # GCC change notes back to v3.1. It may have been a special option
+ # added by Apple, but I've not located any information to confirm
+ # that, either. Since the axis2c-src-1.6.0.MacOSX-10.5.5.patch
+ # available on the Internet did not fix this, the option may have been
+ # valid for the Leopard (10.5.x) version of MacOS X. If so, this test
+ # needs to be made more sensitive, somehow.
+ #if test x"$GCC" = xyes
+ #then
+ # CFLAGS="$CFLAGS -Wno-long-double"
+ # CXXFLAGS="$CXXFLAGS -Wno-long-double"
+ #fi
;;
solaris*)
solaris=yes
It is not clear if the FIXME block in function file_select() in dir_handler.c belongs with the code I removed or relates to something following. I think it could be removed too, but did not risk it.
I note that I found a patch file axis2c-src-1.6.0-MacOSX-10.5.5.patch on the internet. It has loosely equivalent fixes for the source code problems - more hack-like and less engineered IMNSHO - but does not address the configure.ac issue at all. I'm not sure what that means about -Wno-long-double and MacOS X Leopard (10.5.x) compared with Snow Leopard (10.6.x).