diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2011-08-04 15:54:26 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2011-08-04 15:54:26 +0000 |
commit | 2e4c2297b9792d5a9ca193d98d5f71fce8b98757 (patch) | |
tree | d0cb0d288920007dc665cd04b3c23c45d19f466b | |
parent | 87a5fd7eb77c3a431685df04f351820fca2779af (diff) | |
download | ATCD-2e4c2297b9792d5a9ca193d98d5f71fce8b98757.tar.gz |
Thu Aug 4 15:03:16 UTC 2011 Phil Mesnier <mesnier_p@ociweb.com>
* ACE-INSTALL.html:
* ace/OS_NS_Thread.cpp:
* ace/OS_NS_errno.h:
* ace/OS_NS_time.h:
* ace/OS_NS_time.inl:
* ace/config-linux.h:
* ace/config-android.h:
* include/makeinclude/platform_linux_android.GNU:
Added configuration files and minor changes to allow building
for Android using the Android Native Development Kit's standalone
tool chain. http://developer.android.com/sdk/ndk/index.html
Android is not a completely tested platform and automated testing
does not work for it currently. Thanks to Trevor Fields of OCI
for doing the heavy lifting on preparing these changes.
* examples/APG/ThreadManagement/Async_Cancel.cpp:
* examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp:
* examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.inl:
* examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.inl:
* examples/Service_Configurator/IPC-tests/server/Handle_Thr_Stream.cpp:
* examples/System_V_IPC/SV_Message_Queues/TMQ_Client.cpp:
Add wrappers necessary to get them working with Android.
* tests/Thread_Attrs_Test.cpp:
* tests/test_config.h:
Minor changes for running tests on Android.
-rw-r--r-- | ACE/ACE-INSTALL.html | 61 | ||||
-rw-r--r-- | ACE/ChangeLog | 32 | ||||
-rw-r--r-- | ACE/ace/OS_NS_Thread.cpp | 2 | ||||
-rw-r--r-- | ACE/ace/OS_NS_errno.h | 6 | ||||
-rw-r--r-- | ACE/ace/OS_NS_time.h | 23 | ||||
-rw-r--r-- | ACE/ace/OS_NS_time.inl | 42 | ||||
-rw-r--r-- | ACE/ace/config-android.h | 432 | ||||
-rw-r--r-- | ACE/ace/config-linux.h | 2 | ||||
-rw-r--r-- | ACE/examples/APG/ThreadManagement/Async_Cancel.cpp | 2 | ||||
-rw-r--r-- | ACE/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp | 6 | ||||
-rw-r--r-- | ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.inl | 9 | ||||
-rw-r--r-- | ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.inl | 10 | ||||
-rw-r--r-- | ACE/examples/Service_Configurator/IPC-tests/server/Handle_Thr_Stream.cpp | 5 | ||||
-rw-r--r-- | ACE/examples/System_V_IPC/SV_Message_Queues/TMQ_Client.cpp | 6 | ||||
-rw-r--r-- | ACE/include/makeinclude/platform_linux_android.GNU | 88 | ||||
-rw-r--r-- | ACE/tests/Thread_Attrs_Test.cpp | 2 | ||||
-rw-r--r-- | ACE/tests/test_config.h | 4 |
17 files changed, 726 insertions, 6 deletions
diff --git a/ACE/ACE-INSTALL.html b/ACE/ACE-INSTALL.html index d0d2d8ef23c..3b275a8ebc0 100644 --- a/ACE/ACE-INSTALL.html +++ b/ACE/ACE-INSTALL.html @@ -1772,6 +1772,67 @@ symbols will be created and the build will huge in size. The debug symbols are necessary when you want to debug your code.</p> <p></p><hr align="left" width="50%"> + +<p></p><h2><a name="android">Building and Installing ACE on Android</a></h2> +<p>ACE can be built for Android by using the Android Native Development +Kit's <b>standalone toolchain</b>. The compilation creates native binaries, +not the standard Android Java applications. The native binary applications +that use ACE can be run by either a shell or using the Java Runtime exec +operation.</p> + +<p>Due to Android's library loading restrictions, static linking is necessary + for all included libraries.</p> + +<p>Compilation requires using the NDK's standalone toolchain for it's +exception and RTTI support. The standard NDK compiler is not identified + as supporting exceptions or RTTI, as of NDK r5c.</p> + +<p>It is not recommended to perform the build on a Windows host. Using the +NDK r5c, compilation issues were encountered on Windows XP, when the compiler +failed to recognize the name difference between the ACE file Signal.h and +the system file signal.h.</p> + +<p>You should be able to follow the instructions above to build ACE +and applications that use it. Use the +<a href="#unix_traditional">Unix traditional instructions</a> above to build +ACE and the applications that use it. Building TAO for Android requires +cross compiling the code.<p> + +<p>Basic steps to build +<ul> + <li>Setup up the standalone compiler toolchain by following the + instructions provided with the Android NDK.</li> + <li>If building TAO, build the ACE and TAO tools (<code>ace_gperf</code> and + <code>tao_idl</code>) for the compiling host. Follow the cross compilation setup instructions provide + in $TAO_ROOT/TAO-INSTALL.html. Search for "Using cross compilation".</li> + <ul> + <li>Setup the Android build<ul> + <li>Create <code>ace/config.h</code>: <i>#include "ace/config-linux-android.h"</i></li> + <li>Create <code>include/makeinclude/platform_macros.GNU</code>:<ul> + <li>Set the CC, CXX, AR values to the standalone toolchain compilers and archiver.</li> + <li>Include the <code>include/makeinclude/platform_linux_android.GNU</code> file.</li> + <li>If building TAO, set the tao idl options specified in the cross compiling instructions in <code>TAO-INSTALL.html</code></li> + </ul> + </li> + </ul> + </li> + <li>Generate makefiles (if necessary).</li> + <li>Build with GNU make.</li> + </ul> +</ul> +</p> + +<p>Native applications using the ACE library can be installed onto devices by +several different methods. The files can be include as assets of Java +application and can be written by the Java application into it's executable +program directory. The native application can be downloaded by a Java +application and written into the Java applications executable program +directory. The native application can also be uploaded using the Software +Development Kit's ADB tool. This method requires uploading the native +application to a directory that allows execution and having any output +directed to a writable directory.</p> + +<p></p><hr align="left" width="50%"> <hr> <h1><a name="svcsinstall">Building and Installing ACE Network Services</a></h1> diff --git a/ACE/ChangeLog b/ACE/ChangeLog index f3ca073c875..242e3aa11d3 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,35 @@ +Thu Aug 4 15:03:16 UTC 2011 Phil Mesnier <mesnier_p@ociweb.com> + + * ACE-INSTALL.html: + * ace/OS_NS_Thread.cpp: + * ace/OS_NS_errno.h: + * ace/OS_NS_time.h: + * ace/OS_NS_time.inl: + * ace/config-linux.h: + * ace/config-android.h: + * include/makeinclude/platform_linux_android.GNU: + + Added configuration files and minor changes to allow building + for Android using the Android Native Development Kit's standalone + tool chain. http://developer.android.com/sdk/ndk/index.html + Android is not a completely tested platform and automated testing + does not work for it currently. Thanks to Trevor Fields of OCI + for doing the heavy lifting on preparing these changes. + + * examples/APG/ThreadManagement/Async_Cancel.cpp: + * examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp: + * examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.inl: + * examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.inl: + * examples/Service_Configurator/IPC-tests/server/Handle_Thr_Stream.cpp: + * examples/System_V_IPC/SV_Message_Queues/TMQ_Client.cpp: + + Add wrappers necessary to get them working with Android. + + * tests/Thread_Attrs_Test.cpp: + * tests/test_config.h: + + Minor changes for running tests on Android. + Sun Jul 31 11:14:23 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> * bin/generate_doxygen.pl: diff --git a/ACE/ace/OS_NS_Thread.cpp b/ACE/ace/OS_NS_Thread.cpp index c0a1d0b4e39..7380b84e522 100644 --- a/ACE/ace/OS_NS_Thread.cpp +++ b/ACE/ace/OS_NS_Thread.cpp @@ -4082,6 +4082,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func, } } +# if !defined (ACE_LACKS_SETINHERITSCHED) // *** Set scheduling explicit or inherited if (ACE_BIT_ENABLED (flags, THR_INHERIT_SCHED) || ACE_BIT_ENABLED (flags, THR_EXPLICIT_SCHED)) @@ -4095,6 +4096,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func, return -1; } } +# endif /* ACE_LACKS_SETINHERITSCHED */ # else /* ACE_LACKS_SETSCHED */ ACE_UNUSED_ARG (priority); # endif /* ACE_LACKS_SETSCHED */ diff --git a/ACE/ace/OS_NS_errno.h b/ACE/ace/OS_NS_errno.h index 42894742c97..6bbef2f1056 100644 --- a/ACE/ace/OS_NS_errno.h +++ b/ACE/ace/OS_NS_errno.h @@ -84,7 +84,11 @@ private: # define ACE_ERRNO_TYPE ACE_CE_Errno # define ACE_ERRNO_GET ACE_CE_Errno::instance ()->operator int() #else -# define ACE_ERRNO_TYPE int +# if defined (ACE_HAS_VOLATILE_ERRNO) +# define ACE_ERRNO_TYPE volatile int +# else +# define ACE_ERRNO_TYPE int +# endif /* ACE_HAS_VOLATILE_ERRNO */ # define ACE_ERRNO_GET errno #endif /* ACE_HAS_WINCE_BROKEN_ERRNO */ diff --git a/ACE/ace/OS_NS_time.h b/ACE/ace/OS_NS_time.h index f50bb23a61f..e5ae0bb2951 100644 --- a/ACE/ace/OS_NS_time.h +++ b/ACE/ace/OS_NS_time.h @@ -216,6 +216,29 @@ namespace ACE_OS struct tm *localtime_r (const time_t *clock, struct tm *res); +#if defined (ACE_USES_ULONG_FOR_STAT_TIME) + ACE_NAMESPACE_INLINE_FUNCTION + ACE_TCHAR *ctime (const unsigned long *t); + + ACE_NAMESPACE_INLINE_FUNCTION + ACE_TCHAR *ctime_r (const unsigned long *clock, ACE_TCHAR *buf, int buflen); + + ACE_NAMESPACE_INLINE_FUNCTION + struct tm *gmtime (const unsigned long *clock); + + ACE_NAMESPACE_INLINE_FUNCTION + struct tm *gmtime_r (const unsigned long *clock, + struct tm *res); + + ACE_NAMESPACE_INLINE_FUNCTION + struct tm *localtime (const unsigned long *clock); + + ACE_NAMESPACE_INLINE_FUNCTION + struct tm *localtime_r (const unsigned long *clock, + struct tm *res); +#endif + + // Get the current time. extern ACE_Export time_t mktime (struct tm *timeptr); diff --git a/ACE/ace/OS_NS_time.inl b/ACE/ace/OS_NS_time.inl index d3cde838580..b348be5ca69 100644 --- a/ACE/ace/OS_NS_time.inl +++ b/ACE/ace/OS_NS_time.inl @@ -199,6 +199,48 @@ ACE_OS::ctime_r (const time_t *t, ACE_TCHAR *buf, int buflen) } #endif /* !ACE_HAS_WINCE */ +#if defined (ACE_USES_ULONG_FOR_STAT_TIME) +ACE_INLINE ACE_TCHAR * +ACE_OS::ctime (unsigned long *t) +{ + return ACE_OS::ctime (static_cast<time_t *>(t)); +} + +ACE_INLINE ACE_TCHAR * +ACE_OS::ctime_r (unsigned long *clock, ACE_TCHAR *buf, int buflen) +{ + return ACE_OS::ctime_r (static_cast<time_t *>(clock), buf, buflen); +} + +ACE_INLINE struct tm * +ACE_OS::gmtime (const unsigned long *clock) +{ + return ACE_OS::gmtime (static_cast<time_t *>(clock)); +} + +ACE_INLINE struct tm * +ACE_OS::gmtime_r (const unsigned long *clock, + struct tm *res) +{ + return ACE_OS::gmtime_r (static_cast<time_t *>(clock), res); +} + +ACE_INLINE struct tm * +ACE_OS::localtime (const unsigned long *clock) +{ + return ACE_OS::localtime (static_cast<time_t *>(clock)); +} + +ACE_INLINE struct tm * +ACE_OS::localtime_r (const unsigned long *clock, + struct tm *res) +{ + return ACE_OS::localtime_r (static_cast<time_t *>(clock), res); +} + + +#endif + #if !defined (ACE_LACKS_DIFFTIME) ACE_INLINE double ACE_OS::difftime (time_t t1, time_t t0) diff --git a/ACE/ace/config-android.h b/ACE/ace/config-android.h new file mode 100644 index 00000000000..005180b27ed --- /dev/null +++ b/ACE/ace/config-android.h @@ -0,0 +1,432 @@ +// -*- C++ -*- +// +// $Id$ + +// The following configuration file is designed to work for Linux +// platforms using GNU C++. + +#ifndef ACE_CONFIG_ANDROID_H +#define ACE_CONFIG_ANDROID_H +#include /**/ "ace/pre.h" + +#define ACE_HAS_SIGINFO_T +#define ACE_HAS_SSIZE_T +// system errorno is a volatile int +#define ACE_HAS_VOLATILE_ERRNO + +#define ACE_HAS_PTHREADS_UNIX98_EXT + +// the android definition of struct stat{} uses +// unsigned long rather than time_t for st_[acm]time +// members of the stat struct used to report file +// status details. +#define ACE_USES_ULONG_FOR_STAT_TIME + +#define ACE_LACKS_NEW_H +#define ACE_LACKS_SEARCH_H +#define ACE_LACKS_SIGINFO_H +#define ACE_LACKS_STROPTS_H +#define ACE_LACKS_SYS_SEM_H +#define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_SYS_SHM_H +#define ACE_LACKS_SYS_SYSCTL_H +#define ACE_LACKS_UCONTEXT_H + +#define ACE_LACKS_CUSERID +#define ACE_LACKS_FD_MASK +#define ACE_LACKS_GETHOSTENT +#define ACE_LACKS_GETLOADAVG +#define ACE_LACKS_ISCTYPE +#define ACE_LACKS_LOG2 +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS +#define ACE_LACKS_PWD_FUNCTIONS +#define ACE_LACKS_PTHREAD_CANCEL +#define ACE_LACKS_SEEKDIR +#define ACE_LACKS_SEMBUF_T +#define ACE_LACKS_SETINHERITSCHED +#define ACE_LACKS_STRRECVFD +#define ACE_LACKS_SWAB +#define ACE_LACKS_SYSV_SHMEM +#define ACE_LACKS_TELLDIR +#define ACE_LACKS_WCSTOLL +#define ACE_LACKS_WCSTOULL + +#define ACE_LACKS_RAND_R + +// Android Standalone compiler std library does not include +// wide character support +// Used in tests/Sequence_Unit_Tests/string_sequence_tester.hpp +# define TAO_LACKS_WCHAR_CXX_STDLIB + + + +#if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +#endif + +#define ACE_PLATFORM_CONFIG config-linux-android.h + +//remove#define ACE_HAS_BYTESEX_H + +// Needed to differentiate between libc 5 and libc 6 (aka glibc). +#include <features.h> + +#if (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500) +# define ACE_HAS_PTHREADS_UNIX98_EXT +#endif /* _XOPEN_SOURCE - 0 >= 500 */ + +# include "ace/config-posix.h" + +#if !defined (ACE_LACKS_LINUX_NPTL) + + // Temporary fix because NPTL kernels do have shm_open but there is a problem + // with shm_open/shm_unlink pairing in ACE which needs to be fixed when I have time. +# if defined (ACE_HAS_SHM_OPEN) +# undef ACE_HAS_SHM_OPEN +# endif /* ACE_HAS_SHM_OPEN */ + +# if defined (ACE_USES_FIFO_SEM) + // Don't use this for Linux NPTL since this has complete + // POSIX semaphores which are more efficient +# undef ACE_USES_FIFO_SEM +# endif /* ACE_USES_FIFO_SEM */ + +# if defined (ACE_HAS_POSIX_SEM) + // Linux NPTL may not define the right POSIX macro + // but they have the actual runtime support for this stuff +# if !defined (ACE_HAS_POSIX_SEM_TIMEOUT) && (((_POSIX_C_SOURCE - 0) >= 200112L) || (_XOPEN_SOURCE >= 600)) +# define ACE_HAS_POSIX_SEM_TIMEOUT +# endif /* !ACE_HAS_POSIX_SEM_TIMEOUT && (((_POSIX_C_SOURCE - 0) >= 200112L) || (_XOPEN_SOURCE >= 600)) */ +# endif /* ACE_HAS_POSIX_SEM */ +#endif /* !ACE_LACKS_LINUX_NPTL */ + +// AIO support pulls in the rt library, which pulls in the pthread +// library. Disable AIO in single-threaded builds. +#if defined (ACE_HAS_THREADS) +# define ACE_HAS_CLOCK_GETTIME +//remove# define ACE_HAS_CLOCK_SETTIME +#else +# undef ACE_HAS_AIO_CALLS +#endif + +// First the machine specific part + +#if defined (__powerpc__) || defined (__x86_64__) +# if !defined (ACE_DEFAULT_BASE_ADDR) +# define ACE_DEFAULT_BASE_ADDR ((char *) 0x40000000) +# endif /* ! ACE_DEFAULT_BASE_ADDR */ +#elif defined (__ia64) +# if !defined (ACE_DEFAULT_BASE_ADDR) +// Zero base address should work fine for Linux of IA-64: it just lets +// the kernel to choose the right value. +# define ACE_DEFAULT_BASE_ADDR ((char *) 0x0000000000000000) +# endif /* ! ACE_DEFAULT_BASE_ADDR */ +#endif /* ! __powerpc__ && ! __ia64 */ + +// Then glibc/libc5 specific parts + +#if defined(__GLIBC__) +# if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 3) +# define ACE_HAS_RUSAGE_WHO_ENUM enum __rusage_who +# define ACE_HAS_RLIMIT_RESOURCE_ENUM enum __rlimit_resource +# define ACE_LACKS_ISCTYPE +# endif +# define ACE_HAS_SOCKLEN_T +# define ACE_HAS_4_4BSD_SENDMSG_RECVMSG + + // glibc defines both of these, used in OS_String. +# if defined (_GNU_SOURCE) +# define ACE_HAS_STRNLEN +# define ACE_HAS_WCSNLEN + + // This is probably not a 100%-sure-fire check... Red Hat Linux 9 + // and Enterprise Linux 3 and up have a new kernel that can send signals + // across threads. This was not possible prior because there was no real + // difference between a process and a thread. With this, the + // ACE_POSIX_SIG_Proactor is the only chance of getting asynch I/O working. + // There are restrictions, such as all socket operations being silently + // converted to synchronous by the kernel, that make aio a non-starter + // for most Linux platforms at this time. But we'll start to crawl... +# define ACE_POSIX_SIG_PROACTOR +# endif + + // To avoid the strangeness with Linux's ::select (), which modifies + // its timeout argument, use ::poll () instead. +# define ACE_HAS_POLL + +# define ACE_HAS_SIGINFO_T +# define ACE_LACKS_SIGINFO_H +# define ACE_HAS_UCONTEXT_T +# define ACE_HAS_SIGTIMEDWAIT + +#else /* ! __GLIBC__ */ + // Fixes a problem with some non-glibc versions of Linux... +# define ACE_LACKS_MADVISE +# define ACE_LACKS_MSG_ACCRIGHTS +#endif /* ! __GLIBC__ */ + +#define ACE_HAS_LSEEK64 +//#define ACE_LACKS_LSEEK64_PROTOTYPE + +#define ACE_HAS_P_READ_WRITE +// Use ACE's alternate cuserid() implementation since the use of the +// system cuserid() is discouraged. +#define ACE_HAS_ALT_CUSERID + +#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) +# define ACE_HAS_ISASTREAM_PROTOTYPE +# define ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE +# define ACE_HAS_CPU_SET_T +#endif /* __GLIBC__ > 2 || __GLIBC__ === 2 && __GLIBC_MINOR__ >= 3) */ + +// Then the compiler specific parts + +#if defined (__INTEL_COMPILER) +# include "ace/config-icc-common.h" +#elif defined (__GNUG__) + // config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so + // this must appear before its #include. +# define ACE_HAS_STRING_CLASS +# include "ace/config-g++-common.h" +# ifdef __clang__ +# undef ACE_HAS_GCC_ATOMIC_BUILTINS +# endif +#elif defined (__SUNCC_PRO) || defined (__SUNPRO_CC) +# include "ace/config-suncc-common.h" +#elif defined (__PGI) +// Portable group compiler +# define ACE_HAS_CPLUSPLUS_HEADERS +# define ACE_HAS_STDCPP_STL_INCLUDES +# define ACE_HAS_STANDARD_CPP_LIBRARY 1 +# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +# define ACE_LACKS_SWAB +#elif defined (__GNUC__) +/** + * GNU C compiler. + * + * We need to recognize the GNU C compiler since TAO has at least one + * C source header and file + * (TAO/orbsvcs/orbsvcs/SSLIOP/params_dup.{h,c}) that may indirectly + * include this + */ +#else /* ! __GNUG__ && !__DECCXX && !__INTEL_COMPILER && && !__PGI */ +# ifdef __cplusplus /* Let it slide for C compilers. */ +# error unsupported compiler in ace/config-linux.h +# endif /* __cplusplus */ +#endif /* ! __GNUG__*/ + +// Completely common part :-) + +// Platform/compiler has the sigwait(2) prototype +#define ACE_HAS_SIGWAIT + +#define ACE_HAS_SIGSUSPEND + +//remove#define ACE_HAS_UALARM + +#define ACE_HAS_STRSIGNAL + +#ifndef ACE_HAS_POSIX_REALTIME_SIGNALS +# define ACE_HAS_POSIX_REALTIME_SIGNALS +#endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */ + +#define ACE_HAS_XPG4_MULTIBYTE_CHAR +#define ACE_HAS_VFWPRINTF + +#define ACE_LACKS_ITOW +#define ACE_LACKS_WCSICMP +#define ACE_LACKS_WCSNICMP +#define ACE_LACKS_ISWASCII + +#define ACE_HAS_3_PARAM_WCSTOK + +#define ACE_HAS_3_PARAM_READDIR_R + +#if !defined (ACE_DEFAULT_BASE_ADDR) +# define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000) +#endif /* ! ACE_DEFAULT_BASE_ADDR */ + +#define ACE_HAS_ALLOCA + +// Compiler/platform has <alloca.h> +#define ACE_HAS_ALLOCA_H +#define ACE_HAS_SYS_SYSINFO_H +#define ACE_HAS_LINUX_SYSINFO + +// Compiler/platform has the getrusage() system call. +#define ACE_HAS_GETRUSAGE +#define ACE_HAS_GETRUSAGE_PROTOTYPE + +#define ACE_HAS_BYTESWAP_H +#define ACE_HAS_BSWAP_16 +#define ACE_HAS_BSWAP_32 + +#if defined (__GNUC__) +# define ACE_HAS_BSWAP_64 +#endif + +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +// Optimize ACE_Handle_Set for select(). +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +// ONLY define this if you have config'd multicast into a 2.0.34 or +// prior kernel. It is enabled by default in 2.0.35 kernels. +#if !defined (ACE_HAS_IP_MULTICAST) +# define ACE_HAS_IP_MULTICAST +#endif /* ! ACE_HAS_IP_MULTICAST */ + +// At least for IPv4, Linux lacks perfect filtering. +#if !defined ACE_LACKS_PERFECT_MULTICAST_FILTERING +# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 +#endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */ + +#define ACE_HAS_BIG_FD_SET + +// Linux defines struct msghdr in /usr/include/socket.h +#define ACE_HAS_MSG + +// Linux "improved" the interface to select() so that it modifies +// the struct timeval to reflect the amount of time not slept +// (see NOTES in Linux's select(2) man page). +#define ACE_HAS_NONCONST_SELECT_TIMEVAL + +#define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65535 + +#define ACE_CDR_IMPLEMENT_WITH_NATIVE_DOUBLE 1 + +#define ACE_HAS_GETPAGESIZE 1 + +// Platform defines struct timespec but not timespec_t +#define ACE_LACKS_TIMESPEC_T + +// Platform supplies scandir() +#define ACE_HAS_SCANDIR +#if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 10) +// Although the scandir man page says otherwise, this setting is correct. +// The setting was fixed in 2.10, so do not use the hack after that. +//remove#define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR +#endif + +// A conflict appears when including both <ucontext.h> and +// <sys/procfs.h> with recent glibc headers. +//#define ACE_HAS_PROC_FS + +// Platform supports System V IPC (most versions of UNIX, but not Win32) +//remove#define ACE_HAS_SYSV_IPC + +// Compiler/platform contains the <sys/syscall.h> file. +#define ACE_HAS_SYS_SYSCALL_H + +// Platform/compiler supports global timezone variable. +#define ACE_HAS_TIMEZONE + +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY + +// Compiler supports the ssize_t typedef. +#define ACE_HAS_SSIZE_T + +// Compiler/platform defines the sig_atomic_t typedef. +#define ACE_HAS_SIG_ATOMIC_T + +// Compiler/platform defines a union semun for SysV shared memory. +//remove#define ACE_HAS_SEMUN + +#define ACE_HAS_POSIX_TIME + +#define ACE_HAS_GPERF + +#define ACE_HAS_DIRENT + +// Starting with FC9 rawhide this file is not available anymore but +// this define is set +#if defined _XOPEN_STREAMS && _XOPEN_STREAMS == -1 +# define ACE_LACKS_STROPTS_H +# define ACE_LACKS_STRRECVFD +#endif + +#if !defined (ACE_LACKS_STROPTS_H) +# define ACE_HAS_STRBUF_T +#endif + +#if defined (__ia64) || defined(__alpha) || defined (__x86_64__) || defined(__powerpc64__) +// On 64 bit platforms, the "long" type is 64-bits. Override the +// default 32-bit platform-specific format specifiers appropriately. +# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%lu" +# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%ld" +# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" +#endif /* __ia64 */ + +#define ACE_SIZEOF_WCHAR 4 + +#if defined (__powerpc__) && !defined (ACE_SIZEOF_LONG_DOUBLE) +// 32bit PowerPC Linux uses 128bit long double +# define ACE_SIZEOF_LONG_DOUBLE 16 +#endif + +#define ACE_LACKS_GETIPNODEBYADDR +#define ACE_LACKS_GETIPNODEBYNAME + +// Platform has POSIX terminal interface. +#define ACE_HAS_TERMIOS + +// Linux implements sendfile(). +#define ACE_HAS_SENDFILE 1 + +#define ACE_HAS_VOIDPTR_MMAP + +#define ACE_HAS_ICMP_SUPPORT 1 + +#define ACE_HAS_VASPRINTF + +// According to man pages Linux uses different (compared to UNIX systems) types +// for setting IP_MULTICAST_TTL and IPV6_MULTICAST_LOOP / IP_MULTICAST_LOOP +// in setsockopt/getsockopt. +#define ACE_HAS_IP_MULTICAST_TTL_AS_INT 1 +#define ACE_HAS_IPV6_MULTICAST_LOOP_AS_BOOL 1 +#define ACE_HAS_IP_MULTICAST_LOOP_AS_INT 1 + +#if defined (ACE_LACKS_NETWORKING) +# include "ace/config-posix-nonetworking.h" +#else +# define ACE_HAS_NETLINK +//remove# define ACE_HAS_GETIFADDRS +#endif + +#if !defined (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO) +// Detect if getsockname() and getpeername() returns random values in +// the sockaddr_in::sin_zero field by evaluation of the kernel +// version. Since version 2.5.47 this problem is fixed. +# if !defined (ACE_LACKS_LINUX_VERSION_H) +# include <linux/version.h> +# endif /* !ACE_LACKS_LINUX_VERSION_H */ +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,47)) +# define ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO 0 +# else +# define ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO 1 +# endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,47)) */ +#endif /* ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO */ + +#if !defined (ACE_HAS_EVENT_POLL) && !defined (ACE_HAS_DEV_POLL) +# if !defined (ACE_LACKS_LINUX_VERSION_H) +# include <linux/version.h> +# endif /* !ACE_LACKS_LINUX_VERSION_H */ +// Android does not have EPOLLONESHOT yet +//# if (LINUX_VERSION_CODE > KERNEL_VERSION (2,6,0)) +//# define ACE_HAS_EVENT_POLL +//# endif +#endif + + +#define ACE_HAS_SVR4_DYNAMIC_LINKING +#define ACE_HAS_AUTOMATIC_INIT_FINI +#define ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE +#define ACE_HAS_RECURSIVE_MUTEXES +#define ACE_HAS_THREAD_SPECIFIC_STORAGE +#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +#define ACE_HAS_REENTRANT_FUNCTIONS + +#include /**/ "ace/post.h" + +#endif /* ACE_CONFIG_ANDROID_H */ diff --git a/ACE/ace/config-linux.h b/ACE/ace/config-linux.h index b4fff00a671..7730ab02029 100644 --- a/ACE/ace/config-linux.h +++ b/ACE/ace/config-linux.h @@ -17,7 +17,9 @@ # define __ACE_INLINE__ #endif /* ! __ACE_INLINE__ */ +#if !defined (ACE_PLATFORM_CONFIG) #define ACE_PLATFORM_CONFIG config-linux.h +#endif #define ACE_HAS_BYTESEX_H diff --git a/ACE/examples/APG/ThreadManagement/Async_Cancel.cpp b/ACE/examples/APG/ThreadManagement/Async_Cancel.cpp index 842c7fa2bca..4b3f5aaa0e3 100644 --- a/ACE/examples/APG/ThreadManagement/Async_Cancel.cpp +++ b/ACE/examples/APG/ThreadManagement/Async_Cancel.cpp @@ -4,7 +4,7 @@ #include "ace/Task.h" #include "ace/Log_Msg.h" -#if defined (ACE_HAS_PTHREADS) +#if defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_PTHREAD_CANCEL) // Only works on Pthreads... // Listing 1 code/ch13 diff --git a/ACE/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp b/ACE/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp index c4b3944b26f..616f6bc40ee 100644 --- a/ACE/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp +++ b/ACE/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp @@ -92,8 +92,12 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -1); char name[ACE_MAX_USERID]; +#if !defined (ACE_LACKS_CUSERID) ACE_OS::cuserid (name); - +#else + name[0] = '.'; + name[1] = '\0'; +#endif if (sd.send (name, ACE_OS::strlen (name) + 1, ACE_UNIX_Addr (rendezvous_dgram)) == -1) diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.inl b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.inl index 03b87ef905c..6f04794fc2c 100644 --- a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.inl +++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_L_Stream.inl @@ -15,8 +15,15 @@ Handle_L_Stream::~Handle_L_Stream (void) ACE_INLINE Handle_L_Stream::Handle_L_Stream (void) { - if (Handle_L_Stream::login_name == 0) + if (Handle_L_Stream::login_name == 0) { +#if !defined(ACE_LACKS_CUSERID) Handle_L_Stream::login_name = ACE_OS::cuserid (Handle_L_Stream::login); +#else + Handle_L_Stream::login[0] = '.'; + Handle_L_Stream::login[1] = '\0'; + Handle_L_Stream::login_name = Handle_L_Stream::login; +#endif + } } ACE_INLINE int diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.inl b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.inl index 2a9d9f84fdd..41241da9c81 100644 --- a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.inl +++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_R_Stream.inl @@ -12,8 +12,16 @@ ACE_INLINE Handle_R_Stream::Handle_R_Stream (void) { - if (Handle_R_Stream::login_name == 0) + if (Handle_R_Stream::login_name == 0) { +#if !defined(ACE_LACKS_CUSERID) Handle_R_Stream::login_name = ACE_OS::cuserid (Handle_R_Stream::login); +#else + Handle_R_Stream::login[0] = '.'; + Handle_R_Stream::login[1] = '\0'; + Handle_R_Stream::login_name = Handle_R_Stream::login; +#endif + } + } ACE_INLINE int diff --git a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Thr_Stream.cpp b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Thr_Stream.cpp index f5b952ca7a1..08998497492 100644 --- a/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Thr_Stream.cpp +++ b/ACE/examples/Service_Configurator/IPC-tests/server/Handle_Thr_Stream.cpp @@ -158,7 +158,12 @@ CLI_Stream<PR_ST_2>::svc (void) ACE_OS::fflush (stdout); time_t t = ACE_OS::time (0L); +#if !defined(ACE_LACKS_CUSERID) ACE_OS::cuserid (login_name); +#else + login_name[0] = '.'; + login_name[1] = '\0'; +#endif ACE_OS::sprintf (buf, "user %s %s", login_name, diff --git a/ACE/examples/System_V_IPC/SV_Message_Queues/TMQ_Client.cpp b/ACE/examples/System_V_IPC/SV_Message_Queues/TMQ_Client.cpp index d2bcf36cc9e..b99a6d85a36 100644 --- a/ACE/examples/System_V_IPC/SV_Message_Queues/TMQ_Client.cpp +++ b/ACE/examples/System_V_IPC/SV_Message_Queues/TMQ_Client.cpp @@ -19,9 +19,15 @@ ACE_TMAIN (int, ACE_TCHAR *[]) ACE_Typed_SV_Message_Queue<Message_Data> msgque (key_t (SRV_KEY)); +#if !defined(ACE_LACKS_CUSERID) Message_Data msg_data (pid, ACE_OS::cuserid (static_cast<char *> (0)), "did you get this?"); +#else + Message_Data msg_data (pid, + "", + "did you get this?"); +#endif ACE_Typed_SV_Message<Message_Data> send_msg (msg_data, SRV_ID, diff --git a/ACE/include/makeinclude/platform_linux_android.GNU b/ACE/include/makeinclude/platform_linux_android.GNU new file mode 100644 index 00000000000..b7647e0e0a7 --- /dev/null +++ b/ACE/include/makeinclude/platform_linux_android.GNU @@ -0,0 +1,88 @@ +# -*- Makefile -*- +# $Id$ + +# This file should allow ACE to be built for Android 2.3.1 (API Level 9) +# or greater, by cross compiling on Linux. + +# The standalone gcc compilers in NDK r5c have issues with the visibility. +no_hidden_visibility ?= 1 + + +include $(ACE_ROOT)/include/makeinclude/platform_linux_common.GNU + + +ifeq ($(insure),0) + CC ?= arm-linux-androideabi-gcc + CXX ?= arm-linux-androideabi-g++ + CXX_FOR_VERSION_TEST ?= $(CXX) + AR ?= arm-linux-androideabi-ar +else + CXX_FOR_VERSION_TEST ?= arm-linux-androideabi-g++ +endif + +# fix this +pipes ?= 1 + +# NDK says required for working around a CPU bug in some Cortex-A8 implementations +LDFLAGS += -Wl,--fix-cortex-a8 + +CXX_FULL_VERSION := $(shell $(CXX_FOR_VERSION_TEST) --version) + +FLAGS_C_CC += -W -Wall -Wpointer-arith +ifeq ($(threads),1) + CPPFLAGS += -D_REENTRANT $(PLATFORM_AIO_SUPPORT) +endif # threads + +ifeq ($(buildbits),32) + FLAGS_C_CC += -m32 + LDFLAGS += -m32 +endif +ifeq ($(buildbits),64) + FLAGS_C_CC += -m64 +endif + +# DT_RUNPATH is preferred over DT_RPATH, but the linker will only use it when +# this extra flag option (enable-new-dtags) is present +LD_RPATH_FLAGS += -Wl,--enable-new-dtags + +# Rely on _GNU_SOURCE to set these defaults defined in /usr/include/features.h +# instead of setting them directly here (older versions of gcc don't set it +# for you): _SVID_SOURCE _BSD_SOURCE _POSIX_SOURCE _POSIX_C_SOURCE=199506L, ... +CPPFLAGS += -D_GNU_SOURCE + +DCFLAGS += -ggdb +DCCFLAGS += -ggdb +DLD = $(CXX) +LD = $(CXX) +LIBS += -ldl + +ifeq ($(optimize),1) + SOFLAGS += -Wl,-O3 +endif + +SOFLAGS += $(CPPFLAGS) -shared +SOBUILD = $(COMPILE.cc) $(PIC) -o $(VSHDIR)$*.so $<; \ + $(SOLINK.cc) -o $@ $(LDFLAGS) $(VSHDIR)$*.o +PRELIB = @true + +# Test for template instantiation, add to SOFLAGS if SONAME set, +# add -E to LDFLAGS if using GNU ld +# +include $(ACE_ROOT)/include/makeinclude/platform_g++_common.GNU + +OCFLAGS ?= -O3 +OCCFLAGS ?= -O3 + +CFLAGS += $(FLAGS_C_CC) +CCFLAGS += $(FLAGS_C_CC) $(TEMPLATES_FLAG) + +# Added line below to support "Executable Shared Object" files (as +# needed by the service configurator). +# Marius Kjeldahl <mariusk@sn.no, marius@funcom.com> +ifeq ($(threads),1) + ESOBUILD = $(COMPILEESO.cc) $(PIC) -shared -o $(VSHDIR)$*.so $< + ifndef PRELIB + PRELIB = @true + endif # ! PRELIB +endif + diff --git a/ACE/tests/Thread_Attrs_Test.cpp b/ACE/tests/Thread_Attrs_Test.cpp index 270401efdc7..7a9c8351b79 100644 --- a/ACE/tests/Thread_Attrs_Test.cpp +++ b/ACE/tests/Thread_Attrs_Test.cpp @@ -64,7 +64,7 @@ Cancel_Check::Cancel_Check (bool enable, bool async) int Cancel_Check::svc (void) { -#if defined (ACE_HAS_PTHREADS) +#if defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_PTHREAD_CANCEL) int state; pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &state); if (state == PTHREAD_CANCEL_ENABLE && !this->enable_req_) diff --git a/ACE/tests/test_config.h b/ACE/tests/test_config.h index 7bba83490fe..e7a99122ee8 100644 --- a/ACE/tests/test_config.h +++ b/ACE/tests/test_config.h @@ -47,6 +47,10 @@ # define ACE_LOG_DIRECTORY ACE_TEXT ("log\\") # define ACE_LOG_DIRECTORY_FOR_MKDIR ACE_TEXT ("log\\") # define MAKE_PIPE_NAME(X) ACE_TEXT ("\\\\.\\pipe\\"#X) +#elif defined (ANDROID) +# define ACE_LOG_DIRECTORY_FOR_MKDIR ACE_TEXT ("/sdcard/log/") +# define ACE_LOG_DIRECTORY ACE_TEXT ("/sdcard/log/") +# define MAKE_PIPE_NAME(X) ACE_TEXT (X) #else # define ACE_LOG_DIRECTORY_FOR_MKDIR ACE_TEXT ("log/") # define ACE_LOG_DIRECTORY ACE_TEXT ("log/") |