1 dnl $Id: configure.ac 82832 2008-09-25 17:38:39Z jtc $
3 dnl An autoconf script to automatically configure ACE.
4 dnl Process this file with autoconf to produce a configure script.
6 dnl Statically (i.e. at autoconf-time) determine the version of ACE.
7 dnl This is necessary since the version argument to AC_INIT is
8 dnl supposed to be a static value, not a dynamic one (e.g. a shell
11 dnl Note that this macro removes the newline output by the M4
12 dnl "esyscmd" built-in. Unless you understand what you're doing,
13 dnl particularly with M4, do not modify this macro definition.
14 define([ACE_VERSION], patsubst(esyscmd(grep ACE_VERSION ace/Version.h | sed 's/.*\" *\(.*\)\".*/\1/'), [
15 ]))dnl remove newline ending every `esyscmd' answer
19 [ace-bugs@cs.wustl.edu],
22 AC_REVISION([$Id: configure.ac 82832 2008-09-25 17:38:39Z jtc $])
24 AC_COPYRIGHT([ACE(TM), TAO(TM), CIAO(TM), and CoSMIC(TM) (henceforth
25 referred to as "DOC software") are copyrighted by Douglas C.
26 Schmidt and his research group at Washington University,
27 University of California, Irvine, and Vanderbilt University,
28 Copyright (c) 1993-2005, all rights reserved. Since DOC software is
29 open-source, free software, you are free to use, modify, copy, and
30 distribute--perpetually and irrevocably--the DOC software source code
31 and object code produced from the source, as well as copy and
32 distribute modified versions of this software. You must, however,
33 include this copyright statement along with code built using DOC
36 Please see the file `COPYING' in the top level ACE directory for
40 dnl Require GNU Autoconf 2.58 or better. Previous versions did not
41 dnl correctly support HP-UX.
44 dnl Autoconf explicitly forbids patterns containing "_AC_". This causes
45 dnl a problem when using MPC to generate the Automake ".am" files since
46 dnl the "AC_CLD" project in ACE_wrappers/examples/C++NPv2 ends up having
47 dnl a Makefile containing "NPv2_AC_CLD" in it, triggering the forbidden
48 dnl "_AC_" pattern. Explicitly allow our pattern.
49 m4_pattern_allow([NPv2_AC_CLD])
51 AC_CONFIG_SRCDIR([ace/ACE.cpp])
53 AC_CONFIG_AUX_DIR([aux_config])
54 AC_CONFIG_MACRO_DIR([m4])
56 dnl Check what platform we are running on.
57 AC_CANONICAL_TARGET([])
59 dnl Initialize GNU Automake, and require Automake 1.9.6 or better.
60 AM_INIT_AUTOMAKE([1.9.6 foreign no-define nostdinc])
62 dnl Add maintainer mode option to the option list.
63 dnl AM_MAINTAINER_MODE
65 dnl The maintainer of this configure script.
66 ACE_CONFIGURE_MAINTAINER='ace-users@cs.wustl.edu'
69 dnl Until autoconf support in ACE is complete, prevent this script
70 dnl from running unless the user explictly forces the configure script
71 dnl to run using the "--enable-maintainer-mode" configure script
73 dnl if test $USE_MAINTAINER_MODE != yes; then
75 dnl ACE autoconf support is currently disabled by default since it is
76 dnl still under development. Please use the stock ACE build procedure
77 dnl detailed in the file \`ACE-INSTALL.html'.
79 dnl If you wish to experiment with ACE's autoconf support then use the
80 dnl \"--enable-maintainer-mode\" configure script option to enable
81 dnl autoconf support. For more details see the file
82 dnl \`ACE-configuration.txt'.])
83 dnl fi dnl test $USE_MAINTAINER_MODE != yes
85 dnl Should we use "egrep" or "grep -E"? This sets the "$EGREP" shell
89 dnl If we are configuring in a CVS controlled directory then don't
90 dnl continue any further. The idea is to prevent automatically
91 dnl generated files from being checked into the repository. This
92 dnl will prevent accidental overwrites of ACE's current Makefiles by
93 dnl the automatically generated ones, for example.
94 dnl ACE_CHECK_FOR_CVS_DIR
96 dnl Prevent the configure script from continuing any further if
97 dnl configuration is being performed in the top-level directory. The
98 dnl idea is to prevent files generated during configuration and build
99 dnl from overwriting the stock files of the same name.
102 dnl Prepare the `ace/config.h.in' header template.
103 ACE_PREP_CONFIG_HEADER
105 dnl Allow the standard program name transformations.
106 dnl We probably don't need AC_ARG_PROGRAM any longer since AM_INIT_AUTOMAKE
107 dnl handles this functionality. -- Ossama
110 dnl Generate a header file with all settings.
111 AC_CONFIG_HEADERS([ace/config.h])
113 dnl Move before the AC_ARG_ENABLE stuff to prevent autoconf complaints.
114 dnl This is a bit messy but it makes life easier for me.
117 dnl SECTION: checks for programs
120 dnl Check if system supports "#! /bin/sh" line in scripts
123 dnl Check the C compiler and preprocessor.
128 dnl Check the C++ compiler and preprocessor.
132 dnl Set the test language as C++
135 dnl If we are cross compiling disable certain things in the Makefiles.
136 AM_CONDITIONAL([ACE_CROSS_COMPILED], [test X$cross_compiling = Xyes])
138 dnl Look for the best awk-style program available.
141 dnl Parse the version information argument.
142 dnl Note that "ACE_VERSION" is an m4 macro.
143 ace_version_temp=ACE_VERSION
144 ace_save_ifs="$IFS"; IFS='.'
145 set dummy $ace_version_temp 0 0 0
151 ACE_VERSION_NAME=ACE_VERSION
153 AC_SUBST([ACE_MAJOR])
154 AC_SUBST([ACE_MINOR])
156 AC_SUBST([ACE_VERSION_NAME])
158 dnl Do the usual install settings; don't forget to include a
159 dnl `install-sh' script, in case there is no BSD compatible `install'
160 dnl installed (no pun intended) in your machine.
162 dnl We don't need this anymore since AM_INIT_AUTOMAKE calls AC_PROG_INSTALL.
166 dnl Special handling for some UNIX variants and Cygwin32
172 *cygwin* ) CYGWIN=yes;;
177 dnl Check if we support symbolic links
180 dnl Check if a lexical analyzer exists (lex, flex, etc.)
183 dnl Check if some implementation of YACC exists (yacc, byacc, bison, etc.)
185 dnl if test -z "$YACC"; then
189 dnl Check for perfect hash function generator
190 AC_CHECK_PROG([GPERF],[gperf],[gperf])
192 dnl Check for profiling progam
193 AC_CHECK_PROGS([PROF],[gprof prof],)
195 dnl The user's/default C++ flags are stored in "CXXFLAGS." We use
196 dnl the variable "ACE_CXXFLAGS" to set the C++ flags we want. At the end
197 dnl of the configuration process we combine ACE_CXXFLAGS and CXXFLAGS
198 dnl into CXXFLAGS (e.g., CXXFLAGS="$ACE_CXXFLAGS $CXXFLAGS"). CXXFLAGS
199 dnl goes after ACE_CXXFLAGS so that the user's C++ flag command line
200 dnl choices always override the configure script's choices.
206 dnl SECTION 2: Configure script command line options
209 dnl Determine which subsets to build
210 dnl This is done using the autoconf "--enable-foobar" mechanism.
213 dnl Some of the third party libraries (X11, openssl, etc.) depend on
214 dnl other libraries. Check for those before the processing --enable
217 dnl Check if the socket library is available
218 AC_SEARCH_LIBS([socket],[socket],,,[-lnsl])
220 dnl Check for gethostbyname in -lnsl since some platforms (e.g. Solaris)
222 AC_SEARCH_LIBS([gethostbyname],[nsl],,)
225 dnl Add --{enable,disable,with,without}-feature options.
226 ACE_CONFIGURATION_OPTIONS
227 ACE_COMPILATION_OPTIONS
229 # Autoconf's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
230 # Libtool's setup macro calls AC_OBJEXT and AC_EXEEXT without setting
231 # the test language to C. We do it before any libtool setup macros are
232 # called so that the proper values are cached beforehand. We also do
233 # it before any linker flags (LDFLAGS) are set so that C++ specific
234 # ones don't break the tests.
235 dnl AC_LANG_PUSH([C])
240 dnl Call ACE_SET_COMPILER_FLAGS before AC_PROG_LIBTOOL and after the
241 dnl AC_ARG_ENABLE and AC_ARG_WITH calls.
242 ACE_SET_COMPILER_FLAGS
245 dnl SECTION 3: check for programs <--- moved before section 2 (Ossama)
248 dnl Platform specific libraries needed for ACE's autoconf tests
249 dnl that currently do not have tests themselves.
250 dnl Platform specific flags
253 LIBS="$LIBS -lmach -lsys5 -lcxx -lc"
264 dnl SECTION 4: checks for libraries
267 dnl Additional X library checks
268 dnl We only check for these libraries if the user has
269 dnl enabled XtReactor support.
273 if test "$ace_user_enable_xt_reactor" = yes; then
274 XTREACTOR_TEST_XLIBS=""
275 dnl Check for Motif if we have X
277 LDFLAGS="$LDFLAGS $X_LIBS"
279 dnl Note that ACE currently only needs -lX11 and -lXt for the XtReactor
280 dnl so we define another library variable that contains additional
281 dnl libraries for the XtReactor test since it needs either Motif or the
282 dnl Athena widget set.
284 AC_CHECK_LIB([Xm],[XmCreateRowColumn],
286 AC_DEFINE([ACE_HAS_XT])
287 XTREACTOR_TEST_XLIBS="-lXm"
291 AC_DEFINE([ACE_LACKS_MOTIF])
292 AC_CHECK_LIB([Xaw],[XawInitializeWidgetSet],
294 AC_DEFINE([ACE_HAS_XT])
295 XTREACTOR_TEST_XLIBS="-lXaw -lXmu"
300 AC_MSG_WARN([No usable X widget libraries were found.])
301 AC_MSG_WARN([XtReactor support will be disabled.])
305 AC_SUBST([XTREACTOR_TEST_XLIBS])
307 dnl Restore pre-test linker flags
310 fi dnl test "$ace_user_enable_xt_reactor"= yes
312 AM_CONDITIONAL([COMPILE_XTREACTOR_TEST],[test X$xt_reactor_go = Xyes])
314 dnl End additional X library checks
316 dnl Some platforms do not have a dynamic linking library, however the
317 dnl dlopen, dlclose, etc., functions may exist in the C library.
318 dnl (e.g. Digital UNIX)
319 dnl Check for dynamic linking library
320 AC_SEARCH_LIBS([dlopen],[dl svld],[ace_has_svr4_dynamic_linking=yes],
322 ace_has_svr4_dynamic_linking=no
323 AC_CHECK_LIB([dld],[shl_get],,)
326 dnl Check for getservbyname in -lxnet since some platforms (e.g. Solaris)
327 dnl may put it there.
328 AC_SEARCH_LIBS([getservbyname],[socket xnet],,[AC_DEFINE([ACE_LACKS_GETSERVBYNAME])],[-lnsl])
330 dnl Check for compile() regex function in -lgen. Solaris, for example,
331 dnl may put it there.
332 AC_SEARCH_LIBS([compile],[gen],,)
334 dnl Check for exception handling library (e.g. for Digital UNIX)
335 AC_SEARCH_LIBS([exc_continue],[exc],,)
337 dnl Check for ctime_r in -lc_r. Some platforms, such as Digital UNIX,
338 dnl put reentrant functions such as asctime_r, ctime_r, gmtime_r, and
339 dnl localtime_r in -lc_r.
340 AC_SEARCH_LIBS([ctime_r],[c_r],,)
342 dnl XTI/TLI check. Check for XTI first, since it's preferred. If there's
343 dnl no XTI, try for TLI. t_getprotaddr() is only in XTI.
344 AC_SEARCH_LIBS([t_getprotaddr],[xti nsl],
345 [ace_has_xti_funcs=yes],[ace_has_xti_funcs=no])
346 AS_IF([test "$ace_has_xti_funcs" = no],
348 AC_SEARCH_LIBS([t_accept],[tli_r tli nsl],
349 [ace_has_tli_funcs=yes],[ace_has_tli_funcs=no])
352 dnl Check for all of the things we need to compile and link threads
354 AS_IF([test "$ace_user_enable_threads" = yes],
361 dnl This should be done in the "programs" section of this file but
362 dnl libtool may then be unaware of compiler flags set during the
365 dnl Disable building of static libraries by default
368 dnl Enable Libtool module support
371 dnl Enable support for "clean" DLLs.
375 dnl ###### Relies on the as of yet unreleased Libtool 1.6 distribuion ###
377 dnl Only enable C++ libtool support. Support for other languages is
379 dnl AC_LIBTOOL_TAGS([CXX])
381 dnl FIXME: Temporary hack to make libtool work with g++.
382 dnl Shared library support will only work with GNU g++ and GNU ld
387 dnl Check for libtool and turn on Automake processing for Libtool
390 dnl Enable C++ support in libtool
393 dnl Temporary hack until I get integrate libtool's new tag support
395 dnl This hack forces libtool to always use the C++ tag.
396 dnl LIBTOOL="$LIBTOOL --tag=CXX"
398 dnl Check for sched_yield() in posix4 library.
399 dnl Some platforms, such as Solaris, may define sched_yield() there.
400 dnl Later we run AC_CHECK_FUNC(sched_yield), which is redundant in this case
401 dnl but is needed if sched_yield() is defined in one of the other libraries
403 AC_SEARCH_LIBS([sched_yield],[rt posix4],[ace_has_sched_yield=yes],)
405 dnl Check for asynchronous IO calls (perform check *after* thread check!)
408 dnl Additional `-lposix4' library check since it may not be added by the
409 dnl above checks on some platforms that may need it
410 dnl AC_SEARCH_LIBS([clock_gettime],
411 dnl [rt posix4],[AC_DEFINE(ACE_HAS_CLOCK_GETTIME)],)
413 dnl This check was added to work around a system-supplied header
414 dnl (/usr/include/netinet/ip.h) that won't compile with Visual Age C++
415 dnl unless the _NO_BITFIELDS preprocessor macro is defined. The comments
416 dnl there recommend use of _NO_BITFIELDS (and recode where needed to allow
417 dnl that), but we won't just turn it on. Check to see if it's needed. Note
418 dnl that this check is related to headers but done before we really know if
419 dnl the header is present. Thus, if the bare compile fails, but succeeds
420 dnl with _NO_BITFIELDS, set the flag, else leave things alone.
422 AC_CACHE_CHECK([to see if _NO_BITFIELDS needed to compile netinet/ip.h],
423 [ac_cv_needs_no_bitfields],
425 ace_save_CXXFLAGS="$CXXFLAGS"
427 dnl Try compiling without any flags first.
431 #include <netinet/tcp.h>
438 ac_cv_needs_no_bitfields=no
441 CXXFLAGS="$CXXFLAGS -D_NO_BITFIELDS"
445 #include <netinet/tcp.h>
452 ac_cv_needs_no_bitfields=yes
455 ac_cv_needs_no_bitfields=no
456 CXXFLAGS="$ace_save_CXXFLAGS"
462 dnl SECTION 5: checks for header files
464 dnl Set known platform specific flags
465 ACE_SET_PLATFORM_MACROS
467 dnl Check for dirent headers
470 AS_IF([test "$ac_cv_header_dirent_dirent_h" = yes ||
471 test "$ac_cv_header_dirent_sys_ndir_h" = yes ||
472 test "$ac_cv_header_dirent_sys_dir_h" = yes ||
473 test "$ac_cv_header_dirent_ndir_h" = yes],
475 AC_DEFINE([ACE_HAS_DIRENT])
478 dnl Check for sys/wait.h Posix.1 compliance
481 AC_CHECK_HEADER([dlfcn.h],
483 dnl We already checked for dlopen in the previous library checks however,
484 dnl it is possible that ac_cv_func_dlopen=yes if dlopen wasn't found before
485 dnl the library test. Hence we cannot use AC_CHECK_FUNC(dlopen) here
486 dnl the previously cached value may prevent ACE_HAS_SVR4_DYNAMIC_LINKING
487 dnl from being defined.
489 AS_IF([test "$ace_has_svr4_dynamic_linking" = yes],
491 AC_DEFINE([ACE_HAS_SVR4_DYNAMIC_LINKING])
495 AC_DEFINE([ACE_LD_SEARCH_PATH],
496 [ACE_LIB_TEXT ("DYLD_LIBRARY_PATH")],
497 [Define to environment variable used for DLL search path])
498 AC_DEFINE([ACE_DLL_SUFFIX],
499 [ACE_LIB_TEXT (".dylib")],
500 [Define to DLL file suffix])
506 ACE_CHECK_LACKS_HEADERS(inttypes.h malloc.h memory.h stdint.h)
508 AC_CHECK_HEADER([sys/msg.h],
510 ACE_CACHE_CHECK([if _KERNEL is needed for msg prototypes],
511 [ace_cv_lib_broken_msg_h],
513 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
522 ace_cv_lib_broken_msg_h=no
524 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
537 ace_cv_lib_broken_msg_h=yes
540 dnl If we get here, then we have no idea if it is broken or not.
541 ace_cv_lib_broken_msg_h=no
546 AC_DEFINE([ACE_HAS_BROKEN_MSG_H])
549 [AC_DEFINE([ACE_LACKS_SYS_MSG_H])])
551 AC_CHECK_HEADER([sys/sem.h],,)
552 AC_CHECK_HEADER([sys/shm.h],,)
554 ACE_CHECK_LACKS_HEADERS(sys/param.h)
556 AC_CHECK_HEADER([sys/priocntl.h],[],[])
558 dnl Check for <ucontext.h> _before_ <sys/procfs.h>
559 ACE_CHECK_LACKS_HEADERS(ucontext.h)
561 AC_CHECK_HEADER([sys/procfs.h],
563 dnl Check if <sys/procfs.h> conflicts with <ucontext.h>
564 dnl Some (early?) versions of glibc2.1 define the same variables
565 dnl in <sys/procfs.h> and <ucontext.h>.
566 ACE_CACHE_CHECK([if sys/procfs.h conflicts with ucontext.h],
567 [ace_cv_has_procfs_conflict],
569 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
570 #ifndef ACE_LACKS_UCONTEXT_H
571 # include <ucontext.h>
574 #include <sys/procfs.h>
578 ace_cv_has_procfs_conflict=no
580 ace_cv_has_procfs_conflict=yes
586 dnl If ace_cv_has_procfs_conflict = no then define ACE_HAS_PROC_FS.
587 AC_DEFINE([ACE_HAS_PROC_FS])
591 ACE_CHECK_LACKS_HEADERS(arpa/inet.h)
593 ACE_CHECK_HAS_HEADERS(bytesex.h)
595 ACE_CHECK_HAS_HEADERS(byteswap.h)
597 ACE_CHECK_LACKS_HEADERS(dirent.h)
599 ACE_CHECK_LACKS_HEADERS(dlfcn.h)
601 ACE_CHECK_LACKS_HEADERS(errno.h)
603 ACE_CHECK_LACKS_HEADERS(execinfo.h)
605 ACE_CHECK_LACKS_HEADERS(fcntl.h)
607 ACE_CHECK_HAS_HEADERS(pdh.h)
609 ACE_CHECK_HAS_HEADERS(pthread_np.h)
611 ACE_CHECK_LACKS_HEADERS(sched.h)
613 ACE_CHECK_LACKS_HEADERS(search.h)
615 ACE_CHECK_HAS_HEADERS(select.h)
617 ACE_CHECK_LACKS_HEADERS(semaphore.h)
619 ACE_CHECK_LACKS_HEADERS(signal.h)
621 ACE_CHECK_LACKS_HEADERS(stdlib.h)
623 ACE_CHECK_LACKS_HEADERS(string.h)
625 ACE_CHECK_LACKS_HEADERS(strings.h)
627 ACE_CHECK_LACKS_HEADERS(netdb.h)
629 ACE_CHECK_LACKS_HEADERS(netinet/in.h)
631 ACE_CHECK_LACKS_HEADERS(netinet/tcp.h)
633 ACE_CHECK_LACKS_HEADERS(sys/socket.h)
635 ACE_CHECK_LACKS_HEADERS(net/if.h, [], [],
637 #ifndef ACE_LACKS_SYS_TYPES_H
638 # include <sys/types.h>
640 #ifndef ACE_LACKS_SYS_SOCKET_H
641 # include <sys/socket.h>
645 ACE_CHECK_HAS_HEADERS(sys/filio.h)
647 ACE_CHECK_HAS_HEADERS(intrin.h)
649 ACE_CHECK_HAS_HEADERS(ia64intrin.h)
651 ACE_CHECK_HAS_HEADERS(ia32intrin.h)
653 ACE_CHECK_LACKS_HEADERS(sys/ioctl.h)
655 ACE_CHECK_LACKS_HEADERS(sys/ipc.h)
657 ACE_CHECK_HAS_HEADERS(sys/loadavg.h)
659 ACE_CHECK_LACKS_HEADERS(sys/mman.h)
661 ACE_CHECK_HAS_HEADERS(sys/pstat.h)
663 ACE_CHECK_LACKS_HEADERS(sys/resource.h)
665 ACE_CHECK_LACKS_HEADERS(sys/sem.h)
667 ACE_CHECK_LACKS_HEADERS(sys/shm.h)
669 ACE_CHECK_LACKS_HEADERS(sys/select.h)
671 ACE_CHECK_HAS_HEADERS(sys/sockio.h)
673 ACE_CHECK_LACKS_HEADERS(sys/stat.h)
675 dnl Test for <sys/types.h> out of alphabetical order, since it must
676 dnl be (conditionally) #included in other feature tests.
677 ACE_CHECK_LACKS_HEADERS(sys/types.h)
679 ACE_CHECK_LACKS_HEADERS(sys/sysctl.h, [], [],
681 #ifndef ACE_LACKS_SYS_TYPES_H
682 # include <sys/types.h>
684 #ifndef ACE_LACKS_SYS_PARAM_H
685 # include <sys/param.h>
689 ACE_CHECK_LACKS_HEADERS(sys/time.h)
691 ACE_CHECK_LACKS_HEADERS(sys/uio.h)
693 ACE_CHECK_LACKS_HEADERS(sys/un.h)
695 ACE_CHECK_LACKS_HEADERS(sys/wait.h)
697 ACE_CHECK_HAS_HEADERS(sysent.h)
699 ACE_CHECK_LACKS_HEADERS(time.h)
701 ACE_CHECK_LACKS_HEADERS(termio.h termios.h)
703 ACE_CHECK_LACKS_HEADERS(wctype.h)
705 AC_CHECK_TYPE([struct termio],
706 [AC_DEFINE([ACE_HAS_TERMIO], 1,
707 [Define to 1 if system supports SysV tty API.])],
710 #ifndef ACE_LACKS_TERMIO_H
715 AC_CHECK_TYPE([struct termios],
716 [AC_DEFINE([ACE_HAS_TERMIOS], 1,
717 [Define to 1 if system supports POSIX tty API.])],
720 #ifndef ACE_LACKS_TERMIOS_H
725 dnl If the platform has XTI, don't bother with the TLI checks as XTI is
727 AS_IF([test "$ace_has_xti_funcs" = yes],
729 AC_CHECK_HEADER([xti.h],
732 AC_DEFINE([ACE_HAS_XTI])
735 AC_CHECK_HEADER([sys/xti.h],
738 AC_DEFINE([ACE_HAS_SYS_XTI_H])
739 AC_DEFINE([ACE_HAS_XTI])
742 AC_CHECK_HEADER([sys/timod.h],
744 AC_DEFINE([ACE_HAS_TIMOD_H])
747 dnl Check if XTI headers define TCP macros that conflict with netinet/tcp.h's
748 ACE_CACHE_CHECK([if TCP macros in sys/xti.h conflict with netinet/tcp.h],
749 [ace_cv_lib_has_conflicting_xti_macros],
751 ACE_CONVERT_WARNINGS_TO_ERRORS([
752 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
753 # if defined (ACE_HAS_XTI)
754 # include <sys/types.h>
755 # if defined (ACE_HAS_SYS_XTI_H)
756 # include /**/ <sys/xti.h>
758 # include /**/ <xti.h>
759 # endif /* ACE_HAS_SYS_XTI_H */
761 # if defined (ACE_HAS_TIUSER_H)
762 # include /**/ <tiuser.h>
764 # endif /* ACE_HAS_XTI */
765 # if !defined (ACE_LACKS_NETINET_TCP_H)
766 # include /**/ <netinet/tcp.h>
767 # endif /* !ACE_LACKS_NETIINET_TCP_H */
771 ace_cv_lib_has_conflicting_xti_macros=no
773 ace_cv_lib_has_conflicting_xti_macros=yes
778 AC_DEFINE([ACE_HAS_CONFLICTING_XTI_MACROS])
783 AS_IF([test "$ace_has_tli_funcs" = yes],
785 AC_CHECK_HEADER([tiuser.h],
788 AC_DEFINE([ACE_HAS_TIUSER_H])
789 AC_DEFINE([ACE_HAS_TLI])
792 AC_CHECK_HEADER([sys/timod.h],
794 AC_DEFINE([ACE_HAS_TIMOD_H])
797 AC_CHECK_HEADER([tli/timod.h],
799 AC_DEFINE([ACE_HAS_OSF_TIMOD_H])
803 AC_CHECK_FUNC([t_getname],
804 [AC_DEFINE([ACE_HAS_SVR4_TLI])],)
807 if test "$ac_cv_header_tiuser_h" = yes; then
808 ACE_CACHE_CHECK([if tiuser.h is protected by extern "C"],
809 [ace_cv_lib_tiuser_with_extern_c],[
810 AC_EGREP_HEADER([extern \"C\"],[tiuser.h],
812 ace_cv_lib_tiuser_with_extern_c=yes
815 ace_cv_lib_tiuser_with_extern_c=no
817 ],,[AC_DEFINE([ACE_HAS_TIUSER_H_BROKEN_EXTERN_C])])
818 fi dnl test "$ac_cv_header_tiuser_h" = yes
820 AC_CHECK_HEADER([xliuser.h],
823 AC_DEFINE([ACE_HAS_XLI])
824 AC_DEFINE([ACE_HAS_TLI])
828 dnl Check for TLI prototypes.
829 if test "$ace_has_tli" = yes; then
830 ACE_CACHE_CHECK([for TLI prototypes],
831 [ace_cv_lib_tli_prototypes],
833 dnl We only check for t_accept. This should hopefully be enough.
834 AC_EGREP_CPP([t_accept],
836 #ifndef ACE_LACKS_SYS_TYPES_H
837 # include <sys/types.h>
840 #if defined (ACE_HAS_TIMOD_H)
841 # include <sys/timod.h>
844 #if defined (ACE_HAS_OSF_TIMOD_H)
845 # include <tli/timod.h>
848 #if defined (ACE_HAS_TIUSER_H)
849 # include /**/ <tiuser.h>
850 #endif /* ACE_HAS_TIUSER_H */
852 #if defined (ACE_HAS_XLI)
853 # include <xliuser.h>
857 ace_cv_lib_tli_prototypes=yes
860 ace_cv_lib_tli_prototypes=no
862 ],[AC_DEFINE([ACE_HAS_TLI_PROTOTYPES])],)
864 dnl Check for t_errno type in TLI headers
865 ACE_CACHE_CHECK([for t_errno in TLI headers],
866 [ace_cv_lib_has_t_errno],
868 dnl Check if t_errno is declared in the TLI headers
869 AC_EGREP_CPP([t_errno],
871 #ifndef ACE_LACKS_SYS_TYPES_H
872 # include <sys/types.h>
875 #if defined (ACE_HAS_TIMOD_H)
876 # include <sys/timod.h>
879 #if defined (ACE_HAS_OSF_TIMOD_H)
880 # include <tli/timod.h>
883 #if defined (ACE_HAS_TIUSER_H)
884 # include /**/ <tiuser.h>
885 #endif /* ACE_HAS_TIUSER_H */
887 #if defined (ACE_HAS_XLI)
888 # include <xliuser.h>
892 ace_cv_lib_has_t_errno=yes
895 ace_cv_lib_has_t_errno=no
897 ],,[AC_DEFINE([ACE_LACKS_T_ERRNO])])
899 fi dnl test "$ace_has_tli_funcs" = yes
902 dnl These checks are needed for both XTI and TLI.
903 AS_IF([test "$ace_has_xti" = yes || test "$ace_has_tli" = yes],
905 dnl Check if t_error incorrectly accepts char *
906 ACE_CONVERT_WARNINGS_TO_ERRORS([
907 ACE_CACHE_CHECK([if t_error incorrectly accepts char *],
908 [ace_cv_lib_has_broken_t_error],
910 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
911 #ifndef ACE_LACKS_SYS_TYPES_H
912 # include <sys/types.h>
915 #if defined (ACE_HAS_XTI)
916 # if defined (ACE_HAS_SYS_XTI_H)
917 # include <sys/xti.h>
920 # endif /* ACE_HAS_SYS_XTI_H */
921 #elif defined (ACE_HAS_TIUSER_H)
922 # include /**/ <tiuser.h>
923 #endif /* ACE_HAS_TIUSER_H */
925 #if defined (ACE_HAS_XLI)
926 # include <xliuser.h>
929 const char *ace_errmsg = "FOO";
930 t_error (ace_errmsg);
932 ace_cv_lib_has_broken_t_error=no
934 ace_cv_lib_has_broken_t_error=yes
938 AC_DEFINE([ACE_HAS_BROKEN_T_ERROR])
940 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
944 dnl See the notes about ACE_LACKS_MMAP in the functions section of this
945 dnl configure script.
947 AC_CHECK_HEADER([sys/mman.h],
949 AC_EGREP_HEADER([extern \"C\"],[sys/mman.h],
952 AC_DEFINE([ACE_HAS_BROKEN_MMAP_H])
956 AC_DEFINE([ACE_LACKS_MMAP])
959 dnl Check for bzero() prototype if bstring.h exists.
960 AC_CHECK_HEADER([bstring.h],
962 AC_EGREP_HEADER([bzero],[bstring.h],
964 AC_DEFINE([ACE_HAS_BSTRING])
968 AC_CHECK_HEADER([strings.h],
970 AC_EGREP_HEADER([bzero],[strings.h],
972 AC_DEFINE([ACE_HAS_STRINGS])
976 ACE_CHECK_HAS_HEADERS(sys/syscall.h)
978 AC_CHECK_HEADER([poll.h],
979 [AC_DEFINE([ACE_HAS_POLL])],)
981 ACE_CHECK_LACKS_HEADERS(pwd.h)
983 AC_CHECK_HEADER([regexpr.h],
984 [AC_DEFINE([ACE_HAS_REGEX])],)
986 AC_CHECK_HEADER([stropts.h],
987 [AC_DEFINE([ACE_HAS_STREAMS])],
988 [AC_DEFINE([ACE_LACKS_STROPTS_H])])
990 ACE_CHECK_LACKS_HEADERS(siginfo.h)
992 ACE_CHECK_LACKS_HEADERS(unistd.h)
994 ACE_CHECK_LACKS_HEADERS(utime.h)
996 ACE_CHECK_LACKS_HEADERS(wchar.h)
998 AC_CHECK_HEADER([wchar.h],
999 [AC_DEFINE([ACE_HAS_WCHAR])],)
1001 AC_CHECK_HEADER([new],
1002 [AC_DEFINE([ACE_HAS_NEW_NO_H])],
1004 ACE_CHECK_HAS_HEADERS([new.h])
1007 dnl ace/OS.i can #include <cstring>,not #include <cstring.h>
1008 dnl "cstring" is the correct form.
1009 dnl TODO: Double check the above comment.
1010 AC_CHECK_HEADER([cstring],
1011 [AC_DEFINE([ACE_HAS_GNU_CSTRING_H])],)
1013 AC_CHECK_HEADER([memory],,)
1015 dnl Check for availablity of "new style" C++ stream headers
1016 AC_CHECK_HEADERS([iomanip ios iostream istream ostream fstream streambuf],
1018 [AC_CHECK_HEADERS([iostream.h fstream.h],
1019 [AC_DEFINE([ACE_USES_OLD_IOSTREAMS])],
1020 [AC_DEFINE([ACE_LACKS_IOSTREAM_TOTALLY])])])
1022 dnl Check for old malloc() prototype.
1023 ACE_CONVERT_WARNINGS_TO_ERRORS([
1024 ACE_CACHE_CHECK([for old malloc() prototype],
1025 [ace_cv_lib_old_malloc_proto],
1027 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1029 #ifndef ACE_LACKS_MALLOC_H
1030 # include <malloc.h>
1034 s = malloc(sizeof(int));
1036 ace_cv_lib_old_malloc_proto=yes
1038 ace_cv_lib_old_malloc_proto=no
1040 ],[AC_DEFINE([ACE_HAS_OLD_MALLOC])],)
1041 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
1044 dnl Check for *_timedwait() prototypes
1045 dnl TODO: We only check for one of the *_timedwait() prototypes.
1047 AC_CHECK_DECL([recv_timedwait],
1049 [AC_DEFINE([ACE_LACKS_TIMEDWAIT_PROTOTYPES], 1,
1050 [Define to 1 if platform lacks the declarations
1051 of recv_timedwait, send_timedwait, etc.])],
1052 [#include <pthread.h>
1053 #include <fcntl.h>])
1055 dnl Check for {get,set}rlimit prototypes
1056 AC_CHECK_DECL([getrlimit],[],[],[#include <sys/resource.h>])
1057 AC_CHECK_DECL([setrlimit],[],[],[#include <sys/resource.h>])
1058 if test "$ac_cv_have_decl_getrlimit" != yes ||
1059 test "$ac_cv_have_decl_setrlimit" != yes; then
1060 AC_DEFINE([ACE_LACKS_RLIMIT_PROTOTYPE], 1,
1061 [Define to 1 if platform lacks the declaration of
1062 {get,set}rlimit().])
1066 dnl SECTION 6: Checks for typedefs
1068 dnl dnl Standard typedef checks (All of them may not be needed)
1075 dnl AC_CHECK_TYPE([off64_t],[long long])
1077 dnl Specific typedef checks
1078 dnl TODO: Check whether these typedefs can be defined somewhere else.
1079 AC_CHECK_TYPE([cpu_set_t],
1080 [AC_DEFINE([ACE_HAS_CPU_SET_T], 1,
1081 [Define to 1 if the system has the type `cpu_set_t'.])],
1084 #if !defined(ACE_LACKS_SCHED_H)
1089 AC_CHECK_TYPE([idtype_t],
1090 [AC_DEFINE([ACE_HAS_IDTYPE_T], 1,
1091 [Define to 1 if the system has the type `idtype_t'.])],
1093 [#include <signal.h>])
1095 AC_CHECK_TYPE([key_t],
1097 [AC_DEFINE([ACE_LACKS_KEY_T], 1,
1098 [Define to 1 if the system lacks the type `key_t'.])],
1099 [#include <sys/types.h>])
1101 AC_CHECK_TYPE([sem_t],
1104 [#include <semaphore.h>])
1106 AC_CHECK_TYPE([pri_t],
1108 [AC_DEFINE([ACE_LACKS_PRI_T], 1,
1109 [Define to 1 if the system lacks the type 'pri_t'.])],
1110 [#include <sys/types.h>])
1112 AC_CHECK_TYPE([sig_atomic_t],
1113 [AC_DEFINE([ACE_HAS_SIG_ATOMIC_T], 1,
1114 [Define to 1 if the system has the type 'sig_atomic_t'.])],
1116 [#include <signal.h>])
1118 AC_CHECK_TYPE([union sigval],
1121 [#include <signal.h>])
1123 if test "$ac_cv_type_union_sigval" = yes; then
1124 dnl Depending on the system, the field names of union sigval have
1125 dnl either a sival_ (POSIX) or sigval_ (older versions of FreeBSD)
1126 dnl prefix. Define ACE_HAS_SIGVAL_SIGVAL_INT accordingly.
1127 AC_CHECK_MEMBER([union sigval.sigval_int],
1128 [AC_DEFINE([ACE_HAS_SIGVAL_SIGVAL_INT], 1,
1129 [Define to 1 if `sigval_int' is a member of `union sigval'.])],
1131 [#include <signal.h>])
1133 dnl Depending on the system, the field names of union sigval have
1134 dnl either a sival_ (POSIX) or sigval_ (older versions of FreeBSD)
1135 dnl prefix. Define ACE_HAS_SIGVAL_SIGVAL_PTR accordingly.
1136 AC_CHECK_MEMBER([union sigval.sigval_ptr],
1137 [AC_DEFINE([ACE_HAS_SIGVAL_SIGVAL_PTR], 1,
1138 [Define to 1 if `sigval_ptr' is a member of `union sigval'.])],
1140 [#include <signal.h>])
1143 AC_CHECK_TYPE([ssize_t],
1144 [AC_DEFINE([ACE_HAS_SSIZE_T], 1,
1145 [Define to 1 if the system has the type `ssize_t'.])],
1147 [#include <sys/types.h>])
1149 AC_CHECK_TYPE([suseconds_t],
1151 [AC_DEFINE([ACE_LACKS_SUSECONDS_T], 1,
1152 [Define to 1 if the system lacks the type 'suseconds_t'.])],
1153 [#include <sys/types.h>])
1155 AC_CHECK_TYPE([useconds_t],
1157 [AC_DEFINE([ACE_LACKS_USECONDS_T], 1,
1158 [Define to 1 if the system lacks the type 'useconds_t'.])],
1159 [#include <sys/types.h>])
1162 dnl Some platforms define ucontext_t in <sys/ucontext.h>, but ACE
1163 dnl doesn't explicitly include that header. However, it is very
1164 dnl likely that <signal.h> does, either directly or indirectly.
1165 AC_CHECK_TYPE([ucontext_t],
1166 [AC_DEFINE([ACE_HAS_UCONTEXT_T], 1,
1167 [Define to 1 if the system has the type `ucontext_t'.])],
1169 [#include <signal.h>
1170 #ifndef ACE_LACKS_UCONTEXT_H
1171 # include <ucontext.h>
1175 AC_CHECK_TYPE([u_longlong_t],
1177 [AC_DEFINE([ACE_LACKS_U_LONGLONG_T], 1,
1178 [Define to 1 if the system lacks the type `u_long_long_t'.])],
1179 [#include <sys/types.h>])
1181 AC_CHECK_TYPE([wchar_t],
1183 [AC_DEFINE([ACE_LACKS_WCHAR_T], 1,
1184 [Define to 1 if the system lacks the type `wchar_t'.])],
1185 [#include <sys/types.h>
1189 AC_CHECK_TYPE([socklen_t],
1190 [AC_DEFINE([ACE_HAS_SOCKLEN_T], 1,
1191 [Define to 1 if the system has the type `socklen_t'.])],
1194 #ifndef ACE_LACKS_SYS_TYPES_H
1195 #include <sys/types.h>
1197 #ifndef ACE_LACKS_SYS_SOCKET_H
1198 #include <sys/socket.h>
1202 if test $ac_cv_type_socklen_t = no; then
1203 dnl The compiler in linux just issues a warning, and the test
1206 dnl FIXED by adding "-Werror" to compiler flags when using GNU C++
1208 ACE_CONVERT_WARNINGS_TO_ERRORS(
1210 dnl Check if socket size is denoted by size_t
1211 ACE_CACHE_CHECK([if socket size is denoted by size_t],
1212 [ace_cv_lib_posix_socket_len_size_t],[
1213 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1214 #ifndef ACE_LACKS_SYS_TYPES_H
1215 # include <sys/types.h>
1217 #ifndef ACE_LACKS_SYS_SOCKET_H
1218 # include <sys/socket.h>
1222 struct sockaddr* addr = 0;
1224 accept(s, addr, addrlen);
1226 ace_cv_lib_posix_socket_len_size_t=no
1228 dnl Now see if it really does take a size_t socket size
1229 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1231 #ifndef ACE_LACKS_SYS_TYPES_H
1232 # include <sys/types.h>
1234 #ifndef ACE_LACKS_SYS_SOCKET_H
1235 # include <sys/socket.h>
1240 struct sockaddr* addr = 0;
1241 size_t* addrlen = 0;
1242 accept(s, addr, addrlen);
1245 ace_cv_lib_posix_socket_len_size_t=yes
1248 ace_cv_lib_posix_socket_len_size_t=no
1251 ],[AC_DEFINE([ACE_HAS_SIZET_SOCKET_LEN])],)
1256 dnl SECTION 7: checks for structures
1259 dnl TODO: Check whether these structures can be defined somewhere else.
1260 AC_CHECK_TYPE([struct dirent],
1262 [AC_DEFINE([ACE_LACKS_STRUCT_DIR], 1,
1263 [Define to 1 if the system lacks the type `struct dirent'.])],
1264 [#include <dirent.h>])
1265 AC_CHECK_TYPE([struct flock],
1267 [AC_DEFINE([ACE_LACKS_FILELOCKS], 1,
1268 [Define to 1 if the system lacks the type `struct flock'.])],
1269 [#include <fcntl.h>])
1270 AC_CHECK_TYPE([rwlock_t],
1272 [AC_DEFINE([ACE_LACKS_RWLOCK_T], 1,
1273 [Define to 1 if the system lacks the type `rwlock_t'.])],
1274 [#include <synch.h>])
1275 AC_CHECK_TYPE([struct strbuf],
1276 [AC_DEFINE([ACE_HAS_STRBUF_T], 1,
1277 [Define to 1 if the system has the type `struct strbuf'.])],
1279 [#include <stropts.h>])
1282 dnl IRIX prusage fields don't match what ACE currently supports.
1285 AC_CHECK_TYPE([prusage_t],
1286 [AC_DEFINE([ACE_HAS_PRUSAGE_T], 1,
1287 [Define to 1 if the system has the type `prusage_t'.])],
1289 [#include <sys/procfs.h>])
1292 AC_CHECK_TYPE([struct strrecvfd],
1294 [AC_DEFINE([ACE_LACKS_STRRECVFD], 1,
1295 [Define to 1 if the system lacks the type `struct strrecvfd'.])],
1296 [#include <stropts.h>])
1297 AC_CHECK_TYPE([struct sigaction],
1299 [AC_DEFINE([ACE_LACKS_SIGACTION], 1,
1300 [Define to 1 if the system lacks the type `struct sigaction'.])],
1301 [#include <signal.h>])
1302 AC_CHECK_TYPE([sigset_t],
1304 [AC_DEFINE([ACE_LACKS_SIGSET], 1,
1305 [Define to 1 if the system lacks the type `sigset_t'.])],
1306 [#include <signal.h>])
1307 AC_CHECK_TYPE([struct utsname],
1309 [AC_DEFINE([ACE_LACKS_UTSNAME_T], 1,
1310 [Define to 1 if the system lacks the type `struct utsname'.])],
1311 [#include <sys/utsname.h>])
1312 AC_CHECK_TYPE([struct sembuf],
1314 [AC_DEFINE([ACE_LACKS_SEMBUF_T], 1,
1315 [Define to 1 if the system lacks the type `struct sembuf'.])],
1317 #ifndef ACE_LACKS_SYS_TYPES_H
1318 # include <sys/types.h>
1320 #include <sys/ipc.h>
1321 #include <sys/sem.h>])
1323 dnl Thanks to Konstantinos Margaritis <kmargar@cc.uoa.gr> for pointing out
1324 dnl that struct siginfo_t may also be defined in signal.h
1325 AC_CHECK_TYPE([siginfo_t],
1326 [AC_DEFINE([ACE_HAS_SIGINFO_T], 1,
1327 [Define to 1 if the system has the type `siginfo_t'.])],
1329 [#include <signal.h>
1330 #ifndef ACE_LACKS_SIGINFO_H
1331 #include <siginfo.h>
1334 if test "$ac_cv_type_siginfo_t" = yes; then
1335 AC_CHECK_MEMBER([siginfo_t.si_addr],
1337 [AC_DEFINE([ACE_LACKS_SI_ADDR], 1,
1338 [Define to 1 if `si_addr' is not a member of `siginfo_t'.])],
1339 [#include <signal.h>
1340 #ifndef ACE_LACKS_SIGINFO_H
1341 #include <siginfo.h>
1346 dnl Some platforms need to include sys/types.h before sys/socket.h
1347 dnl in order for struct msghdr to work.
1348 dnl Check for msghdr structure.
1349 ACE_CACHE_CHECK([for struct msghdr],[ace_cv_struct_msghdr],
1351 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1352 #ifndef ACE_LACKS_SYS_TYPES_H
1353 # include <sys/types.h>
1355 #include <sys/socket.h>
1357 struct msghdr ace_msghdr;
1359 ace_cv_struct_msghdr=yes
1361 ace_cv_struct_msghdr=no
1363 ], [AC_DEFINE([ACE_HAS_MSG])],)
1365 ACE_CACHE_CHECK([for condition variable support],[ace_cv_struct_cond_t],
1367 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1368 #include <pthread.h>
1370 pthread_cond_t ace_pthread_cond_t;
1372 ace_cv_struct_cond_t=yes
1374 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1382 ace_cv_struct_cond_t=yes
1385 ace_cv_struct_cond_t=no
1388 ],,[AC_DEFINE([ACE_LACKS_COND_T])])
1390 dnl Check for struct timespec
1391 ACE_CACHE_CHECK([for POSIX timer structure],
1392 [ace_cv_lib_posix_timer_struct],
1394 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1395 #if !defined(ACE_LACKS_SYS_TIME_H)
1396 # include <sys/time.h>
1402 ace_cv_lib_posix_timer_struct=yes
1404 dnl Check if platform uses struct timestruc_t for POSIX timers
1405 dnl instead of struct timespec.
1406 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1414 ace_cv_lib_posix_timer_struct=yes
1415 dnl Check for struct timespec in <sys/timers.h>
1416 ACE_CACHE_CHECK([for struct timespec in sys/timers.h],
1417 [ace_cv_lib_posix_struct_timespec_broken],[
1418 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1420 #include <sys/timers.h>
1426 ace_cv_lib_posix_struct_timespec_broken=yes
1429 ace_cv_lib_posix_struct_timespec_broken=no
1434 ace_cv_lib_posix_timer_struct=no
1439 AC_DEFINE([ACE_HAS_POSIX_TIME])
1440 if test "$ace_cv_lib_posix_struct_timespec_broken" = yes; then
1441 AC_DEFINE([ACE_HAS_BROKEN_POSIX_TIME])
1445 dnl Check for struct timespec in <sys/timers.h>
1446 ACE_CACHE_CHECK([for struct timespec in sys/timers.h],
1447 [ace_cv_lib_posix_struct_timespec_broken],[
1448 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1449 #include <sys/timers.h>
1453 ace_cv_lib_posix_struct_timespec_broken=yes
1455 ace_cv_lib_posix_struct_timespec_broken=no
1457 ],[AC_DEFINE([ACE_HAS_BROKEN_POSIX_TIME])],)
1460 dnl Check for typedef timespec_t
1461 dnl TODO: Check whether this typedef can be defined somewhere else.
1462 ACE_CACHE_CHECK([for timespec_t],
1463 [ace_cv_lib_posix_timespec_t],[
1464 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1469 ace_cv_lib_posix_timespec_t=yes
1471 ace_cv_lib_posix_timespec_t=no
1473 ],,[AC_DEFINE([ACE_LACKS_TIMESPEC_T])])
1475 dnl Check for union semun
1476 ACE_CACHE_CHECK([for union semun],
1477 [ace_cv_lib_posix_defines_union_semun],[
1478 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1479 #ifndef ACE_LACKS_SYS_TYPES_H
1480 # include <sys/types.h>
1482 #include <sys/sem.h>
1484 /* We could also check if the macro _SEM_SEMUN_UNDEFINED is defined.
1489 ace_cv_lib_posix_defines_union_semun=yes
1491 ace_cv_lib_posix_defines_union_semun=no
1493 ],[AC_DEFINE([ACE_HAS_SEMUN])],)
1497 dnl SECTION 8: checks for variables
1499 dnl Check for more than two fields in struct rusage
1500 ACE_CACHE_CHECK([for limited struct rusage],
1501 [ace_cv_lib_limited_rusage],[
1502 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1503 #include <sys/time.h>
1504 #include <sys/resource.h>
1508 We just pick three (i.e. > 2) of the fields that
1509 ACE uses to see if we have a struct rusage that
1510 has more than two fields.
1512 ace_rusage.ru_ixrss = 0;
1513 ace_rusage.ru_idrss = 0;
1514 ace_rusage.ru_isrss = 0;
1516 ace_cv_lib_limited_rusage=no
1518 ace_cv_lib_limited_rusage=yes
1520 ],[AC_DEFINE([ACE_HAS_LIMITED_RUSAGE_T])],)
1522 dnl Check for sin_len member in struct sockaddr_in
1523 AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
1524 [AC_DEFINE([ACE_HAS_SOCKADDR_IN_SIN_LEN], 1,
1525 [Define to 1 if `sin_len' is a member of `sockaddr_in'.])],
1528 #ifndef ACE_LACKS_SYS_TYPES_H
1529 # include <sys/types.h>
1531 #include <sys/socket.h>
1532 #include <netinet/in.h>
1535 dnl Check for sin6_len member in struct sockaddr_in6
1536 AC_CHECK_MEMBER([struct sockaddr_in6.sin6_len],
1537 [AC_DEFINE([ACE_HAS_SOCKADDR_IN6_SIN6_LEN], 1,
1538 [Define to 1 if `sin6_len' is a member of `sockaddr_in6'.])],
1541 #ifndef ACE_LACKS_SYS_TYPES_H
1542 # include <sys/types.h>
1544 #include <sys/socket.h>
1545 #include <netinet/in.h>
1548 dnl Check for sys_siglist
1549 dnl TODO: Check whether this variable can be defined somewhere else.
1550 dnl [OSSAMA: Should we use autoconf's AC_CHECK_DECLS([sys_siglist])
1552 ACE_CACHE_CHECK([for sys_siglist],
1553 [ace_cv_lib_posix_sys_siglist],[
1554 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1555 #ifndef ACE_LACKS_UNISTD_H
1556 # include <unistd.h>
1559 #if !defined (_sys_siglist)
1560 # define _sys_siglist sys_siglist
1563 void* vp = (void*) &_sys_siglist;
1565 ace_cv_lib_posix_sys_siglist=yes
1567 ace_cv_lib_posix_sys_siglist=no
1569 ],[AC_DEFINE([ACE_HAS_SYS_SIGLIST])],)
1571 dnl Check for sys_errlist
1572 dnl TODO: Check whether this variable can be defined somewhere else.
1573 ACE_CACHE_CHECK([for sys_errlist],
1574 [ace_cv_lib_posix_sys_errlist],[
1575 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1578 #if !defined (_sys_errlist)
1579 # define _sys_errlist sys_errlist
1582 void* vp = (void*) &_sys_errlist;
1584 ace_cv_lib_posix_sys_errlist=yes
1586 dnl Check if sys_errlist is a global variable in a library
1587 AC_LINK_IFELSE([AC_LANG_PROGRAM(
1592 #if !defined (_sys_errlist)
1593 # define _sys_errlist sys_errlist
1596 extern const char * const _sys_errlist[];
1599 void* vp = (void*) &_sys_errlist;
1602 ace_cv_lib_posix_sys_errlist=yes
1605 ace_cv_lib_posix_sys_errlist=no
1608 ],[AC_DEFINE([ACE_HAS_SYS_ERRLIST])],)
1610 dnl Save the cache for debugging purposes
1614 dnl SECTION 9: checks for compiler characteristics
1617 dnl Check if compiler accepts "#pragma once" directive
1618 ACE_CONVERT_WARNINGS_TO_ERRORS([
1619 ACE_CACHE_CHECK([if compiler accepts "pragma once" directive],
1620 [ace_cv_has_pragma_once],
1622 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1625 int a = 0; /* Put this here so we don't have an empty main(). */
1627 ace_cv_has_pragma_once=yes
1629 ace_cv_has_pragma_once=no
1631 ],,[AC_DEFINE([ACE_LACKS_PRAGMA_ONCE])])
1632 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
1634 dnl If we are using GNU C++, see if it accepts the -pipe compiler flag.
1635 dnl "-pipe" on cygwin32 doesn't seem to work, for example.
1636 if test "$GXX" = yes; then
1637 PREPIPECXXFLAGS="$CXXFLAGS"
1638 CXXFLAGS="$CXXFLAGS -pipe"
1639 PREPIPECFLAGS="$CFLAGS"
1640 CFLAGS="$CFLAGS -pipe"
1641 ACE_CACHE_CHECK([if "-pipe" compiler flag is supported],
1642 [ace_cv_feature_gxx_has_pipe],
1644 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[int a = 0;]])],[
1645 ace_cv_feature_gxx_has_pipe=yes
1647 ace_cv_feature_gxx_has_pipe=no
1651 dnl We don't need to add "-pipe" here since it was already added
1653 dnl CXXFLAGS="$PREPIPECXXFLAGS -pipe"
1654 dnl CFLAGS="$PREPIPECFLAGS -pipe"
1657 CXXFLAGS="$PREPIPECXXFLAGS"
1658 CFLAGS="$PREPIPECFLAGS"
1662 dnl Check to see if we are running on a big endian platform
1663 dnl "ace/Basic_Types.h" should perhaps be modified to take advantage
1664 dnl of the results of this test.
1665 dnl Do not run this test if we are using a cross-compiler.
1666 AS_IF([test "$cross_compiling" != yes],
1671 dnl Check type sizes
1672 dnl If we get a size of zero, then the type is unknown to the compiler.
1674 dnl We don't need to check for sizeof(char) right now. Also conflicts with
1675 dnl ACE definition in Basic_Types.h, so we leave the test out.
1676 if test "$cross_compiling" != yes; then
1677 AC_CHECK_SIZEOF([wchar_t])
1678 if test "$ac_cv_sizeof_wchar_t" != 0; then
1679 AC_DEFINE_UNQUOTED([ACE_SIZEOF_WCHAR],[$ac_cv_sizeof_wchar_t],
1680 [Size of the native "wchar_t" type])
1682 AC_CHECK_SIZEOF([short])
1683 if test "$ac_cv_sizeof_short" != 0; then
1684 AC_DEFINE_UNQUOTED([ACE_SIZEOF_SHORT],[$ac_cv_sizeof_short],
1685 [Size of the native "short" type])
1687 AC_CHECK_SIZEOF([int])
1688 if test $ac_cv_sizeof_int != 0; then
1689 AC_DEFINE_UNQUOTED([ACE_SIZEOF_INT],[$ac_cv_sizeof_int],
1690 [Size of the native "int" type])
1692 AC_CHECK_SIZEOF([long])
1693 if test $ac_cv_sizeof_long != 0; then
1694 AC_DEFINE_UNQUOTED([ACE_SIZEOF_LONG],[$ac_cv_sizeof_long],
1695 [Size of the native "long" type])
1697 AC_CHECK_SIZEOF([long long])
1698 if test $ac_cv_sizeof_long_long != 0; then
1699 AC_DEFINE_UNQUOTED([ACE_SIZEOF_LONG_LONG],[$ac_cv_sizeof_long_long],
1700 [Size of the native "long long" type])
1702 AC_DEFINE([ACE_LACKS_LONGLONG_T])
1704 AC_CHECK_SIZEOF([void *])
1705 if test $ac_cv_sizeof_void_p != 0; then
1706 AC_DEFINE_UNQUOTED([ACE_SIZEOF_VOID_P],[$ac_cv_sizeof_void_p],
1707 [Size of the native "pointer to void" type])
1709 AC_CHECK_SIZEOF([float])
1710 if test $ac_cv_sizeof_float != 0; then
1711 AC_DEFINE_UNQUOTED([ACE_SIZEOF_FLOAT],[$ac_cv_sizeof_float],
1712 [Size of the native "float" type])
1714 AC_CHECK_SIZEOF([double])
1715 if test $ac_cv_sizeof_double != 0; then
1716 AC_DEFINE_UNQUOTED([ACE_SIZEOF_DOUBLE],[$ac_cv_sizeof_double],
1717 [Size of the native "double" type])
1719 AC_CHECK_SIZEOF([long double])
1720 if test $ac_cv_sizeof_long_double != 0; then
1721 AC_DEFINE_UNQUOTED([ACE_SIZEOF_LONG_DOUBLE],[$ac_cv_sizeof_long_double],
1722 [Size of the native "long double" type])
1725 dnl Set the 64 bit typedefs
1728 dnl if test "$ace_cv_type_u_longlong_t" = yes; then
1729 dnl This doesn't work: AC_CHECK_SIZEOF([u_longlong_t],[8])
1730 dnl if test $ac_cv_sizeof_u_longlong_t = 8; then
1731 dnl ACE_UINT64="u_longlong_t"
1732 dnl ace_u_long_long_typedef_set=yes
1734 dnl elif test $ac_cv_sizeof_long = 8; then
1735 if test $ac_cv_sizeof_long = 8; then
1736 ACE_INT64="signed long"
1737 ACE_UINT64="unsigned long"
1738 ace_u_long_long_typedef_set=yes
1739 elif test $ac_cv_sizeof_long_long = 8; then
1740 ACE_INT64="signed long long"
1741 ACE_UINT64="unsigned long long"
1742 ace_u_long_long_typedef_set=yes
1744 ace_u_long_long_typedef_set=no
1747 dnl Check for broken "signed char"
1748 dnl If AC_CHECK_SIZEOF(signed char) returns zero then "signed char"
1750 AC_CHECK_SIZEOF([signed char],[1])
1751 if test $ac_cv_sizeof_signed_char = 0; then
1752 AC_DEFINE([ACE_LACKS_SIGNED_CHAR])
1755 ace_u_long_long_typedef_set=no
1756 fi dnl test "$cross_compiling" != yes
1758 AC_CHECK_TYPE([intmax_t],
1760 [AC_DEFINE([ACE_LACKS_INTMAX_T], 1,
1761 [Define to 1 if the system lacks the type `intmax_t'.])],
1763 #ifndef ACE_LACKS_STDINT_H
1766 #ifndef ACE_LACKS_INTTYPES_H
1767 #include <inttypes.h>
1770 AC_CHECK_TYPE([uintmax_t],
1772 [AC_DEFINE([ACE_LACKS_UINTMAX_T], 1,
1773 [Define to 1 if the system lacks the type `uintmax_t'.])],
1775 #ifndef ACE_LACKS_STDINT_H
1778 #ifndef ACE_LACKS_INTTYPES_H
1779 #include <inttypes.h>
1782 AC_CHECK_TYPE([intptr_t],
1784 [AC_DEFINE([ACE_LACKS_INTPTR_T], 1,
1785 [Define to 1 if the system lacks the type `intptr_t'.])],
1787 #ifndef ACE_LACKS_STDINT_H
1790 #ifndef ACE_LACKS_INTTYPES_H
1791 #include <inttypes.h>
1794 AC_CHECK_TYPE([uintptr_t],
1796 [AC_DEFINE([ACE_LACKS_UINTPTR_T], 1,
1797 [Define to 1 if the system lacks the type `uintptr_t'.])],
1799 #ifndef ACE_LACKS_STDINT_H
1802 #ifndef ACE_LACKS_INTTYPES_H
1803 #include <inttypes.h>
1806 AC_CHECK_TYPE([int8_t],
1807 [AC_DEFINE([ACE_HAS_INT8_T], 1,
1808 [Define to 1 if the system has the type `int8_t'.])],
1811 #ifndef ACE_LACKS_STDINT_H
1814 #ifndef ACE_LACKS_INTTYPES_H
1815 #include <inttypes.h>
1818 AC_CHECK_TYPE([uint8_t],
1819 [AC_DEFINE([ACE_HAS_UINT8_T], 1,
1820 [Define to 1 if the system has the type `uint8_t'.])],
1823 #ifndef ACE_LACKS_STDINT_H
1826 #ifndef ACE_LACKS_INTTYPES_H
1827 #include <inttypes.h>
1830 AC_CHECK_TYPE([int16_t],
1831 [AC_DEFINE([ACE_HAS_INT16_T], 1,
1832 [Define to 1 if the system has the type `int16_t'.])],
1835 #ifndef ACE_LACKS_STDINT_H
1838 #ifndef ACE_LACKS_INTTYPES_H
1839 #include <inttypes.h>
1842 AC_CHECK_TYPE([uint16_t],
1843 [AC_DEFINE([ACE_HAS_UINT16_T], 1,
1844 [Define to 1 if the system has the type `uint16_t'.])],
1847 #ifndef ACE_LACKS_STDINT_H
1850 #ifndef ACE_LACKS_INTTYPES_H
1851 #include <inttypes.h>
1854 AC_CHECK_TYPE([int32_t],
1855 [AC_DEFINE([ACE_HAS_INT32_T], 1,
1856 [Define to 1 if the system has the type `int32_t'.])],
1859 #ifndef ACE_LACKS_STDINT_H
1862 #ifndef ACE_LACKS_INTTYPES_H
1863 #include <inttypes.h>
1866 AC_CHECK_TYPE([uint32_t],
1867 [AC_DEFINE([ACE_HAS_UINT32_T], 1,
1868 [Define to 1 if the system has the type `uint32_t'.])],
1871 #ifndef ACE_LACKS_STDINT_H
1874 #ifndef ACE_LACKS_INTTYPES_H
1875 #include <inttypes.h>
1878 AC_CHECK_TYPE([int64_t],
1879 [AC_DEFINE([ACE_HAS_INT64_T], 1,
1880 [Define to 1 if the system has the type `int64_t'.])],
1883 #ifndef ACE_LACKS_STDINT_H
1886 #ifndef ACE_LACKS_INTTYPES_H
1887 #include <inttypes.h>
1890 AC_CHECK_TYPE([uint64_t],
1891 [AC_DEFINE([ACE_HAS_UINT64_T], 1,
1892 [Define to 1 if the system has the type `uint64_t'.])],
1895 #ifndef ACE_LACKS_STDINT_H
1898 #ifndef ACE_LACKS_INTTYPES_H
1899 #include <inttypes.h>
1902 ACE_CACHE_CHECK([for std::numeric_limits<>],
1903 [ace_cv_func_numeric_limits],
1904 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <limits>],
1905 [return std::numeric_limits<int>::max();])],
1906 [ace_cv_func_numeric_limits=yes],
1907 [ace_cv_func_numeric_limits=no])
1908 ],,[AC_DEFINE([ACE_LACKS_NUMERIC_LIMITS])])
1915 dnl Check for istream operator>> for char, unsigned char and signed char
1916 ACE_CACHE_CHECK([for istream operator>> for char types],
1917 [ace_cv_feature_char_right_shifts],
1919 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1920 #include <iostream.h>
1922 unsigned char a = 0;
1925 #ifndef ACE_LACKS_SIGNED_CHAR
1930 ace_cv_feature_char_right_shifts=yes
1932 ace_cv_feature_char_right_shifts=no
1934 ],,[AC_DEFINE([ACE_LACKS_CHAR_RIGHT_SHIFTS])])
1937 dnl Check for istream operator>> for char *, unsigned char * and signed char *
1938 ACE_CACHE_CHECK([for istream operator>> for char * types],
1939 [ace_cv_feature_char_ptr_right_shifts],
1941 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1942 #include <iostream.h>
1944 unsigned char * a = 0;
1947 #ifndef ACE_LACKS_SIGNED_CHAR
1948 signed char * b = 0;
1952 ace_cv_feature_char_ptr_right_shifts=yes
1954 ace_cv_feature_char_ptr_right_shifts=no
1956 ],,[AC_DEFINE([ACE_LACKS_CHAR_STAR_RIGHT_SHIFTS])])
1958 dnl Check to see how to call the explicit destructor on a template.
1959 dnl There are a few different possibilities:
1960 dnl ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR (two cases):
1961 dnl ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS: ~CLASS<PARAM>()
1962 dnl (no other settings): ~CLASS()
1963 dnl w/o ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR:
1964 dnl CLASS<PARAM>::~CLASS()
1966 dnl The first seems to be the most widely used form, although very few
1967 dnl hand-made configs have it set. Many compilers take all three forms.
1968 dnl The only one that seems to be less-used is #2 above, ~CLASS().
1969 dnl So, we check for the first two cases, and if neither of them work,
1970 dnl we assume the third (no config macros).
1972 ACE_CACHE_CHECK([to see if template destructor call takes template args],
1973 [ace_cv_feature_explicit_template_des_takes_args],
1975 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1989 virtual void f (void) { }
1999 x_ = new Base<T> ();
2001 virtual void f (void) { }
2002 ~Derived () { x_->~Base<T> (); }
2008 Derived<dyn> *x = new Derived<dyn> ();
2015 ace_cv_feature_explicit_template_des_takes_args=yes
2017 ace_cv_feature_explicit_template_des_takes_args=no
2020 AC_DEFINE([ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS])
2021 AC_DEFINE([ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR])
2025 dnl Check for the second form of C++ explicit template destructors
2026 dnl Thanks to Nanbor Wang <nanbor@cs.wustl.edu> for providing this test.
2027 if test "$ace_cv_feature_explicit_template_des_takes_args" = no; then
2028 ACE_CACHE_CHECK([for working C++ explicit template destructors],
2029 [ace_cv_feature_working_explicit_des],
2031 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2045 virtual void f (void) { }
2055 x_ = new Base<T> ();
2057 virtual void f (void) { }
2058 ~Derived () { x_->~Base (); }
2064 Derived<dyn> *x = new Derived<dyn> ();
2071 ace_cv_feature_working_explicit_des=yes
2073 ace_cv_feature_working_explicit_des=no
2075 ],[AC_DEFINE([ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR])],)
2078 dnl Check for C++ "std" namespace
2079 ACE_CACHE_CHECK([for C++ "std" namespace],
2080 [ace_cv_feature_posix_uses_std_namespace],[
2081 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2082 #if defined (ACE_USES_OLD_IOSTREAMS)
2083 # include <iostream.h>
2085 # include <iostream>
2088 std::cout << "FOO" << std::endl;
2090 ace_cv_feature_posix_uses_std_namespace=yes
2092 ace_cv_feature_posix_uses_std_namespace=no
2094 ],[AC_DEFINE([ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB])],)
2096 dnl Check for new style C++ include file support
2097 ACE_CACHE_CHECK([for new style C++ include file support],
2098 [ace_cv_lib_posix_standard_includes],[
2099 ace_cv_lib_posix_standard_includes=no
2100 if test "$ace_cv_feature_posix_uses_std_namespace" = yes; then
2101 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2104 #ifdef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB
2108 #endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
2109 ]])],[ace_cv_lib_posix_standard_includes=yes],[])
2113 AC_DEFINE([ACE_HAS_STDCPP_STL_INCLUDES])
2114 AC_DEFINE([ACE_HAS_STRING_CLASS])
2117 AC_CHECK_HEADER([map],
2119 AC_CHECK_HEADER([net/if.h],
2121 ACE_CACHE_CHECK([if STL map class conflicts with <net/if.h> map struct],
2122 [ace_cv_header_stl_map_conflict],
2124 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2125 #ifndef ACE_LACKS_SYS_TYPES_H
2126 # include <sys/types.h>
2131 #ifdef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB
2132 std::map<char, char> ace_map;
2134 map<char, char> ace_map;
2135 #endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
2137 ace_cv_header_stl_map_conflict=no
2139 ace_cv_header_stl_map_conflict=yes
2141 ],[AC_DEFINE([ACE_HAS_STL_MAP_CONFLICT])],)
2145 AC_CHECK_HEADER([queue],
2147 AC_CHECK_HEADER([netinet/in.h],
2149 ACE_CACHE_CHECK([if STL queue class conflicts with <netinet/in.h> queue struct],
2150 [ace_cv_header_stl_queue_conflict],
2152 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2153 #ifndef ACE_LACKS_SYS_TYPES_H
2154 # include <sys/types.h>
2157 #include <netinet/in.h>
2159 #ifdef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB
2160 std::queue<char> ace_queue;
2162 queue<char> ace_queue;
2163 #endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
2165 ace_cv_header_stl_queue_conflict=no
2167 ace_cv_header_stl_queue_conflict=yes
2169 ],[AC_DEFINE([ACE_HAS_STL_QUEUE_CONFLICT])],)
2173 dnl Check whether platform supports the standard C++ library
2174 dnl TODO: For now, check whether headers <new>, <iomanip>
2175 dnl and <memory> exist; is there a better way?
2176 if test "$ac_cv_header_new" = yes &&
2177 test "$ac_cv_header_iomanip" = yes &&
2178 test "$ac_cv_header_memory" = yes; then
2180 dnl Check for auto_ptr class
2181 ACE_CACHE_CHECK([for C++ auto_ptr class],
2182 [ace_cv_lib_auto_ptr_class],
2184 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2189 #ifdef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB
2190 std::auto_ptr<int> safe (foo);
2192 auto_ptr<int> safe (foo);
2194 foo = safe.release ();
2198 ace_cv_lib_auto_ptr_class=yes
2200 ace_cv_lib_auto_ptr_class=no
2204 AC_DEFINE([ACE_HAS_STANDARD_CPP_LIBRARY])
2207 AC_DEFINE([ACE_LACKS_AUTO_PTR])
2211 if test "$ace_cv_lib_auto_ptr_class" = yes; then
2212 dnl Check for auto_ptr reset method
2213 ACE_CACHE_CHECK([for C++ auto_ptr reset method],
2214 [ace_cv_lib_auto_ptr_reset],
2216 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2221 #ifdef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB
2222 std::auto_ptr<int> safe (foo);
2224 auto_ptr<int> safe (foo);
2230 foo = safe.release ();
2232 ace_cv_lib_auto_ptr_reset=yes
2234 ace_cv_lib_auto_ptr_reset=no
2236 ],,[AC_DEFINE([ACE_AUTO_PTR_LACKS_RESET])])
2237 fi dnl test $ace_cv_lib_auto_ptr_class=yes
2239 dnl Check if platform supports placement delete operator
2240 ACE_CACHE_CHECK([for C++ placement delete operator],
2241 [ace_cv_feature_placement_delete],[
2242 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2243 #if defined (ACE_HAS_NEW_NO_H)
2245 #elif defined (ACE_HAS_NEW_H)
2252 void *operator new (size_t, void *p) { return p; }
2253 void operator delete (void *p, void *) {}
2257 foo *f = new (x) foo;
2259 // delete f; // Don't call delete for this test!
2261 ace_cv_feature_placement_delete=yes
2263 ace_cv_feature_placement_delete=no
2265 ],,[AC_DEFINE([ACE_LACKS_PLACEMENT_OPERATOR_DELETE])])
2268 dnl Check if templates require source on platform
2270 dnl FIXME: This test may be broken.
2272 dnl FIXME: This test contains vestigial bits of tests for explicit
2273 dnl template instantiation feature macros, even though support for
2274 dnl the same has been removed.
2276 dnl A rewrite to test only whether ACE_TEMPLATES_REQUIRE_SOURCE or
2277 dnl ACE_TEMPLATES_REQUIRE_PRAGMA is clearly needed.
2279 ACE_CACHE_CHECK([if templates require source],
2280 [ace_cv_feature_templates_require_source],
2282 dnl Create the common header file
2283 cat > ace_test.h <<EOF
2306 dnl Create template source test file
2307 cat > ace_test.$ac_ext <<EOF
2308 #include "ace_test.h"
2315 // Nothing else to do.
2319 Bar<T>::Bar (Foo<T> *val)
2322 // Nothing else to do.
2324 #endif /* FOO_CXX */
2327 dnl Add the ACE-specific compiler flags to the compiler flags for
2328 dnl the duration of this test.
2329 ace_cxx_template_save_CXXFLAGS="$CXXFLAGS"
2330 ace_cxx_template_save_CPPFLAGS="$CPPFLAGS"
2331 ace_cxx_template_save_LDFLAGS="$LDFLAGS"
2332 CXXFLAGS="$ACE_CXXFLAGS $CXXFLAGS"
2333 CPPFLAGS="$ACE_CPPFLAGS $CPPFLAGS"
2334 LDFLAGS="$ACE_LDFLAGS $LDFLAGS"
2336 dnl Remove any template repositories.
2337 rm -rf Templates.DB SunWS_cache ptrepository *.rpo
2339 dnl First try without explicit template instantiation.
2340 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2341 #include "ace_test.h"
2346 dnl Template source is not required.
2347 ace_cv_feature_templates_require_source=no
2349 dnl Template source does not require pragma.
2350 AC_CACHE_VAL([ace_cv_feature_templates_require_pragma],
2351 [ace_cv_feature_templates_require_pragma=no])
2353 dnl Explicit template instantiation is not required.
2354 AC_CACHE_VAL([ace_cv_feature_explicit_template_instantiation],
2355 [ace_cv_feature_explicit_template_instantiation=no])
2357 dnl Pragma template instantiation is not required.
2358 AC_CACHE_VAL([ace_cv_feature_pragma_template_instantiation],
2359 [ace_cv_feature_pragma_template_instantiation=no])
2361 dnl Remove any template repositories.
2362 rm -rf Templates.DB SunWS_cache ptrepository *.rpo
2364 dnl Now try including the template source.
2365 AC_LINK_IFELSE([AC_LANG_PROGRAM(
2367 #include "ace_test.h"
2368 #include "ace_test.$ac_ext"
2376 dnl Template source is required!
2377 ace_cv_feature_templates_require_source=yes
2379 dnl Template source does not require pragma.
2380 AC_CACHE_VAL([ace_cv_feature_templates_require_pragma],
2381 [ace_cv_feature_templates_require_pragma=no])
2383 dnl Explicit template instantiation is not required.
2384 AC_CACHE_VAL([ace_cv_feature_explicit_template_instantiation],
2385 [ace_cv_feature_explicit_template_instantiation=no])
2387 dnl Pragma template instantiation is not required.
2388 AC_CACHE_VAL([ace_cv_feature_pragma_template_instantiation],
2389 [ace_cv_feature_pragma_template_instantiation=no])
2392 dnl BEGIN OUTER REQUIRE SOURCE #########################################
2393 dnl Remove any generated template repositories.
2394 rm -rf Templates.DB SunWS_cache ptrepository *.rpo
2396 dnl Now try with explicit template instantiation.
2397 AC_LINK_IFELSE([AC_LANG_PROGRAM(
2399 #include "ace_test.h"
2401 template class Foo<int>;
2402 template class Bar<char>;
2409 dnl Template source is not required.
2410 ace_cv_feature_templates_require_source=no
2412 dnl Template source does not require pragma.
2413 AC_CACHE_VAL([ace_cv_feature_templates_require_pragma],
2414 [ace_cv_feature_templates_require_pragma=no])
2416 dnl Explicit template instantiation is required.
2417 AC_CACHE_VAL([ace_cv_feature_explicit_template_instantiation],
2418 [ace_cv_feature_explicit_template_instantiation=yes])
2420 dnl Pragma template instantiation is not required.
2421 AC_CACHE_VAL([ace_cv_feature_pragma_template_instantiation],
2422 [ace_cv_feature_pragma_template_instantiation=no])
2425 dnl Remove any generated template repositories.
2426 rm -rf Templates.DB SunWS_cache ptrepository *.rpo
2429 dnl ace_cv_feature_pragma_template_instantiation
2430 dnl to "no" here. It should only be set to "no" if
2431 dnl explicit template instantiation works.
2433 dnl Now try including the template source.
2434 AC_LINK_IFELSE([AC_LANG_PROGRAM(
2436 #include "ace_test.h"
2437 #include "ace_test.$ac_ext"
2439 template class Foo<int>;
2440 template class Bar<char>;
2447 dnl Template source is required!
2448 ace_cv_feature_templates_require_source=yes
2450 dnl Template source does not require pragma.
2451 AC_CACHE_VAL([ace_cv_feature_templates_require_pragma],
2452 [ace_cv_feature_templates_require_pragma=no])
2454 dnl Explicit template instantiation is required.
2456 [ace_cv_feature_explicit_template_instantiation],
2457 [ace_cv_feature_explicit_template_instantiation=yes])
2459 dnl Pragma template instantiation is not required.
2461 [ace_cv_feature_pragma_template_instantiation],
2462 [ace_cv_feature_pragma_template_instantiation=no])
2465 dnl BEGIN INNER REQUIRE SOURCE #########################################
2466 dnl Remove any generated template repositories.
2467 rm -rf Templates.DB SunWS_cache ptrepository *.rpo
2470 dnl ace_cv_feature_explicit_template_instantiation
2471 dnl to "no" here. It should only be set to "no" if
2472 dnl pragma template instantiation works.
2474 dnl Now try with pragma template instantiation.
2475 AC_LINK_IFELSE([AC_LANG_PROGRAM(
2477 #include "ace_test.h"
2479 #pragma instantiate Foo<int>
2480 #pragma instantiate Bar<char>
2487 dnl Template source is not required.
2488 ace_cv_feature_templates_require_source=no
2490 dnl Template source does not require pragma.
2492 [ace_cv_feature_templates_require_pragma],
2493 [ace_cv_feature_templates_require_pragma=no])
2495 dnl Explicit template instantiation is not required.
2497 [ace_cv_feature_explicit_template_instantiation],
2498 [ace_cv_feature_explicit_template_instantiation=no])
2500 dnl Pragma template instantiation is required.
2502 [ace_cv_feature_pragma_template_instantiation],
2503 [ace_cv_feature_pragma_template_instantiation=yes])
2506 dnl Remove any generated template repositories.
2507 rm -rf Templates.DB SunWS_cache ptrepository *.rpo
2510 dnl ace_cv_feature_explicit_template_instantiation
2511 dnl to "no" here. It should only be set to "no" if
2512 dnl pragma template instantiation works.
2514 dnl Now try including the template source.
2515 AC_LINK_IFELSE([AC_LANG_PROGRAM(
2517 #include "ace_test.h"
2518 #include "ace_test.$ac_ext"
2520 #pragma instantiate Foo<int>
2521 #pragma instantiate Bar<char>
2528 dnl Template source is required!
2529 ace_cv_feature_templates_require_source=yes
2531 dnl Template source does not require pragma.
2533 [ace_cv_feature_templates_require_pragma],
2534 [ace_cv_feature_templates_require_pragma=no])
2536 dnl Explicit template instantiation is not required.
2538 [ace_cv_feature_explicit_template_instantiation],
2539 [ace_cv_feature_explicit_template_instantiation=no])
2541 dnl Pragma template instantiation is required.
2543 [ace_cv_feature_pragma_template_instantiation],
2544 [ace_cv_feature_pragma_template_instantiation=yes])
2547 dnl If we get here, then we have no idea what is needed!
2548 ace_cv_feature_templates_require_source=no
2551 dnl END INNER REQUIRE SOURCE #########################################
2554 dnl END OUTER REQUIRE SOURCE #########################################
2558 dnl Remove any generated template repositories.
2559 rm -rf Templates.DB SunWS_cache ptrepository *.rpo
2561 dnl Remove the test additional test files.
2564 dnl Restore the compiler flags
2565 CXXFLAGS="$ace_cxx_template_save_CXXFLAGS"
2566 CPPFLAGS="$ace_cxx_template_save_CPPFLAGS"
2567 LDFLAGS="$ace_cxx_template_save_LDFLAGS"
2570 AC_DEFINE([ACE_TEMPLATES_REQUIRE_SOURCE])
2573 dnl Check if templates require pragma.
2574 ACE_CACHE_CHECK([if templates require pragma],
2575 [ace_cv_feature_templates_require_pragma],
2577 dnl Create the common header file
2578 cat > ace_test.h <<EOF
2601 dnl Create template source test file
2602 cat > ace_test.$ac_ext <<EOF
2603 #include "ace_test.h"
2610 // Nothing else to do.
2614 Bar<T>::Bar (Foo<T> *val)
2617 // Nothing else to do.
2619 #endif /* FOO_CXX */
2622 dnl Add the ACE-specific compiler flags to the compiler flags for
2623 dnl the duration of this test.
2624 ace_cxx_template_save_CXXFLAGS="$CXXFLAGS"
2625 ace_cxx_template_save_CPPFLAGS="$CPPFLAGS"
2626 ace_cxx_template_save_LDFLAGS="$LDFLAGS"
2627 CXXFLAGS="$ACE_CXXFLAGS $CXXFLAGS"
2628 CPPFLAGS="$ACE_CPPFLAGS $CPPFLAGS"
2629 LDFLAGS="$ACE_LDFLAGS $LDFLAGS"
2631 dnl Remove any template repositories.
2632 rm -rf Templates.DB SunWS_cache ptrepository *.rpo
2634 dnl We already know that the simplest case doesn't work so go
2635 dnl straight to the "require pragma" test.
2637 dnl Now try including the template pragma.
2638 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2639 #include "ace_test.h"
2641 #pragma implementation ("ace_test.$ac_ext")
2646 dnl Template source is required!
2647 ace_cv_feature_templates_require_pragma=yes
2649 dnl BEGIN OUTER REQUIRE PRAGMA #########################################
2650 dnl Remove any generated template repositories.
2651 rm -rf Templates.DB SunWS_cache ptrepository *.rpo
2653 dnl Now try with explicit template instantiation.
2654 AC_LINK_IFELSE([AC_LANG_PROGRAM(
2656 #include "ace_test.h"
2658 #pragma implementation ("ace_test.$ac_ext")
2660 template class Foo<int>;
2661 template class Bar<char>;
2668 dnl Template pragma is required!
2669 ace_cv_feature_templates_require_pragma=yes
2671 dnl Explicit template instantiation is required.
2673 [ace_cv_feature_explicit_template_instantiation],
2674 [ace_cv_feature_explicit_template_instantiation=yes])
2676 dnl Pragma template instantiation is not required.
2678 [ace_cv_feature_pragma_template_instantiation],
2679 [ace_cv_feature_pragma_template_instantiation=no])
2682 dnl BEGIN INNER REQUIRE PRAGMA #########################################
2683 dnl Remove any generated template repositories.
2684 rm -rf Templates.DB SunWS_cache ptrepository *.rpo
2686 dnl Now try with pragma template instantiation.
2687 AC_LINK_IFELSE([AC_LANG_PROGRAM(
2689 #include "ace_test.h"
2691 #pragma implementation ("ace_test.$ac_ext")
2693 #pragma instantiate Foo<int>
2694 #pragma instantiate Bar<char>
2701 dnl Template pragma is required!
2702 ace_cv_feature_templates_require_pragma=yes
2704 dnl Explicit template instantiation is not required.
2706 [ace_cv_feature_explicit_template_instantiation],
2707 [ace_cv_feature_explicit_template_instantiation=no])
2709 dnl Pragma template instantiation is required.
2711 [ace_cv_feature_pragma_template_instantiation],
2712 [ace_cv_feature_pragma_template_instantiation=yes])
2715 dnl If we get here, then we have no idea what is needed!
2716 ace_cv_feature_templates_require_pragma=no
2718 dnl END INNER REQUIRE PRAGMA #########################################
2720 dnl END OUTER REQUIRE PRAGMA #########################################
2723 dnl Remove any generated template repositories.
2724 rm -rf Templates.DB SunWS_cache ptrepository *.rpo
2726 dnl Remove the additional test files.
2729 dnl Restore the compiler flags
2730 CXXFLAGS="$ace_cxx_template_save_CXXFLAGS"
2731 CPPFLAGS="$ace_cxx_template_save_CPPFLAGS"
2732 LDFLAGS="$ace_cxx_template_save_LDFLAGS"
2735 AC_DEFINE([ACE_TEMPLATES_REQUIRE_PRAGMA])
2743 dnl Check if platform supports template typedefs
2744 ACE_CACHE_CHECK([for template typedefs],
2745 [ace_cv_feature_posix_template_typedefs],[
2746 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2752 Bar(int bar) : bar_(bar) {}
2753 int value() const { return bar_; }
2762 typedef typename T::Y Y;
2763 Foo(T* foo) : foo_(foo) {}
2770 void Foo<T>::print(typename T::Y)
2778 ace_cv_feature_posix_template_typedefs=yes
2780 ace_cv_feature_posix_template_typedefs=no
2782 ],[AC_DEFINE([ACE_HAS_TEMPLATE_TYPEDEFS])],)
2784 dnl Check if platform supports static data member templates
2785 ACE_CACHE_CHECK([for static data member templates],
2786 [ace_cv_feature_posix_static_data_member_templates],[
2787 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2795 template <class T> T* Foo<T>::sdm = 0;
2799 ace_cv_feature_posix_static_data_member_templates=yes
2801 ace_cv_feature_posix_static_data_member_templates=no
2803 ],,[AC_DEFINE([ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES])])
2805 dnl Check if compiler needs definitions for hidden functions
2806 ACE_CACHE_CHECK([if definition is needed for hidden functions],
2807 [ace_cv_feature_need_func_def],
2809 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2813 Foo (void) { a_ = 0; }
2816 void operator= (const Foo &);
2823 ace_cv_feature_need_func_def=no
2825 AC_LINK_IFELSE([AC_LANG_PROGRAM(
2830 Foo (void) { a_ = 0; }
2833 const Foo & operator= (const Foo &);
2838 Foo::Foo (const Foo &)
2844 Foo::operator= (const Foo &)
2855 ace_cv_feature_need_func_def=yes
2858 dnl If we get here then we don't know what is needed!
2859 ace_cv_feature_need_func_def=no
2864 AC_DEFINE([ACE_NEEDS_FUNC_DEFINITIONS])
2867 dnl Check if platform supports C++ exceptions
2868 if test "$ace_user_enable_exceptions" = yes; then
2869 ACE_CACHE_CHECK([for C++ exceptions],
2870 [ace_cv_feature_posix_exceptions],[
2871 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[
2883 ace_cv_feature_posix_exceptions=yes
2885 ace_cv_feature_posix_exceptions=no
2887 ],[AC_DEFINE([ACE_HAS_EXCEPTIONS])],[ace_user_enable_exceptions=no])
2889 fi dnl test "$ace_user_enable_exceptions" = yes
2891 dnl Check if we need a non-static object manager
2893 dnl ACE_CACHE_CHECK([if we need a non-static object manager],
2894 dnl [ace_cv_feature_nonstatic_object_manager],[
2895 dnl ace_cv_feature_nonstatic_object_manager=yes
2896 dnl TODO: Should we check for this thing (and HOW), or
2897 dnl should it be the user's choice?
2899 dnl For now, we will leave it as a user's choice.
2903 dnl Don't define anything until we have a test for this.
2904 dnl AC_DEFINE([ACE_HAS_NONSTATIC_OBJECT_MANAGER])
2907 dnl Save the cache for debugging purposes
2911 dnl SECTION 10: checks for library functions
2914 ACE_FUNC_STRNCASECMP
2917 ACE_FUNC_WCSNCASECMP
2920 if test "$ace_user_enable_alloca" = yes; then
2922 if test "$ac_cv_header_alloca_h" = yes; then
2923 AC_DEFINE([ACE_HAS_ALLOCA_H])
2925 if test "$ac_cv_func_alloca_works" = yes; then
2926 AC_DEFINE([ACE_HAS_ALLOCA])
2930 dnl ACE should really have something for both the sys/mman.h header
2931 dnl and the mmap function since we need sys/mman.h for functions like
2932 dnl mprotect and msync, but don't want to use mmap if it doesn't work.
2933 dnl For now, we just check for the sys/mman.h header earlier in this
2934 dnl configure script.
2937 dnl if test "$ac_cv_func_mmap_fixed_mapped" = no; then
2938 dnl Even if we have mmap, do not use if broken!
2939 dnl AC_DEFINE(ACE_LACKS_MMAP)
2942 dnl Check if closedir() returns a meaningful value
2943 AC_FUNC_CLOSEDIR_VOID
2945 dnl Check for PWD functions
2946 AC_CHECK_FUNC([getpwnam],,)
2947 AC_CHECK_FUNC([setpwent],,)
2948 AC_CHECK_FUNC([endpwent],,)
2949 AC_CHECK_FUNC([getpwent],,)
2950 AC_CHECK_FUNC([getpwuid],,)
2952 if test "$ac_cv_func_getpwnam" != yes ||
2953 test "$ac_cv_func_setpwent" != yes ||
2954 test "$ac_cv_func_endpwent" != yes ||
2955 test "$ac_cv_func_getpwent" != yes ||
2956 test "$ac_cv_func_getpwuid" != yes; then
2957 AC_DEFINE([ACE_LACKS_PWD_FUNCTIONS])
2959 dnl The password file related functions above are required for ACE's
2960 dnl alternate implementation.
2962 ACE_CONVERT_WARNINGS_TO_ERRORS([
2963 dnl Check for functions necessary for ACE's alternate implementation
2964 dnl of the now obsolete cuserid() function.
2965 ACE_CACHE_CHECK([checking if ACE cuserid() implementation should be used],
2966 [ace_cv_lib_use_alt_cuserid],
2968 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2969 /* Undefine _XOPEN_SOURCE since it may make the cuserid() prototype
2970 visible. ACE should not rely on such feature test macros. */
2971 #undef _XOPEN_SOURCE
2972 #ifndef ACE_LACKS_UNISTD_H
2973 # include <unistd.h>
2975 # error No unistd.h header. Need header where cuserid() is located.
2976 #endif /* ACE_LACKS_UNISTD_H */
2978 char * foo = cuserid ((char *)0);
2980 dnl If successful then use the system cuserid() implementation,
2981 dnl despite the fact that ACE's implementation may be safer.
2982 ace_cv_lib_use_alt_cuserid=no
2984 AC_LINK_IFELSE([AC_LANG_PROGRAM(
2986 #ifndef ACE_LACKS_SYS_TYPES_H
2987 # include <sys/types.h>
2989 #undef _XOPEN_SOURCE
2990 #ifndef ACE_LACKS_UNISTD_H
2991 # include <unistd.h>
2993 # error No unistd.h header. Need header where geteuid() is located.
2997 uid_t foo = geteuid ();
3000 dnl All of the functions necessary for ACE's cuserid()
3001 dnl implementation exist.
3002 ace_cv_lib_use_alt_cuserid=yes
3005 dnl If we get here, we're hosed!
3006 ace_cv_lib_use_alt_cuserid=no
3011 AC_DEFINE([ACE_HAS_ALT_CUSERID])
3018 dnl Check for `strftime' in the `intl' library, for SCO UNIX
3023 AC_CHECK_FUNC([CancelIO],
3024 [AC_DEFINE([ACE_HAS_CANCEL_IO])],)
3026 AC_CHECK_FUNC([SignalObjectAndWait],
3027 [AC_DEFINE([ACE_HAS_SIGNAL_OBJECT_AND_WAIT])],)
3029 AC_CHECK_FUNC([TryEnterCriticalSection],
3030 [AC_DEFINE([ACE_HAS_WIN32_TRYLOCK])],)
3036 ACE_CHECK_HAS_FUNCS(_InterlockedIncrement _InterlockedDecrement _InterlockedExchangeAdd)
3037 if test "$ac_cv_func__InterlockedIncrement" = yes &&
3038 test "$ac_cv_func__InterlockedDecrement" = yes &&
3039 test "$ac_cv_func__InterlockedExchangeAdd" = yes; then
3040 AC_DEFINE([ACE_HAS_INTRINSIC_INTERLOCKED])
3043 ACE_CHECK_LACKS_FUNCS(access)
3045 ACE_CHECK_LACKS_FUNCS(alphasort)
3047 ACE_CHECK_LACKS_FUNCS(asctime)
3049 ACE_CHECK_LACKS_FUNCS(asctime_r)
3051 ACE_CHECK_LACKS_FUNCS(alarm)
3053 ACE_CHECK_LACKS_FUNCS(bsearch)
3055 ACE_CHECK_HAS_DEFINES([bswap16])
3056 if test "$ace_cv_defined_bswap16" = no; then
3057 ACE_CHECK_HAS_DEFINES([bswap_16],[],[],[
3058 #if ACE_HAS_BYTESWAP_H
3059 #include <byteswap.h>
3062 ACE_CHECK_HAS_DEFINES([bswap32])
3063 if test "$ace_cv_defined_bswap32" = no; then
3064 ACE_CHECK_HAS_DEFINES([bswap_32],[],[],[
3065 #if ACE_HAS_BYTESWAP_H
3066 #include <byteswap.h>
3069 ACE_CHECK_HAS_DEFINES([bswap64])
3070 if test "$ace_cv_defined_bswap64" = no; then
3071 ACE_CHECK_HAS_DEFINES([bswap_64],[],[],[
3072 #if ACE_HAS_BYTESWAP_H
3073 #include <byteswap.h>
3077 ACE_CHECK_LACKS_FUNCS(chdir)
3079 ACE_CHECK_HAS_FUNCS(clock_gettime clock_settime nanosleep)
3081 ACE_CHECK_LACKS_FUNCS(difftime)
3083 ACE_CHECK_LACKS_FUNCS(dup)
3085 ACE_CHECK_LACKS_FUNCS(dup2)
3087 dnl ACE uses execv, execvp and execve, so we don't bother to check
3088 dnl for the others (e.g. execl, execlp, execle)
3089 AC_CHECK_FUNC(execv)
3090 AC_CHECK_FUNC(execvp)
3091 AC_CHECK_FUNC(execve)
3092 if test "$ac_cv_func_execv" != yes &&
3093 test "$ac_cv_func_execvp" != yes &&
3094 test "$ac_cv_func_execve" != yes; then
3095 AC_DEFINE([ACE_LACKS_EXEC])
3098 ACE_CHECK_LACKS_FUNCS(fgetwc fcntl fork fsync)
3100 ACE_CHECK_LACKS_FUNCS(getcwd)
3102 ACE_CHECK_LACKS_FUNCS(gethostent)
3104 ACE_CHECK_LACKS_FUNCS(getipnodebyaddr)
3106 ACE_CHECK_LACKS_FUNCS(getipnodebyname)
3108 ACE_CHECK_HAS_FUNCS(getifaddrs)
3110 ACE_CHECK_LACKS_FUNCS(getegid geteuid getgid)
3112 ACE_CHECK_LACKS_FUNCS(getopt)
3113 if test $ac_cv_func_getopt = yes; then
3114 AC_CHECK_DECL([getopt],
3116 [AC_DEFINE([ACE_LACKS_GETOPT_PROTOTYPE], 1,
3117 [Define to 1 if platform lacks the declaration
3119 [#include <stdlib.h>
3120 #ifndef ACE_LACKS_UNISTD_H
3121 # include <unistd.h>
3125 AC_CHECK_FUNC([getpagesize],
3126 [AC_DEFINE([ACE_HAS_GETPAGESIZE])],
3127 [AC_DEFINE([ACE_PAGE_SIZE], [4096])])
3129 ACE_CHECK_LACKS_FUNCS(getpid)
3131 ACE_CHECK_LACKS_FUNCS([getpgid])
3132 if test "$ac_cv_func_getpgid" = yes; then
3133 dnl Check if _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED macros are
3134 dnl needed to make the getpgid() prototype visible.
3135 ACE_CACHE_CHECK([for getpgid prototype],
3136 [ace_cv_lib_has_getpgid_prototype],
3138 ace_save_CPPFLAGS="$CPPFLAGS"
3139 ace_no_xopen="-U_XOPEN_SOURCE -U_XOPEN_SOURCE_EXTENDED"
3140 CPPFLAGS="$CPPFLAGS $ace_no_xopen"
3141 AC_EGREP_HEADER([[^_]+getpgid], [unistd.h],
3143 ace_cv_lib_has_getpgid_prototype=yes
3146 ace_cv_lib_has_getpgid_prototype=no
3148 dnl Reset the compiler flags
3149 CPPFLAGS="$ace_save_CPPFLAGS"
3150 ],, [AC_DEFINE([ACE_LACKS_GETPGID_PROTOTYPE])])
3151 AH_TEMPLATE([ACE_LACKS_GETPGID_PROTOTYPE],
3152 [Define to 1 if platform lacks getpgid() declaration in <unistd.h>.])
3155 ACE_CHECK_LACKS_FUNCS(getppid)
3157 ACE_CHECK_HAS_FUNCS(getprogname)
3159 ACE_CHECK_HAS_FUNCS(getrusage)
3160 if test $ac_cv_func_getrusage = yes; then
3161 AC_CHECK_DECL([getrusage],
3162 [AC_DEFINE([ACE_HAS_GETRUSAGE_PROTOTYPE], 1,
3163 [Define to 1 if platform has the declaration
3166 [#include <sys/resource.h>])
3169 ACE_CHECK_LACKS_FUNCS(getuid)
3171 ACE_CHECK_LACKS_FUNCS(gmtime)
3173 ACE_CHECK_LACKS_FUNCS(gmtime_r)
3175 ACE_CHECK_LACKS_FUNCS(inet_aton)
3177 ACE_CHECK_LACKS_FUNCS(isatty)
3179 AC_CHECK_FUNC(isastream)
3180 if test $ac_cv_func_isastream = yes; then
3181 AC_CHECK_DECL([isastream],
3182 [AC_DEFINE([ACE_HAS_ISASTREAM_PROTOTYPE], 1,
3183 [Define to 1 if platform has the declaration
3186 [#include <stropts.h>])
3189 ACE_CHECK_HAS_FUNCS(itoa)
3191 dnl Check for 64 bit llseek() or lseek64()
3201 ACE_CHECK_LACKS_FUNCS(kill)
3203 ACE_CHECK_LACKS_FUNCS(localtime)
3205 ACE_CHECK_LACKS_FUNCS(log2)
3207 ACE_CHECK_LACKS_FUNCS(lstat)
3209 ACE_CHECK_LACKS_FUNCS(madvise)
3210 if test $ac_cv_func_madvise = yes; then
3211 AC_CHECK_DECL([madvise],
3213 [AC_DEFINE([ACE_LACKS_MADVISE_PROTOTYPE], 1,
3214 [Define to 1 if platform lacks the declaration
3217 #if !defined(ACE_LACKS_SYS_TYPES_H)
3218 # include <sys/types.h>
3220 #include <sys/mman.h>
3224 ACE_CHECK_HAS_FUNCS(mkdir)
3226 if test "$ac_cv_func_mkdir" = yes; then
3227 dnl The mkdir() function has only one argument on Windows and VxWorks
3228 AC_MSG_CHECKING([for 1- or 2-param mkdir])
3229 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3231 #include <sys/stat.h>
3234 const char path[] = "mypath";
3235 int result = mkdir (path);
3238 AC_DEFINE([ACE_MKDIR_LACKS_MODE], 1,
3239 [Define to 1 if platform has 1 parameter mkdir()])
3245 fi dnl test "$ac_cv_func_mkdir" = yes
3247 ACE_CHECK_HAS_FUNCS(memchr)
3249 ACE_CHECK_LACKS_FUNCS(mkfifo)
3251 ACE_CHECK_LACKS_FUNCS(mkstemp)
3252 if test $ac_cv_func_mkstemp = yes; then
3253 AC_CHECK_DECL([mkstemp],
3255 [AC_DEFINE([ACE_LACKS_MKSTEMP_PROTOTYPE], 1,
3256 [Define to 1 if platform lacks the declaration
3258 [#include <stdlib.h>])
3261 ACE_CHECK_LACKS_FUNCS(mktemp)
3262 if test $ac_cv_func_mktemp = yes; then
3263 AC_CHECK_DECL([mktemp],
3265 [AC_DEFINE([ACE_LACKS_MKTEMP_PROTOTYPE], 1,
3266 [Define to 1 if platform lacks the declaration
3268 [#include <stdlib.h>])
3271 ACE_CHECK_LACKS_FUNCS(msync mprotect)
3273 ACE_CHECK_LACKS_FUNCS(pipe)
3275 ACE_CHECK_LACKS_FUNCS(qsort)
3277 ACE_CHECK_LACKS_FUNCS(realpath)
3279 ACE_CHECK_LACKS_FUNCS(setegid seteuid setgid)
3281 ACE_CHECK_LACKS_FUNCS([setpgid])
3282 if test "$ac_cv_func_setpgid" = yes; then
3283 dnl Check if _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED macros are
3284 dnl needed to make the setpgid() prototype visible.
3285 ACE_CACHE_CHECK([for setpgid prototype],
3286 [ace_cv_lib_has_setpgid_prototype],
3288 ace_save_CPPFLAGS="$CPPFLAGS"
3289 ace_no_xopen="-U_XOPEN_SOURCE -U_XOPEN_SOURCE_EXTENDED"
3290 CPPFLAGS="$CPPFLAGS $ace_no_xopen"
3291 AC_EGREP_HEADER([[^_]+setpgid], [unistd.h],
3293 ace_cv_lib_has_setpgid_prototype=yes
3296 ace_cv_lib_has_setpgid_prototype=no
3298 dnl Reset the compiler flags
3299 CPPFLAGS="$ace_save_CPPFLAGS"
3300 ],, [AC_DEFINE([ACE_LACKS_SETPGID_PROTOTYPE])])
3301 AH_TEMPLATE([ACE_LACKS_SETPGID_PROTOTYPE],
3302 [Define to 1 if platform lacks setpgid() declaration in <unistd.h>.])
3305 ACE_CHECK_HAS_FUNCS([setprogname])
3307 ACE_CHECK_LACKS_FUNCS([setregid])
3308 if test "$ac_cv_func_setregid" = yes; then
3309 dnl Check if _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED macros are
3310 dnl needed to make the setregid() prototype visible.
3311 ACE_CACHE_CHECK([for setregid prototype],
3312 [ace_cv_lib_has_setregid_prototype],
3314 ace_save_CPPFLAGS="$CPPFLAGS"
3315 ace_no_xopen="-U_BSD_SOURCE -U_XOPEN_SOURCE -U_XOPEN_SOURCE_EXTENDED"
3316 CPPFLAGS="$CPPFLAGS $ace_no_xopen"
3317 AC_EGREP_HEADER([[^_]+setregid], [unistd.h],
3319 ace_cv_lib_has_setregid_prototype=yes
3322 ace_cv_lib_has_setregid_prototype=no
3324 dnl Reset the compiler flags
3325 CPPFLAGS="$ace_save_CPPFLAGS"
3326 ],, [AC_DEFINE([ACE_LACKS_SETREGID_PROTOTYPE])])
3327 AH_TEMPLATE([ACE_LACKS_SETREGID_PROTOTYPE],
3328 [Define to 1 if platform lacks setregid() declaration in <unistd.h>.])
3331 ACE_CHECK_LACKS_FUNCS([setreuid])
3332 if test "$ac_cv_func_setreuid" = yes; then
3333 dnl Check if _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED macros are
3334 dnl needed to make the setreuid() prototype visible.
3335 ACE_CACHE_CHECK([for setreuid prototype],
3336 [ace_cv_lib_has_setreuid_prototype],
3338 ace_save_CPPFLAGS="$CPPFLAGS"
3339 ace_no_xopen="-U_BSD_SOURCE -U_XOPEN_SOURCE -U_XOPEN_SOURCE_EXTENDED"
3340 CPPFLAGS="$CPPFLAGS $ace_no_xopen"
3341 AC_EGREP_HEADER([[^_]+setreuid], [unistd.h],
3343 ace_cv_lib_has_setreuid_prototype=yes
3346 ace_cv_lib_has_setreuid_prototype=no
3348 dnl Reset the compiler flags
3349 CPPFLAGS="$ace_save_CPPFLAGS"
3350 ],, [AC_DEFINE([ACE_LACKS_SETREUID_PROTOTYPE])])
3351 AH_TEMPLATE([ACE_LACKS_SETREUID_PROTOTYPE],
3352 [Define to 1 if platform lacks setreuid() declaration in <unistd.h>.])
3355 ACE_CHECK_LACKS_FUNCS(setsid setuid)
3357 ACE_CHECK_LACKS_FUNCS(sigaction)
3359 ACE_CHECK_HAS_FUNCS(strnlen)
3360 if test "$ac_cv_func_strnlen" = yes; then
3361 AC_CHECK_DECL([strnlen],
3363 [AC_DEFINE([ACE_LACKS_STRNLEN_PROTOTYPE], 1,
3364 [Define to 1 if platform lacks the declaration
3366 [#include <string.h>])
3369 ACE_CHECK_LACKS_FUNCS(strchr)
3371 # believe it or not, both ACE_LACKS_STRERROR and ACE_HAS_STRERROR
3372 # feature test macros are currently used.
3373 ACE_CHECK_HAS_FUNCS(strerror)
3374 ACE_CHECK_LACKS_FUNCS(strerror)
3376 ACE_CHECK_LACKS_FUNCS(strftime)
3378 ACE_CHECK_LACKS_FUNCS(strpbrk)
3380 ACE_CHECK_LACKS_FUNCS(strrchr)
3382 ACE_CHECK_LACKS_FUNCS(strspn)
3384 ACE_CHECK_LACKS_FUNCS(strtod)
3386 ACE_CHECK_LACKS_FUNCS(strtol)
3388 ACE_CHECK_LACKS_FUNCS(strtoul)
3390 ACE_CHECK_LACKS_FUNCS(strtoull)
3392 # swab() comes in a number of forms:
3393 # swab (const void*, void*, size_t) is POSIX, XPG4, SUS, SUSv2 standard.
3394 # swab (const char*, char*, size_t) is SVID third edition.
3395 # swab (char*, char*, size_t) is on some odd platforms like Windows.
3396 # So, if swab() is available, figure out which of the three variants it is.
3397 # The second and third have ACE config settings.
3398 ACE_CHECK_LACKS_FUNCS([swab],
3406 // If this compiles, we have the POSIX, XPG4, etc. standard.
3407 const char src[2] = {'a', 'b'};
3409 const void *vsrc = src;
3411 swab (vsrc, vdst, 2);
3424 // If this compiles, we have the SVID3 version, else it's the odd,
3426 const char src[2] = {'a', 'b'};
3432 AC_DEFINE([ACE_HAS_CONST_CHAR_SWAB])
3435 AC_DEFINE([ACE_HAS_NONCONST_SWAB])
3441 ACE_CHECK_LACKS_FUNCS(sysconf)
3443 ACE_CHECK_HAS_FUNCS(sysctl)
3445 ACE_CHECK_FUNC_SYSINFO
3447 ACE_CHECK_LACKS_FUNCS(system)
3449 AC_CHECK_FUNC([getmsg],
3451 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3452 #ifndef ACE_LACKS_UNISTD_H
3453 # include <unistd.h>
3454 #endif /* !ACE_LACKS_UNISTD_H */
3456 #ifndef ACE_LACKS_SYS_IOCTL_H
3457 # include <sys/ioctl.h>
3458 #endif /* ACE_LACKS_SYS_IOCTL_H */
3460 #ifdef ACE_HAS_STREAMS
3461 # include <stropts.h>
3462 #endif /* ACE_HAS_STREAMS */
3469 if (pipe (fds) != 0)
3473 * Verify that we can actually set a STREAM option that ACE uses.
3474 * This is particularly necessary for platforms where compiling and
3475 * linking succeed but fail at run-time due to a missing actual
3476 * STREAMS implementation. For example, Linux/glibc requires a
3477 * STREAMS patch/add-on.
3482 if (ioctl (fds[0], I_SRDOPT, (void *) arg) != 0)
3488 AC_DEFINE([ACE_HAS_STREAM_PIPES])
3490 dnl action if cross-compiling
3491 AC_DEFINE([ACE_HAS_STREAM_PIPES])
3495 AC_CHECK_FUNC([gethostbyaddr],,)
3499 dnl Linux Event Poll
3500 ACE_CACHE_CHECK([for epoll_create],
3501 [ace_cv_linux_event_poll],
3505 #include <sys/epoll.h>
3508 int const ACE_NUM_DESCRIPTORS = 10;
3509 return epoll_create (ACE_NUM_DESCRIPTORS) == -1 ? -1 : 0;
3513 ace_cv_linux_event_poll=yes
3516 ace_cv_linux_event_poll=no
3520 AC_DEFINE([ACE_HAS_EVENT_POLL])
3525 dnl Check if /dev/poll character device file exists and is
3526 dnl useable. Just because /dev/poll is present doesn't mean its
3527 dnl useable - this is the case on HP-UX 11. /dev/poll is there, but
3528 dnl getting it to work requires a set of patches.
3531 #include <sys/devpoll.h>
3537 int fd = open ("/dev/poll", O_RDWR);
3539 return fd == -1 ? -1 : 0;
3543 AC_DEFINE([ACE_HAS_DEV_POLL])
3550 AC_CHECK_FUNC([gethrtime])
3551 if test $ac_cv_func_gethrtime = "yes"; then
3552 AC_CHECK_TYPE([hrtime_t],
3553 [AC_DEFINE([ACE_HAS_HI_RES_TIMER], 1,
3554 [Define to 1 if system has SunOS high resolution timer.])],
3556 [#include <sys/time.h>])
3559 AC_CHECK_FUNC([pread],
3560 [AC_CHECK_FUNC([pwrite],
3562 AC_DEFINE([ACE_HAS_P_READ_WRITE])
3563 dnl Check if _XOPEN_SOURCE=500 macro is needed to make the pread() and
3564 dnl pwrite() prototypes visible.
3565 ACE_CACHE_CHECK([for pread prototype],
3566 [ace_cv_lib_has_pread_prototype],
3568 ace_save_CPPFLAGS="$CPPFLAGS"
3569 ace_no_xopen="-U_XOPEN_SOURCE"
3570 CPPFLAGS="$CPPFLAGS $ace_no_xopen"
3571 AC_EGREP_HEADER([[^_]+pread], [unistd.h],
3573 ace_cv_lib_has_pread_prototype=yes
3576 ace_cv_lib_has_pread_prototype=no
3578 dnl Reset the compiler flags
3579 CPPFLAGS="$ace_save_CPPFLAGS"
3580 ],,[AC_DEFINE([ACE_LACKS_PREAD_PROTOTYPE])])
3583 ACE_CHECK_LACKS_FUNCS(readv writev)
3585 ACE_CHECK_HAS_FUNCS(set_t_errno)
3587 ACE_CHECK_HAS_FUNCS(sigsuspend sigtimedwait)
3589 ACE_CHECK_LACKS_FUNCS(socketpair)
3591 AC_CHECK_FUNC(strptime)
3592 if test "$ac_cv_func_strptime" = yes; then
3593 dnl strptime() is available, but its prototype is not always visible to
3594 dnl the compiler. Check if _XOPEN_SOURCE macro is needed to make the
3595 dnl strptime() prototype visible.
3596 ace_save_CPPFLAGS="$CPPFLAGS"
3597 ace_no_xopen="-U_XOPEN_SOURCE"
3598 CPPFLAGS="$CPPFLAGS $ace_no_xopen"
3599 AC_CHECK_DECL([strptime],
3601 [AC_DEFINE([ACE_LACKS_STRPTIME_PROTOTYPE], 1,
3602 [Define to 1 if platform lacks the declaration
3604 [#include <time.h>])
3605 dnl Reset the compiler flags
3606 CPPFLAGS="$ace_save_CPPFLAGS"
3608 AC_DEFINE([ACE_LACKS_STRPTIME], 1,
3609 [Define to 1 if platform lacks strptime().])
3612 if test "$ac_cv_type_wchar_t" = yes; then
3613 AC_CHECK_FUNC([wcslen],
3614 [AC_DEFINE([ACE_HAS_XPG4_MULTIBYTE_CHAR])],)
3617 ACE_CHECK_LACKS_FUNCS(syscall)
3619 AC_CHECK_FUNC([alarm],,)
3620 AC_CHECK_FUNC([signal],,)
3622 if test "$ac_cv_func_alarm" != yes &&
3623 test "$ac_cv_func_signal" != yes; then
3624 AC_DEFINE([ACE_LACKS_UNIX_SIGNALS])
3627 AC_CHECK_FUNC([getrlimit])
3628 AC_CHECK_FUNC([setrlimit])
3629 if test "$ac_cv_func_getrlimit" != yes ||
3630 test "$ac_cv_func_setrlimit" != yes; then
3631 AC_DEFINE([ACE_LACKS_RLIMIT])
3634 ACE_CHECK_LACKS_FUNCS(readlink rename recvmsg sendmsg)
3636 if test "$ac_cv_header_sys_priocntl_h" = yes; then
3637 AC_CHECK_FUNC([priocntl],
3638 [AC_DEFINE([ACE_HAS_PRIOCNTL])],)
3640 dnl Some platforms define priocntl as a macro!
3641 if test "$ac_cv_func_priocntl" = no; then
3642 ACE_CACHE_CHECK([for priocntl macro],
3643 [ace_cv_lib_has_priocntl_macro],
3645 AC_EGREP_CPP([ACE_PRIOCNTL_MACRO],
3647 #include <sys/priocntl.h>
3649 #if defined (priocntl)
3654 ace_cv_lib_has_priocntl_macro=yes
3657 ace_cv_lib_has_priocntl_macro=no
3659 ], [AC_DEFINE([ACE_HAS_PRIOCNTL])],)
3660 fi dnl test "$ac_cv_func_priocntl" = no
3661 fi dnl test "$ac_cv_header_sys_priocntl_h" = yes
3663 dnl FIXME: How do we check for a working sbrk()? Do we need to?
3664 ACE_CHECK_LACKS_FUNCS(sbrk)
3666 ACE_CHECK_HAS_FUNCS(ualarm)
3667 if test $ac_cv_func_ualarm = yes; then
3668 AC_CHECK_DECL([ualarm],
3670 [AC_DEFINE([ACE_LACKS_UALARM_PROTOTYPE], 1,
3671 [Define to 1 if platform lacks the declaration
3673 [#include <unistd.h>])
3676 ACE_CHECK_LACKS_FUNCS(umask)
3678 ACE_CHECK_LACKS_FUNCS(uname)
3680 ACE_CHECK_LACKS_FUNCS(unlink)
3682 ACE_CHECK_HAS_FUNCS(vasprintf vaswprintf vfwprintf vswprintf)
3684 ACE_CHECK_HAS_FUNCS(wcsnlen)
3686 ACE_CHECK_LACKS_FUNCS(fgetws fputws itow towlower towupper wcscat wcschr wcscmp wcscpy wcscspn wcslen wcsncat wcsncmp wcsncpy wcsnicmp wcspbrk wcsrchr wcsspn wcsstr wcstod wcstok wcstol wcstoul wcstoull)
3688 if test "$ac_cv_func_wcstok" = yes; then
3689 dnl The wcstok() function varies with standards. Check which one we have.
3690 AC_MSG_CHECKING([for 2- or 3-param wcstok])
3691 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3696 wchar_t str[] = L"junk";
3697 const wchar_t delim[] = L"\t\n";
3699 wchar_t *p = wcstok (str, delim, &ptr);
3702 AC_DEFINE([ACE_HAS_3_PARAM_WCSTOK], 1,
3703 [Define to 1 if platform has 3 parameter wcstok()])
3709 fi dnl test "$ac_cv_func_wcstok" = yes
3711 dnl Check for SYSV IPC functions
3713 dnl Although Darwin/OS X does not implement any of the SysV IPC API,
3714 dnl its C library contains stubs for all the system calls (probably
3715 dnl left over from the BSD libc). This causes false positives from
3716 dnl AC_CHECK_FUNC which results in configure reporting that SysV IPC
3717 dnl is supported. We avoid this problem by avoiding the function
3718 dnl checks if the cooresponding headers were not detected earlier.
3720 if test "$ac_cv_header_sys_msg_h" = yes; then
3721 AC_CHECK_FUNC([msgctl],,)
3723 AC_CHECK_FUNC([msgget],,)
3725 AC_CHECK_FUNC([msgrcv],,)
3726 fi dnl test "$ac_cv_header_sys_msg_h" = yes
3728 if test "$ac_cv_header_sys_sem_h" = yes; then
3729 AC_CHECK_FUNC([semctl],,)
3731 AC_CHECK_FUNC([semget],,)
3733 AC_CHECK_FUNC([semop],,)
3734 fi dnl test "$ac_cv_header_sys_sem_h" = yes
3736 if test "$ac_cv_header_sys_shm_h" = yes; then
3737 AC_CHECK_FUNC([shmat],,)
3739 AC_CHECK_FUNC([shmctl],,)
3741 AC_CHECK_FUNC([shmdt],,)
3743 AC_CHECK_FUNC([shmget],,)
3744 fi dnl test "$ac_cv_header_sys_shm_h" = yes
3746 dnl End check for SYSV IPC functions
3748 AC_CHECK_FUNC([read_real_time],
3749 [AC_DEFINE([ACE_HAS_AIX_HI_RES_TIMER])],)
3751 dnl See shm_open() test after this one ...
3752 dnl AC_CHECK_FUNC([shm_open], [AC_DEFINE([ACE_HAS_SHM_OPEN])],)
3754 dnl Use a more comprehensive test for shm_open() since the prototype
3755 dnl may not be visible on all platforms without enabling POSIX.1b
3756 dnl support (e.g. when the user defines _POSIX_C_SOURCE > 2).
3757 AC_MSG_CHECKING([for shm_open])
3758 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3760 #ifndef ACE_LACKS_SYS_TYPES_H
3761 # include <sys/types.h>
3764 #include <sys/stat.h>
3765 #include <sys/mman.h>
3768 const char name[] = "Foo";
3769 const int oflag = O_RDONLY;
3770 const mode_t mode = 0400; /* Whatever */
3771 const int fd = shm_open (name, oflag, mode);
3774 AC_DEFINE([ACE_HAS_SHM_OPEN])
3775 AC_MSG_RESULT([yes])
3777 dnl Now see if running it requires a leading slash.
3778 ACE_CACHE_CHECK([if shm_open requires one slash],
3779 [ace_cv_shm_open_requires_one_slash],
3781 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3782 #ifndef ACE_LACKS_SYS_TYPES_H
3783 # include <sys/types.h>
3787 #include <sys/stat.h>
3788 #include <sys/mman.h>
3790 int main (int argc, char *argv[])
3792 const char name[] = "ACE_Foo";
3793 const char name2[] = "/ACE_Foo";
3794 const int oflag = O_RDWR | O_CREAT;
3795 const mode_t mode = 0400; /* Whatever */
3796 int fd = shm_open (name, oflag, mode);
3801 return 1; /* Don't need the slash */
3803 fd = shm_open (name2, oflag, mode);
3810 return 1; /* Nothing worked, so say 'no' */
3813 ace_cv_shm_open_requires_one_slash=yes
3815 ace_cv_shm_open_requires_one_slash=no
3817 dnl action if cross-compiling
3818 ace_cv_shm_open_requires_one_slash=no
3820 ],AC_DEFINE([ACE_SHM_OPEN_REQUIRES_ONE_SLASH]),)
3826 dnl if test "$ace_cv_shm_open_requires_one_slash" = yes; then
3827 dnl AC_DEFINE([ACE_SHM_OPEN_REQUIRES_ONE_SLASH])
3830 ACE_CHECK_HAS_FUNCS(snprintf)
3832 ACE_CHECK_LACKS_FUNCS(tempnam truncate)
3834 dnl Save the cache for debugging purposes
3837 dnl Check for POSIX Semaphore functions
3838 dnl We only check for a few of them since some platforms don't have these.
3839 dnl On some platforms, a separate library is required, so use AC_SEARCH_LIBS
3840 dnl instead of AC_CHECK_FUNC. This will add any needed library to LIBS.
3841 AC_SEARCH_LIBS([sem_init],rt,[ace_cv_func_sem_init=yes],,)
3842 AC_SEARCH_LIBS([sem_destroy],rt,[ace_cv_func_sem_destroy=yes],,)
3844 if test "$ace_cv_func_sem_init" = yes &&
3845 test "$ace_cv_func_sem_destroy" = yes &&
3846 test "$ac_cv_type_sem_t" = yes; then
3848 dnl Only enable POSIX semaphore support if process shared semaphores
3849 dnl are supported. Presumably process shared semaphores are only
3850 dnl available if the _POSIX_THREAD_PROCESS_SHARED macro is defined by
3852 AC_EGREP_CPP([WE_HAVE_SHARED_POSIX_SEMAPHORES],
3858 #ifndef _THREAD_SAFE
3859 #define _THREAD_SAFE
3862 #ifndef ACE_LACKS_UNISTD_H
3863 # include <unistd.h> /* needed for _POSIX_THREAD_PROCESS_SHARED */
3866 #include <pthread.h>
3867 #include <semaphore.h>
3869 #if defined (_POSIX_THREAD_PROCESS_SHARED)
3870 WE_HAVE_SHARED_POSIX_SEMAPHORES
3874 AC_DEFINE([ACE_HAS_POSIX_SEM])
3876 AC_CHECK_FUNC([sem_open])
3877 AC_CHECK_FUNC([sem_close])
3878 AC_CHECK_FUNC([sem_unlink])
3879 if test "$ac_cv_func_sem_open" = no ||
3880 test "$ac_cv_func_sem_close" = no ||
3881 test "$ac_cv_func_sem_unlink" = no; then
3883 AC_DEFINE([ACE_LACKS_NAMED_POSIX_SEM])
3885 dnl Check if it works! For example, in glibc 2.x sem_open exists
3886 dnl but it appears to be a stub. However, it isn't listed as a
3887 dnl stub in <gnu/stubs.h> so the configure script thinks it is
3889 ACE_CACHE_CHECK([if sem_open works],
3890 [ace_cv_sem_open_works],
3892 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3893 #ifndef ACE_LACKS_SYS_TYPES_H
3894 #include <sys/types.h>
3897 #include <sys/stat.h>
3900 #include <stddef.h> /* for definition of "NULL" */
3902 #include <semaphore.h>
3905 # define SEM_FAILED ((sem_t *) -1)
3913 s = sem_open ("ace_semaphore_foo", O_CREAT | O_EXCL, 0600, 1);
3914 if (s == SEM_FAILED)
3915 return -1; /* FAILURE */
3917 sem_unlink ("ace_semaphore_foo");
3918 if (sem_close (s) != 0)
3919 return -1; /* Something went wrong! */
3924 ace_cv_sem_open_works=yes
3926 ace_cv_sem_open_works=no
3928 dnl action if cross-compiling
3929 ace_cv_sem_open_works=yes
3931 ],, [AC_DEFINE([ACE_LACKS_NAMED_POSIX_SEM])])
3935 fi dnl check for POSIX Semaphore functions
3937 dnl If we have POSIX semaphores available, check to see if we also have
3938 dnl the timed wait capability.
3939 if test "$ac_cv_func_sem_open" = yes &&
3940 test "$ac_cv_func_sem_close" = yes &&
3941 test "$ac_cv_func_sem_unlink" = yes; then
3942 dnl Check if sem_timedwait() works - often it compiles and will run
3943 dnl but if called return ENOTSUP. In that case, we don't want it.
3944 ACE_CACHE_CHECK([if sem_timedwait works],
3945 [ace_cv_sem_timedwait_works],
3947 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3948 #ifndef ACE_LACKS_SYS_TYPES_H
3949 #include <sys/types.h>
3952 #include <sys/stat.h>
3955 #include <stddef.h> /* for definition of "NULL" */
3956 #if !defined (ACE_LACKS_ERRNO_H)
3959 #include <semaphore.h>
3962 # define SEM_FAILED ((sem_t *) -1)
3969 struct timespec tmo;
3971 s = sem_open ("ace_semaphore_foo", O_CREAT, 0600, 1);
3972 if (s == SEM_FAILED)
3973 return -1; /* FAILURE */
3975 /* Don't care about the time, only whether the call works */
3978 if (sem_timedwait (s, &tmo) == -1)
3980 if (errno == ENOTSUP)
3986 sem_unlink ("ace_semaphore_foo");
3992 ace_cv_sem_timedwait_works=yes
3994 ace_cv_sem_timedwait_works=no
3996 dnl action if cross-compiling
3997 ace_cv_sem_timedwait_works=yes
4000 [AC_DEFINE([ACE_HAS_POSIX_SEM_TIMEOUT])],)
4004 dnl The following tests are performed only when the user has enabled
4005 dnl support for threads.
4007 dnl NOTE: Make sure the thread library is in "LIBS"
4008 dnl (e.g.: LIBS="$LIBS -lpthread")
4009 dnl otherwise the below thread "CHECK_FUNCs"
4010 dnl will not work correctly.
4011 if test "$ace_user_enable_threads" = yes; then
4013 if test "$ace_has_pthreads" = yes; then
4014 dnl Digital UNIX 4.0 "mangles" the following pthread functions:
4015 dnl pthread_attr_getguardsize_np
4016 dnl pthread_attr_getinheritsched
4017 dnl pthread_attr_getstacksize
4018 dnl pthread_attr_setguardsize_np
4019 dnl pthread_attr_setinheritsched
4020 dnl pthread_attr_setstacksize
4022 dnl pthread_cond_broadcast
4023 dnl pthread_cond_destroy
4024 dnl pthread_cond_init
4025 dnl pthread_cond_sig_preempt_int_np
4026 dnl pthread_cond_signal
4027 dnl pthread_cond_signal_int_np
4028 dnl pthread_cond_timedwait
4029 dnl pthread_cond_wait
4031 dnl pthread_delay_np
4035 dnl pthread_get_expiration_np
4036 dnl pthread_getspecific
4038 dnl pthread_lock_global_np
4039 dnl pthread_mutex_destroy
4040 dnl pthread_mutex_init
4041 dnl pthread_mutex_lock
4042 dnl pthread_mutex_trylock
4043 dnl pthread_mutex_unlock
4046 dnl pthread_setspecific
4047 dnl pthread_testcancel
4048 dnl pthread_unlock_global_np
4049 dnl These functions have a double underscore "__" prepended to maintain
4050 dnl backwards compatibility with Pthread Draft 4 functions of the same
4053 ACE_CHECK_LACKS_FUNCS(pthread_sigmask)
4054 if test $ac_cv_func_pthread_sigmask = yes; then
4055 AC_CHECK_DECL([pthread_sigmask],
4056 [AC_DEFINE([ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE], 1,
4057 [Define to 1 if platform has the declaration
4058 of pthread_sigmask().])],
4060 [#include <pthread.h>
4061 #include <signal.h>])
4064 AC_CHECK_FUNC([pthread_key_create],
4065 [AC_DEFINE([ACE_HAS_THREAD_SPECIFIC_STORAGE])],
4067 AC_CHECK_FUNC([pthread_keycreate],
4068 [AC_DEFINE(ACE_HAS_THREAD_SPECIFIC_STORAGE)],
4069 [AC_DEFINE(ACE_HAS_TSS_EMULATION)])
4072 ACE_CHECK_HAS_FUNCS(pthread_condattr_setkind_np)
4073 ACE_CHECK_HAS_FUNCS(pthread_mutexattr_setkind_np)
4075 dnl Can't use ACE_CHECK_LACKS_FUNCS because the macro doesn't match the
4076 dnl tested function name.
4077 AC_CHECK_FUNC([pthread_condattr_setpshared],
4079 [AC_DEFINE([ACE_LACKS_CONDATTR_PSHARED], 1,
4080 [Define to 1 if system lacks pthread_condattr_setpshared()])])
4082 dnl ACE_CHECK_LACKS_FUNCS(pthread_attr_setstack)
4083 dnl Can't use ACE_CHECK_LACKS_FUNCS because the lower-down AC macros build
4084 dnl a program with a stubbed-out pthread_attr_setstack(), avoiding the need
4085 dnl to see pthread_attr_setstack() in pthreads.h. This is usually not a
4086 dnl problem since the link will fail. However, on HP-UX 11iv2 there is a
4087 dnl pthread_attr_setstack() in libpthread, but not in the header. Thus,
4088 dnl the test passes, but ACE build fails. Don't hack in use of this until
4089 dnl HP sees fit to include it in pthread.h (which it does at 11iv3).
4090 AC_MSG_CHECKING([for pthread_attr_setstack])
4091 AH_TEMPLATE([ACE_LACKS_PTHREAD_ATTR_SETSTACK],
4092 [Define to 1 if platform lacks pthread_attr_setstack()])
4093 AC_LINK_IFELSE([AC_LANG_PROGRAM(
4095 #include <pthread.h>
4098 pthread_attr_t attr;
4101 pthread_attr_setstack (&attr, stack, size);
4104 AC_MSG_RESULT([yes])
4108 AC_DEFINE([ACE_LACKS_PTHREAD_ATTR_SETSTACK])
4111 ACE_CHECK_LACKS_FUNCS(pthread_attr_setstackaddr)
4112 ACE_CHECK_LACKS_FUNCS(pthread_attr_setstacksize)
4114 ACE_CHECK_FUNC([pthread_cancel], [pthread.h],
4116 dnl Make sure the prototype actually exists. Some platforms,
4117 dnl such as FreeBSD 4, appear to have a missing prototype. If
4118 dnl the prototype is missing, then don't use pthread_cancel.
4119 dnl Creating a prototype for it in ACE is probably a bad idea.
4121 ace_save_CPPFLAGS="$CPPFLAGS"
4122 CPPFLAGS="$CPPFLAGS $ACE_THR_CPPFLAGS"
4124 AC_EGREP_HEADER([pthread_cancel], [pthread.h],,
4126 AC_DEFINE([ACE_LACKS_PTHREAD_CANCEL])
4129 dnl Reset the preprocessor flags
4130 CPPFLAGS="$ace_save_CPPFLAGS"
4133 AC_DEFINE([ACE_LACKS_PTHREAD_CANCEL])
4136 ACE_CHECK_LACKS_FUNCS(pthread_yield)
4137 ACE_CHECK_LACKS_FUNCS(pthread_thr_sigsetmask)
4139 AC_CHECK_FUNC([pthread_attr_setdetachstate],
4141 [AC_DEFINE([ACE_LACKS_SETDETACH])])
4143 dnl ACE currently doesn't provide enough fine grained control over
4144 dnl these functions so both must be present in order to prevent
4145 dnl ACE_LACKS_SETSCHED from being defined.
4146 AC_CHECK_FUNC([sched_setscheduler],
4148 AC_CHECK_FUNC([pthread_attr_setschedpolicy],,
4149 [AC_CHECK_FUNC([pthread_attr_setsched],,
4150 [AC_DEFINE([ACE_LACKS_SETSCHED])])])
4153 AC_DEFINE([ACE_LACKS_SETSCHED])
4156 AC_CHECK_FUNC([pthread_attr_setscope],
4158 [AC_DEFINE([ACE_LACKS_THREAD_PROCESS_SCOPING])])
4160 AC_CHECK_FUNC([pthread_mutexattr_setpshared],
4162 [AC_DEFINE([ACE_LACKS_MUTEXATTR_PSHARED], 1,
4163 [Define to 1 if system lacks pthread_mutexattr_setpshared().])])
4165 dnl Check for POSIX Threads Draft 4 functions
4166 AC_CHECK_FUNC([pthread_mutexattr_create],,)
4167 AC_CHECK_FUNC([pthread_mutexattr_delete],,)
4168 AC_CHECK_FUNC([pthread_condattr_delete],,)
4169 AC_CHECK_FUNC([pthread_condattr_create],,)
4170 AC_CHECK_FUNC([pthread_setprio],,)
4171 AC_CHECK_FUNC([pthread_getprio],,)
4172 AC_CHECK_FUNC([pthread_setcancel],,)
4173 AC_CHECK_FUNC([pthread_setasynccancel],,)
4174 AC_CHECK_FUNC([pthread_kill],,)
4175 dnl Check for POSIX Threads Draft 6 functions
4176 AC_CHECK_FUNC([pthread_attr_setprio],,)
4177 AC_CHECK_FUNC([pthread_attr_getprio],,)
4178 AC_CHECK_FUNC([pthread_setintr],,)
4179 AC_CHECK_FUNC([pthread_setintrtype],,)
4180 dnl Check for POSIX threads Draft 6, 7 and Standard common functions
4181 AC_CHECK_FUNC([pthread_mutexattr_init],,)
4182 AC_CHECK_FUNC([pthread_mutexattr_destroy],,)
4183 AC_CHECK_FUNC([pthread_condattr_init],,)
4184 AC_CHECK_FUNC([pthread_condattr_destroy],,)
4185 dnl Check for POSIX Threads Draft 7 and Draft Standard common functions
4186 AC_CHECK_FUNC([pthread_setschedparam],,)
4187 AC_CHECK_FUNC([pthread_getschedparam],,)
4188 AC_CHECK_FUNC([pthread_setcancelstate],,)
4189 AC_CHECK_FUNC([pthread_setcanceltype],,)
4190 dnl Check for POSIX Threads Draft Standard functions
4191 dnl sched_yield() is in the C library or perhaps in "-lposix4."
4192 dnl We need to add other library checks in this script's "check libraries"
4193 dnl section if it is in another library.
4194 dnl AC_CHECK_FUNC(sched_yield,,)
4195 dnl We already check for this during the library checks.
4197 dnl Check for Unix98 pthreads extensions
4198 AC_CHECK_TYPE([pthread_rwlock_t],
4202 #ifndef ACE_LACKS_SYS_TYPES_H
4203 #include <sys/types.h>
4205 #include <pthread.h>])
4207 AC_CHECK_TYPE([pthread_rwlockattr_t],
4211 #ifndef ACE_LACKS_SYS_TYPES_H
4212 #include <sys/types.h>
4214 #include <pthread.h>])
4216 ACE_CHECK_HAS_FUNCS(pthread_continue pthread_continue_np pthread_resume_np pthread_suspend pthread_suspend_np)
4217 ACE_CHECK_HAS_FUNCS(pthread_getconcurrency pthread_setconcurrency)
4218 ACE_CHECK_HAS_FUNCS(pthread_attr_setcreatesuspend_np)
4220 dnl Don't test for pthread_getaffinity_np() or pthread_setaffinity_np()
4221 dnl if the system doesn't also have cpu_set_t. The functions are almost
4222 dnl certainly incompatible with our wrapper facade, as we use a "dummy"
4223 dnl cpu_set_t defined in ace/os_include/os_sched.h.
4224 if test "$ac_cv_type_cpu_set_t" = yes; then
4225 ACE_CHECK_HAS_FUNCS(pthread_getaffinity_np pthread_setaffinity_np)
4228 dnl Linux's sched_{set,get}affinity interface has changed three times:
4230 dnl In glibc 2.3.2, it was:
4232 dnl int sched_setaffinity(pid_t __pid,
4233 dnl unsigned int __len, unsigned long * __mask);
4235 dnl In glibc 2.3.3, it was changed to:
4237 dnl int sched_setaffinity(pid_t __pid, const cpu_set_t* __mask);
4239 dnl And in glibc ?.?.?, it was changed again to:
4241 dnl int sched_setaffinity(pid_t __pid, size_t __cpusetsize,
4242 dnl const cpu_set_t* __cpuset);
4244 dnl The following feature tests attempt to determine which (if any)
4245 dnl version is supported by the system. A further complication is
4246 dnl that the C library may support one version, the kernel may not,
4249 dnl As of this writing, ACE's ACE_OS::sched_setaffinity() wrapper
4250 dnl facade implementation only supports the latter two varients. So
4251 dnl if the system doesn't define cpu_set_t, we simply avoid checking
4252 dnl for sched_setaffinity(). No attempt is made to verify C library /
4253 dnl kernel consistency.
4255 dnl The "right" thing to do is to implement something similar to the
4256 dnl PLPA (Portable Linux Processor Affinity) Library, converting the
4257 dnl arguments and invoking the syscall directly (instead of calling
4258 dnl the C library wrapper).
4261 if test "$ac_cv_type_cpu_set_t" = yes; then
4263 ACE_CHECK_HAS_FUNCS(sched_getaffinity)
4264 if test "$ac_cv_func_sched_getaffinity" = yes; then
4265 dnl The sched_getaffinity() function varies between linux versions
4266 dnl Check which one we have.
4267 AC_MSG_CHECKING([for 2- or 3-param sched_getaffinity])
4268 AC_LINK_IFELSE([AC_LANG_PROGRAM(
4270 #if !defined(ACE_LACKS_SYS_TYPES_H)
4271 #include <sys/types.h>
4273 #if !defined(ACE_LACKS_SCHED_H)
4280 sched_getaffinity(pid, sizeof(cpuset), &cpuset);
4287 AC_DEFINE([ACE_HAS_2_PARAM_SCHED_GETAFFINITY], 1,
4288 [Define to 1 if platform has 2 parameter sched_getaffinity()])
4290 fi dnl test "$ac_cv_func_sched_getaffinity" = yes
4292 ACE_CHECK_HAS_FUNCS(sched_setaffinity)
4293 if test "$ac_cv_func_sched_setaffinity" = yes; then
4294 dnl The sched_setaffinity() function varies between linux versions
4295 dnl Check which one we have.
4296 AC_MSG_CHECKING([for 2- or 3-param sched_setaffinity])
4297 AC_LINK_IFELSE([AC_LANG_PROGRAM(
4299 #if !defined(ACE_LACKS_SYS_TYPES_H)
4300 #include <sys/types.h>
4302 #if !defined(ACE_LACKS_SCHED_H)
4309 sched_setaffinity(pid, sizeof(cpuset), &cpuset);
4316 AC_DEFINE([ACE_HAS_2_PARAM_SCHED_SETAFFINITY], 1,
4317 [Define to 1 if platform has 2 parameter sched_setaffinity()])
4319 fi dnl test "$ac_cv_func_sched_setaffinity" = yes
4321 fi dnl test "$ac_cv_type_cpu_set_t" = yes
4323 AC_CHECK_FUNC([pthread_rwlock_init],,)
4324 AC_CHECK_FUNC([pthread_rwlock_destroy],,)
4325 AC_CHECK_FUNC([pthread_rwlock_rdlock],,)
4326 AC_CHECK_FUNC([pthread_rwlock_wrlock],,)
4327 AC_CHECK_FUNC([pthread_rwlock_unlock],,)
4328 AC_CHECK_FUNC([pthread_rwlock_tryrdlock],,)
4329 AC_CHECK_FUNC([pthread_rwlock_trywrlock],,)
4330 AC_CHECK_FUNC([pthread_rwlockattr_init],,)
4331 AC_CHECK_FUNC([pthread_rwlockattr_destroy],,)
4332 AC_CHECK_FUNC([pthread_rwlockattr_setpshared],
4334 [AC_DEFINE([ACE_LACKS_RWLOCKATTR_PSHARED], 1,
4335 [Define to 1 if system lacks pthread_rwlockattr_setpshared().])])
4337 if test "$ac_cv_type_pthread_rwlock_t" = yes &&
4338 test "$ac_cv_type_pthread_rwlockattr_t" = yes &&
4339 test "$ac_cv_func_pthread_rwlock_init" = yes &&
4340 test "$ac_cv_func_pthread_rwlock_destroy" = yes &&
4341 test "$ac_cv_func_pthread_rwlock_rdlock" = yes &&
4342 test "$ac_cv_func_pthread_rwlock_wrlock" = yes &&
4343 test "$ac_cv_func_pthread_rwlock_unlock" = yes &&
4344 test "$ac_cv_func_pthread_rwlock_tryrdlock" = yes &&
4345 test "$ac_cv_func_pthread_rwlock_trywrlock" = yes &&
4346 test "$ac_cv_func_pthread_rwlockattr_init" = yes &&
4347 test "$ac_cv_func_pthread_rwlockattr_destroy" = yes; then
4348 AC_DEFINE([ACE_HAS_PTHREADS_UNIX98_EXT])
4349 fi dnl Unix98 pthreads extensions
4351 dnl Check if platform has thread_self() rather than pthread_self()
4352 ACE_CHECK_FUNC([pthread_self], [pthread.h],
4355 AC_CHECK_FUNC([thread_self],
4357 AC_DEFINE([ACE_HAS_THREAD_SELF])
4361 dnl Check if pthread.h declares an enum with PTHREAD_PROCESS_PRIVATE and
4362 dnl PTHREAD_PROCESS_SHARED values.
4363 ACE_CACHE_CHECK([for PTHREAD_PROCESS_* enumeration in pthread.h],
4364 [ace_cv_lib_pthread_process_enum],
4366 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4367 #include <pthread.h>
4369 /* Undefine PTHREAD_PROCESS_SHARED in case some platforms #define it */
4370 #undef PTHREAD_PROCESS_SHARED
4371 int foo = PTHREAD_PROCESS_SHARED;
4373 ace_cv_lib_pthread_process_enum=yes
4375 ace_cv_lib_pthread_process_enum=no
4379 AC_DEFINE([ACE_HAS_PTHREAD_PROCESS_ENUM])
4382 dnl Check if pthread_create requires an extern "C" start routine
4383 ACE_CONVERT_WARNINGS_TO_ERRORS(
4385 ACE_CACHE_CHECK([if pthread_create requires an extern "C" start routine],
4386 [ace_cv_lib_pthread_c_func],[
4387 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4388 #include <pthread.h>
4390 void *ace_start_routine(void *);
4392 pthread_create(0, 0, ace_start_routine, 0);
4394 ace_cv_lib_pthread_c_func=no
4396 dnl Check if extern "C" start routine is required.
4397 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
4399 #include <pthread.h>
4401 extern "C" void *ace_start_routine(void *);
4404 pthread_create(0, 0, ace_start_routine, 0);
4407 ace_cv_lib_pthread_c_func=yes
4410 ace_cv_lib_pthread_c_func=no
4415 AC_DEFINE([ACE_HAS_THR_C_FUNC])
4417 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
4419 dnl Check if pthread_key_create has a standard arg thread destructor
4420 ACE_CACHE_CHECK([if pthread_key_create has std arg thread destructor],
4421 [ace_cv_lib_pthread_stdarg_dest],[
4422 if test "$ac_cv_func_pthread_key_create" = yes; then
4423 ace_pthread_key_create=pthread_key_create
4425 ace_pthread_key_create=pthread_keycreate
4427 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4428 #include <pthread.h>
4430 void ace_destructor(void *);
4432 ${ace_pthread_key_create}(0, ace_destructor);
4434 ace_cv_lib_pthread_stdarg_dest=no
4436 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
4438 #include <pthread.h>
4440 void ace_destructor(...);
4443 ${ace_pthread_key_create}(0, ace_destructor);
4446 ace_cv_lib_pthread_stdarg_dest=yes
4449 ace_cv_lib_pthread_stdarg_dest=no
4454 AC_DEFINE([ACE_HAS_STDARG_THR_DEST])
4457 dnl Check if pthread_key_create requires an extern "C" start routine
4458 ACE_CONVERT_WARNINGS_TO_ERRORS([
4459 ACE_CACHE_CHECK([if pthread_key_create requires an extern "C" start routine],
4460 [ace_cv_lib_pthread_c_dest],[
4461 if test "$ac_cv_func_pthread_key_create" = yes; then
4462 ace_pthread_key_create=pthread_key_create
4464 ace_pthread_key_create=pthread_keycreate
4466 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4467 #include <pthread.h>
4469 void ace_destructor(void *);
4471 ${ace_pthread_key_create}(0, ace_destructor);
4473 ace_cv_lib_pthread_c_dest=no
4475 dnl Check if extern "C" start routine is required.
4476 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
4478 #include <pthread.h>
4480 extern "C" void ace_destructor(void *);
4483 ${ace_pthread_key_create}(0, ace_destructor);
4486 ace_cv_lib_pthread_c_dest=yes
4489 ace_cv_lib_pthread_c_dest=no
4494 AC_DEFINE([ACE_HAS_THR_C_DEST])
4496 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
4499 AC_CHECK_FUNC([sched_get_priority_min],,
4501 dnl Check if the PTHREAD_MIN_PRIORITY constant exists.
4502 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4503 #include <pthread.h>
4505 int p = (int) PTHREAD_MIN_PRIORITY;
4509 dnl Since we have PTHREAD_MIN_PRIORITY, denote that PX_PRIO_MIN
4510 dnl should not be used.
4511 ace_has_px_prio_min=no
4514 dnl PTHREAD_MIN_PRIORITY doesn't appear to be defined, so
4515 dnl check if the platform defines PX_PRIO_MIN, instead.
4517 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4518 #include <pthread.h>
4520 int p = (int) PX_PRIO_MIN;
4523 ace_has_px_prio_min=yes
4526 ace_has_px_prio_min=no
4531 if test "$ace_has_px_prio_min" = yes; then
4532 AC_DEFINE([PTHREAD_MIN_PRIORITY],
4534 [Minimum thread priority])
4537 AC_CHECK_FUNC([sched_get_priority_max],,
4539 dnl Check if the PTHREAD_MAX_PRIORITY constant exists.
4540 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4541 #include <pthread.h>
4543 int p = (int) PTHREAD_MAX_PRIORITY;
4547 dnl Since we have PTHREAD_MAX_PRIORITY, denote that PX_PRIO_MAX
4548 dnl should not be used.
4549 ace_has_px_prio_max=no
4552 dnl PTHREAD_MAX_PRIORITY doesn't appear to be defined, so
4553 dnl check if the platform defines PX_PRIO_MAX, instead.
4555 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4556 #include <pthread.h>
4558 int p = (int) PX_PRIO_MAX;
4561 ace_has_px_prio_max=yes
4564 ace_has_px_prio_max=no
4569 if test "$ace_has_px_prio_max" = yes; then
4570 AC_DEFINE([PTHREAD_MAX_PRIORITY],
4572 [Maximum thread priority])
4575 fi dnl test "$ace_has_pthreads" = yes
4577 if test "$ace_has_sthreads" = yes; then
4578 dnl Only check for these functions if we have the UNIX International
4579 dnl Threads library "thread."
4580 AC_CHECK_FUNC([thr_keycreate],
4581 [AC_DEFINE([ACE_HAS_THREAD_SPECIFIC_STORAGE])],
4582 [AC_DEFINE([ACE_HAS_TSS_EMULATION])])
4584 AC_CHECK_FUNC([thr_yield],
4585 [AC_DEFINE([ACE_HAS_THR_YIELD])],)
4587 AC_CHECK_FUNC([thr_keydelete],
4588 [AC_DEFINE([ACE_HAS_THR_KEYDELETE])],)
4590 AC_CHECK_FUNC([thr_min_stack],[],
4592 AC_CHECK_FUNC([thr_minstack],
4593 [AC_DEFINE([ACE_HAS_THR_MINSTACK])],)
4596 fi dnl test "$ace_has_sthreads" = yes
4598 fi dnl test "$ace_user_enable_threads" = yes
4602 dnl ACE will define a sigwait function if we lie and say we don't have
4603 dnl one. Unfortunately, the ACE function may conflict with our
4604 dnl function, so we'll go ahead and turn this on, even if we are
4605 dnl ignoring threads.
4606 ACE_CHECK_HAS_FUNCS(sigwait)
4609 dnl Check for reentrant functions
4610 if test "$ace_user_enable_reentrant_funcs" = yes; then
4611 AC_CHECK_FUNC([rand_r])
4613 AC_CHECK_FUNC([strtok_r],
4615 dnl Check if _POSIX_SOURCE macro is needed to make the strtok_r()
4616 dnl prototype visible.
4617 ACE_CACHE_CHECK([for strtok_r prototype],
4618 [ace_cv_lib_has_strtok_r_prototype],
4620 ace_save_CPPFLAGS="$CPPFLAGS"
4621 ace_no_posix="-U_POSIX_SOURCE $ACE_THR_CPPFLAGS"
4622 CPPFLAGS="$CPPFLAGS $ace_no_posix"
4623 AC_EGREP_HEADER([[^_]+strtok_r], [string.h],
4625 ace_cv_lib_has_strtok_r_prototype=yes
4628 ace_cv_lib_has_strtok_r_prototype=no
4630 dnl Reset the preprocessor flags
4631 CPPFLAGS="$ace_save_CPPFLAGS"
4632 ],, [AC_DEFINE([ACE_LACKS_STRTOK_R_PROTOTYPE])])
4635 AC_CHECK_FUNC([getpwnam_r],
4637 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4641 #ifndef ACE_LACKS_PWD_H
4644 #ifndef ACE_LACKS_SYS_TYPES_H
4645 # include <sys/types.h>
4650 struct passwd * pwent;
4653 struct passwd * result;
4655 int status = getpwnam_r (name, pwent, buffer, buflen, &result);
4658 if test "$ace_user_enable_reentrant_funcs" = yes; then
4659 AC_DEFINE([ACE_HAS_POSIX_GETPWNAM_R])
4663 echo "Nothing to do";
4666 [AC_DEFINE([ACE_LACKS_PWD_REENTRANT_FUNCTIONS])])
4668 AC_CHECK_FUNC([ctime_r],,)
4670 AC_CHECK_FUNC([localtime_r],,)
4672 AC_CHECK_FUNC([gmtime_r],,)
4674 AC_CHECK_FUNC([asctime_r],,)
4676 AC_CHECK_FUNC([getprotobyname_r],,)
4678 AC_CHECK_FUNC([getprotobynumber_r],,)
4680 AC_CHECK_FUNC([gethostbyaddr_r],,)
4682 AC_CHECK_FUNC([gethostbyname_r],,)
4684 AC_CHECK_FUNC([getservbyname_r],,)
4685 fi dnl End checks for reentrant functions
4688 ACE_CHECK_LACKS_FUNCS(readdir_r)
4689 if test "$ac_cv_func_readdir_r" = yes; then
4690 dnl The readdir_r() function varies with standards. Check which one we have.
4691 AC_MSG_CHECKING([for 2- or 3-param readdir_r])
4692 AC_LINK_IFELSE([AC_LANG_PROGRAM(
4700 AC_DEFINE([ACE_HAS_3_PARAM_READDIR_R], 1,
4701 [Define to 1 if platform has 3 parameter readdir_r()])
4707 fi dnl test "$ac_cv_func_readdir" = yes
4710 dnl Disabled until we figure out what to do with the comparator
4711 dnl function argument inconsistencies between different platforms.
4713 dnl int comparator (const void * d1, const void * d2)
4715 dnl int comparator (const dirent ** d1, const dirent ** d2)
4717 dnl ACE_CHECK_HAS_FUNCS([scandir])
4719 ACE_CHECK_LACKS_FUNCS(seekdir telldir)
4723 dnl SECTION 11: checks for function characteristics
4726 ACE_CONVERT_WARNINGS_TO_ERRORS([
4727 dnl Check if dlopen takes a char * arg instead of const char *
4728 if test "$ace_has_svr4_dynamic_linking" = yes; then
4729 ACE_CACHE_CHECK([if dlopen takes a char *],
4730 [ace_cv_lib_charptr_dl],
4732 dnl Check if it takes a const char *, first.
4733 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4736 const char *filename = 0;
4738 void *ptr = dlopen(filename, flag);
4740 ace_cv_lib_charptr_dl=no
4742 dnl Now check if it takes a non-const char *.
4743 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
4750 void *ptr = dlopen(filename, flag);
4753 ace_cv_lib_charptr_dl=yes
4756 ace_cv_lib_charptr_dl=no
4759 ], [AC_DEFINE([ACE_HAS_CHARPTR_DL])],)
4760 fi dnl test "$ace_has_svr4_dynamic_linking" = yes
4761 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
4763 ACE_CONVERT_WARNINGS_TO_ERRORS([
4764 dnl Check if "getby" functions use a non-const char * argument
4765 if test "$ac_cv_func_gethostbyaddr" = yes; then
4766 ACE_CACHE_CHECK(["getby" functions take a non-const char *],
4767 [ace_cv_lib_nonconst_getby],
4769 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4770 #include <sys/socket.h>
4775 struct hostent *mystruct = 0;
4777 mystruct = gethostbyaddr(name, len, type);
4779 ace_cv_lib_nonconst_getby=yes
4781 ace_cv_lib_nonconst_getby=no
4783 ], [AC_DEFINE([ACE_HAS_NONCONST_GETBY])],)
4784 fi dnl test "$ac_cv_func_gethostbyaddr" = yes
4785 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
4787 dnl Check if new throws exception upon failure
4788 if test "$ace_user_enable_exceptions" = yes; then
4789 ACE_CACHE_CHECK([if new throws std::bad_alloc exception on failure],
4790 [ace_cv_new_throws_bad_alloc_exception],
4792 AC_RUN_IFELSE([AC_LANG_SOURCE([[
4793 #if defined (ACE_HAS_NEW_NO_H)
4795 #elif defined (ACE_HAS_NEW_H)
4799 #if defined (ACE_HAS_STDEXCEPT_NO_H)
4800 # include <stdexcept>
4801 #elif defined (ACE_HAS_EXCEPTION_H)
4802 # include <exception.h>
4805 /* We already checked for ACE_LACKS_NUMERIC_LIMITS */
4806 #if !defined ACE_LACKS_NUMERIC_LIMITS
4810 /* We already checked for ACE_LACKS_SYS_RESOURCE_H */
4811 #if !defined ACE_LACKS_SYS_RESOURCE_H
4812 #include <sys/resource.h>
4815 int main(int, char *[]) {
4816 #if defined ACE_LACKS_NUMERIC_LIMITS
4817 const size_t ALLOC_SIZE = 2 * 1024 * 1024 * 1024;
4819 const size_t ALLOC_SIZE = std::numeric_limits<size_t>::max () / 2;
4822 #if !defined (ACE_LACKS_RLIMIT)
4823 /* set memory limit to the allocation size, so this test
4824 should terminate on the first iteration. */
4825 struct rlimit rlimit;
4826 if (getrlimit(RLIMIT_DATA, &rlimit) == 0) {
4827 rlimit.rlim_cur = ALLOC_SIZE;
4828 setrlimit(RLIMIT_DATA, &rlimit);
4834 char *a = new char[ALLOC_SIZE];
4836 return 1; /* new() does NOT throw exceptions */
4840 #ifdef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB
4841 catch (std::bad_alloc)
4844 #endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
4846 return 0; /* new() does throw exceptions */
4850 return 1; /* ERROR: We shouldn't get this far! */
4853 ace_cv_new_throws_bad_alloc_exception=yes
4855 ace_cv_new_throws_bad_alloc_exception=no
4857 ace_cv_new_throws_bad_alloc_exception=no
4859 ], [AC_DEFINE([ACE_NEW_THROWS_EXCEPTIONS])],)
4861 if test "$ace_cv_new_throws_bad_alloc_exception" != yes; then
4862 ACE_CACHE_CHECK([if new throws xalloc exception on failure],
4863 [ace_cv_new_throws_xalloc_exception],
4865 AC_RUN_IFELSE([AC_LANG_SOURCE([[
4866 #if defined (ACE_HAS_NEW_NO_H)
4868 #elif defined (ACE_HAS_NEW_H)
4872 #if defined (ACE_HAS_STDEXCEPT_NO_H)
4873 # include <stdexcept>
4874 #elif defined (ACE_HAS_EXCEPTION_H)
4875 # include <exception.h>
4878 /* We already checked for ACE_LACKS_NUMERIC_LIMITS */
4879 #if !defined ACE_LACKS_NUMERIC_LIMITS
4883 /* We already checked for ACE_LACKS_SYS_RESOURCE_H */
4884 #if !defined ACE_LACKS_SYS_RESOURCE_H
4885 #include <sys/resource.h>
4889 int main(int, char *[]) {
4890 #if defined ACE_LACKS_NUMERIC_LIMITS
4891 const size_t ALLOC_SIZE = 2 * 1024 * 1024 * 1024;
4893 const size_t ALLOC_SIZE = std::numeric_limits<size_t>::max () / 2;
4896 #if !defined (ACE_LACKS_RLIMIT)
4897 /* set memory limit to the allocation size, so this test
4898 should terminate on the first iteration. */
4899 struct rlimit rlimit;
4900 if (getrlimit(RLIMIT_DATA, &rlimit) == 0) {
4901 rlimit.rlim_cur = ALLOC_SIZE;
4902 setrlimit(RLIMIT_DATA, &rlimit);
4908 char *a = new char[ALLOC_SIZE];
4910 return 1; /* new() does NOT throw exceptions */
4916 return 0; /* new() does throw exceptions */
4920 return 1; /* ERROR: We shouldn't get this far! */
4923 ace_cv_new_throws_xalloc_exception=yes
4925 ace_cv_new_throws_xalloc_exception=no
4927 ace_cv_new_throws_xalloc_exception=no
4929 ], [AC_DEFINE([ACE_NEW_THROWS_EXCEPTIONS])],)
4930 fi dnl ace_cv_new_throws_bad_alloc_exceptions = no
4931 fi dnl $ace_user_enable_exceptions = yes
4933 AC_CACHE_CHECK([if compiler supports new(std::nothrow)],
4934 [ace_cv_has_new_nothrow],
4935 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4936 #if defined (ACE_HAS_NEW_NO_H)
4938 #elif defined (ACE_HAS_NEW_H)
4942 int main(int, char*[]) {
4945 #ifdef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB
4946 foo = new (std::nothrow) int;
4948 foo = new (nothrow) int;
4949 #endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
4951 ace_cv_has_new_nothrow=yes
4953 ace_cv_has_new_nothrow=no
4955 if test $ace_cv_has_new_nothrow = yes; then
4956 AC_DEFINE([ACE_HAS_NEW_NOTHROW])
4959 ACE_CONVERT_WARNINGS_TO_ERRORS([
4960 dnl Check if putmsg takes a const struct strbuf *
4961 dnl If we have getmsg() we can be pretty sure that we have putmsg()
4962 if test "$ac_cv_func_getmsg" = yes ||
4963 test "$ac_cv_header_stropts_h" = yes; then
4964 ACE_CACHE_CHECK([if putmsg takes a const struct strbuf*],
4965 [ace_cv_lib_const_strbufptr],
4967 dnl Check if it takes a const struct strbuf *, first.
4968 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4969 #include <stropts.h>
4973 const struct strbuf * ace_str = 0;
4976 result = putmsg(fd, ace_str, ace_str, flags);
4978 ace_cv_lib_const_strbufptr=yes
4980 ace_cv_lib_const_strbufptr=no
4982 ],, [AC_DEFINE([ACE_LACKS_CONST_STRBUF_PTR])])
4983 fi dnl "$ac_cv_func_getmsg" = yes || "$ac_cv_header_stropts_h" = yes
4984 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
4986 dnl Check if setrlimit() takes an enum as 1st argument
4987 ACE_CHECK_SETRLIMIT_ENUM
4989 dnl This test fails (i.e. passes when it shouldn't) when compiling with
4990 dnl GCC/G++ since the compiler treats passing a const to a non-const
4991 dnl argument as a warning and not as an error since the const is
4992 dnl simply discarded. To correct this problem, we use "-Werror" which
4993 dnl converts all warnings to errors, whenever we are compiling with
4997 dnl Check if getrusage() takes an enum as 1st argument
4998 ACE_CHECK_GETRUSAGE_ENUM
5000 dnl TODO: This doesn't work.
5001 dnl The compiler in linux just issues a warning, and the test passes!!!
5003 dnl FIXED by adding "-Werror" to compiler flags when using GNU C++
5005 ACE_CONVERT_WARNINGS_TO_ERRORS(
5007 dnl Check if select takes a const fifth argument (timeval)
5008 ACE_CACHE_CHECK([if select takes a const struct timeval],
5009 [ace_cv_lib_posix_select_const_timeval],[
5010 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5011 #ifndef ACE_LACKS_SYS_TYPES_H
5012 # include <sys/types.h>
5014 #include <sys/time.h>
5015 #ifndef ACE_LACKS_UNISTD_H
5016 # include <unistd.h>
5018 #ifndef ACE_LACKS_SYS_SELECT_H
5019 # include <sys/select.h>
5023 fd_set *readfds = 0;
5024 fd_set *writefds = 0;
5025 fd_set *exceptfds = 0;
5026 const struct timeval* timeout = 0;
5027 select(n, readfds, writefds, exceptfds, timeout);
5029 ace_cv_lib_posix_select_const_timeval=yes
5031 ace_cv_lib_posix_select_const_timeval=no
5033 ], , [AC_DEFINE([ACE_HAS_NONCONST_SELECT_TIMEVAL])])
5034 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5037 dnl Only run the following tests if the msghdr structure exists.
5038 if test "$ace_cv_struct_msghdr" = yes &&
5039 test "$ac_cv_func_sendmsg" = yes; then
5040 ACE_CONVERT_WARNINGS_TO_ERRORS(
5042 dnl Check if sendmsg takes a const 2nd argument
5043 ACE_CACHE_CHECK([if sendmsg omits const qualifier from the msghdr argument],
5044 [ace_cv_lib_nonconst_sendmsg],[
5045 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5046 #ifndef ACE_LACKS_SYS_TYPES_H
5047 # include <sys/types.h>
5049 #include <sys/socket.h>
5052 const struct msghdr *msg = 0;
5053 unsigned int flags = 0;
5057 result = (int) sendmsg(s, msg, flags);
5059 ace_cv_lib_nonconst_sendmsg=no
5061 ace_cv_lib_nonconst_sendmsg=yes
5063 ], [AC_DEFINE([ACE_HAS_NONCONST_SENDMSG])],)
5064 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5065 fi dnl "$ace_cv_struct_msghdr" = yes && $ac_cv_func_sendmsg = yes
5068 dnl Only run the following tests if the setrlimit function exists
5069 if test "$ac_cv_func_setrlimit" = yes; then
5070 ACE_CONVERT_WARNINGS_TO_ERRORS(
5072 dnl Check if setrlimit() takes a const pointer as 2nd argument
5073 ACE_CACHE_CHECK([if setrlimit omits const qualifier from the rlimit argument],
5074 [ace_cv_lib_nonconst_setrlimit],[
5075 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5076 #include <sys/time.h>
5077 #include <sys/resource.h>
5079 const struct rlimit* rlp = 0;
5080 setrlimit(RLIMIT_CPU, rlp);
5082 ace_cv_lib_nonconst_setrlimit=no
5084 ace_cv_lib_nonconst_setrlimit=yes
5086 ], [AC_DEFINE([ACE_HAS_NONCONST_SETRLIMIT])])
5087 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5088 fi dnl "$ac_cv_func_setrlimit" = yes; then
5091 dnl Only run the following tests if the readv function exists
5092 if test "$ac_cv_header_sys_uio_h" = yes &&
5093 test "$ac_cv_func_readv" = yes; then
5094 ACE_CONVERT_WARNINGS_TO_ERRORS(
5096 dnl Check if readv omits the const from the iovec argument
5097 ACE_CACHE_CHECK([if readv omits const qualifier from the iovec argument],
5098 [ace_cv_lib_nonconst_readv],[
5099 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5100 #ifndef ACE_LACKS_UNISTD_H
5101 # include <unistd.h>
5104 #include <sys/uio.h>
5107 const struct iovec *vector = 0;
5112 result = (int) readv(filedes, vector, count);
5114 ace_cv_lib_nonconst_readv=no
5116 ace_cv_lib_nonconst_readv=yes
5118 ], [AC_DEFINE([ACE_HAS_NONCONST_READV])],)
5119 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5120 fi dnl $ac_cv_header_sys_uio_h = yes && $ac_cv_func_writev = yes
5123 dnl Only run the following tests if the writev function exists
5124 if test "$ac_cv_header_sys_uio_h" = yes &&
5125 test "$ac_cv_func_writev" = yes; then
5126 ACE_CONVERT_WARNINGS_TO_ERRORS(
5128 dnl Check if writev omits the const from the iovec argument
5129 ACE_CACHE_CHECK([if writev omits const qualifier from the iovec argument],
5130 [ace_cv_lib_nonconst_writev],[
5131 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5132 #ifndef ACE_LACKS_UNISTD_H
5133 # include <unistd.h>
5136 #include <sys/uio.h>
5139 const struct iovec *vector = 0;
5144 result = (int) writev(filedes, vector, count);
5146 ace_cv_lib_nonconst_writev=no
5148 ace_cv_lib_nonconst_writev=yes
5150 ], [AC_DEFINE([ACE_HAS_NONCONST_WRITEV])],)
5151 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5152 fi dnl $ac_cv_header_sys_uio_h = yes && $ac_cv_func_writev = yes
5155 ACE_CONVERT_WARNINGS_TO_ERRORS(
5157 ACE_CACHE_CHECK([for (struct sockaddr *) msg_name field in msghdr],
5158 [ace_cv_lib_sockaddr_msg_name],[
5159 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5160 #ifndef ACE_LACKS_SYS_TYPES_H
5161 # include <sys/types.h>
5163 #include <sys/socket.h>
5166 struct sockaddr *addr = 0;
5169 * Note that some platforms declare msg_name to be a void*,
5170 * in which case this assignment will work.
5171 * Should we _not_ define ACE_HAS_SOCKADDR_MSG_NAME in that
5172 * case? I tend to think it is more appropriate to define
5173 * ACE_HAS_SOCKADDR_MSG_NAME rather than cast addr to a char*,
5174 * as is done in ACE when the macro is not defined.
5177 ace_msghdr.msg_name = (struct sockaddr *)addr;
5179 ace_cv_lib_sockaddr_msg_name=yes
5181 ace_cv_lib_sockaddr_msg_name=no
5183 ], [AC_DEFINE([ACE_HAS_SOCKADDR_MSG_NAME])],)
5184 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5187 ACE_CONVERT_WARNINGS_TO_ERRORS(
5189 ACE_CACHE_CHECK([if setsockopt() takes a void* fourth argument],
5190 [ace_cv_lib_posix_setsockopt_voidp_4],
5192 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5193 #ifndef ACE_LACKS_SYS_TYPES_H
5194 # include <sys/types.h>
5196 #include <sys/socket.h>
5203 #if defined (ACE_HAS_SOCKLEN_T)
5204 socklen_t optlen = 0;
5205 #elif defined (ACE_HAS_SIZET_SOCKET_LEN)
5211 setsockopt (s, level, optname, optval, optlen);
5213 ace_cv_lib_posix_setsockopt_voidp_4=yes
5215 ace_cv_lib_posix_setsockopt_voidp_4=no
5219 AC_DEFINE([ACE_HAS_VOIDPTR_SOCKOPT])
5222 ACE_CACHE_CHECK([if setsockopt() takes a char* fourth argument],
5223 [ace_cv_lib_posix_setsockopt_charp_4],
5225 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5226 #ifndef ACE_LACKS_SYS_TYPES_H
5227 # include <sys/types.h>
5229 #include <sys/socket.h>
5236 #if defined (ACE_HAS_SOCKLEN_T)
5237 socklen_t optlen = 0;
5238 #elif defined (ACE_HAS_SIZET_SOCKET_LEN)
5244 setsockopt (s, level, optname, optval, optlen);
5246 ace_cv_lib_posix_setsockopt_charp_4=yes
5248 ace_cv_lib_posix_setsockopt_charp_4=no
5252 AC_DEFINE([ACE_HAS_CHARPTR_SOCKOPT])
5255 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5257 ACE_CONVERT_WARNINGS_TO_ERRORS(
5259 ACE_CACHE_CHECK([if mmap() takes a void* first argument],
5260 [ace_cv_lib_posix_voidptr_mmap],[
5261 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5262 #ifndef ACE_LACKS_SYS_TYPES_H
5263 # include <sys/types.h>
5265 #ifndef ACE_LACKS_UNISTD_H
5266 # include <unistd.h>
5268 #include <sys/mman.h>
5279 result = (void *)mmap(start, length, prot, flags, fd, offset);
5281 ace_cv_lib_posix_voidptr_mmap=yes
5283 ace_cv_lib_posix_voidptr_mmap=no
5285 ], [AC_DEFINE([ACE_HAS_VOIDPTR_MMAP])],)
5286 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5288 dnl Check if platform has iostream method ipfx()
5289 ACE_CACHE_CHECK([for iostream method ipfx()],
5290 [ace_cv_feature_has_iostream_ipfx],[
5291 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5292 #include <iostream.h>
5296 ace_cv_feature_has_iostream_ipfx=yes
5298 ace_cv_feature_has_iostream_ipfx=no
5300 ], , [AC_DEFINE([ACE_LACKS_IOSTREAM_FX])])
5302 dnl Check if platform has line-buffered streambufs
5303 ACE_CACHE_CHECK([for line-buffered streambufs],
5304 [ace_cv_feature_has_linebuffered_streambuf],[
5305 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5306 #include <iostream.h>
5308 cin.rdbuf()->linebuffered(1);
5310 ace_cv_feature_has_linebuffered_streambuf=yes
5312 ace_cv_feature_has_linebuffered_streambuf=no
5314 ], , [AC_DEFINE([ACE_LACKS_LINEBUFFERED_STREAMBUF])])
5316 dnl Check if platform has unbuffered streambufs
5317 ACE_CACHE_CHECK([for unbuffered streambufs],
5318 [ace_cv_feature_has_unbuffered_streambuf],[
5319 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5320 #include <iostream.h>
5322 cin.rdbuf()->unbuffered(1);
5324 ace_cv_feature_has_unbuffered_streambuf=yes
5326 ace_cv_feature_has_unbuffered_streambuf=no
5328 ], , [AC_DEFINE([ACE_LACKS_UNBUFFERED_STREAMBUF])])
5331 dnl Check if signal takes a void (*)(int) as second argument
5332 ACE_CONVERT_WARNINGS_TO_ERRORS(
5334 ACE_CACHE_CHECK([if signal takes a void (*)(int) as second argument],
5335 [ace_cv_lib_signal_vi1_2],[
5336 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5338 typedef void (*SA)(int);
5339 static void handler(int) { }
5344 ace_cv_lib_signal_vi1_2=yes
5346 dnl Check if extern "C" signal handler is required.
5347 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5352 typedef void (*SA)(int);
5353 void handler(int) { }
5361 ace_cv_lib_signal_vi1_2=yes
5364 ace_cv_lib_signal_vi1_2=no
5369 AC_DEFINE([ACE_HAS_SIG_C_FUNC])
5371 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5373 dnl Check if signal takes a void (*)(void) as second argument
5374 ACE_CONVERT_WARNINGS_TO_ERRORS(
5376 ACE_CACHE_CHECK([if signal takes a void (*)(void) as second argument],
5377 [ace_cv_lib_signal_vv1_2],[
5378 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5380 typedef void (*SA)(void);
5381 void handler(void) { }
5386 ace_cv_lib_signal_vv1_2=yes
5388 dnl Check if extern "C" signal handler is required.
5389 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5394 typedef void (*SA)(void);
5395 void handler(void) { }
5403 ace_cv_lib_signal_vv1_2=yes
5406 ace_cv_lib_signal_vv1_2=no
5411 AC_DEFINE([ACE_HAS_SIG_C_FUNC])
5413 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5415 dnl Check if signal takes a void (*)(int, ...) as second argument
5416 ACE_CONVERT_WARNINGS_TO_ERRORS(
5418 ACE_CACHE_CHECK([if signal takes a void (*)(int, ...) as second argument],
5419 [ace_cv_lib_signal_vi1a2_2],[
5420 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5422 typedef void (*SA)(int, ...);
5423 void handler(int, ...) { }
5428 ace_cv_lib_signal_vi1a2_2=yes
5430 dnl Check if extern "C" signal handler is required.
5431 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5436 typedef void (*SA)(int, ...);
5437 void handler(int, ...) { }
5445 ace_cv_lib_signal_vi1a2_2=yes
5448 ace_cv_lib_signal_vi1a2_2=no
5453 AC_DEFINE([ACE_HAS_SIG_C_FUNC])
5455 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5457 dnl Check if signal takes a void (*)(...) as second argument
5458 ACE_CONVERT_WARNINGS_TO_ERRORS(
5460 ACE_CACHE_CHECK([if signal takes a void (*)(...) as second argument],
5461 [ace_cv_lib_signal_va1_2],[
5462 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5464 typedef void (*SA)(...);
5465 void handler(...) { }
5470 ace_cv_lib_signal_va1_2=yes
5472 dnl Check if extern "C" signal handler is required.
5473 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
5478 typedef void (*SA)(...);
5479 void handler(...) { }
5487 ace_cv_lib_signal_va1_2=yes
5490 ace_cv_lib_signal_va1_2=no
5495 AC_DEFINE([ACE_HAS_SIG_C_FUNC])
5497 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5499 dnl Check if signal returns a void (*)(int)
5500 AC_CACHE_CHECK([if signal returns a void (*)(int)],
5501 [ace_cv_lib_signal_vi1_ret],[
5502 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5505 typedef void (*SA)(int);
5509 nn = signal(SIGINT, 0);
5512 ace_cv_lib_signal_vi1_ret=yes
5514 ace_cv_lib_signal_vi1_ret=no
5518 dnl Check if signal returns a void (*)(void)
5519 AC_CACHE_CHECK([if signal returns a void (*)(void)],
5520 [ace_cv_lib_signal_vv1_ret],[
5521 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5524 typedef void (*SA)(void);
5528 nn = signal(SIGINT, 0);
5531 ace_cv_lib_signal_vv1_ret=yes
5533 ace_cv_lib_signal_vv1_ret=no
5537 dnl Check if signal returns a void (*)(int, ...)
5538 AC_CACHE_CHECK([if signal returns a void (*)(int, ...)],
5539 [ace_cv_lib_signal_vi1a2_ret],[
5540 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5543 typedef void (*SA)(int, ...);
5545 SA oo = signal(SIGINT, 0);
5547 ace_cv_lib_signal_vi1a2_ret=yes
5549 ace_cv_lib_signal_vi1a2_ret=no
5553 dnl Check if signal returns a void (*)(...)
5554 AC_CACHE_CHECK([if signal returns a void (*)(...)],
5555 [ace_cv_lib_signal_va1_ret],[
5556 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5559 typedef void (*SA)(...);
5561 SA oo = signal(SIGINT, 0);
5563 ace_cv_lib_signal_va1_ret=yes
5565 ace_cv_lib_signal_va1_ret=no
5569 if test "$ac_cv_type_struct_sigaction" = yes; then
5570 dnl Check if struct sigaction takes a void (*)(int) handler
5571 AC_CACHE_CHECK([if struct sigaction takes a void (*)(int) handler],
5572 [ace_cv_lib_struct_sigaction_vi1_handler],[
5573 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5575 typedef void (*SA)(int);
5576 void foo(struct sigaction* sa, SA nn) { }
5578 struct sigaction sa;
5583 ace_cv_lib_struct_sigaction_vi1_handler=yes
5585 ace_cv_lib_struct_sigaction_vi1_handler=no
5589 dnl Check if struct sigaction takes a void (*)(void) handler
5590 AC_CACHE_CHECK([if struct sigaction takes a void (*)(void) handler],
5591 [ace_cv_lib_struct_sigaction_vv1_handler],[
5592 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5594 typedef void (*SA)(void);
5595 void foo(struct sigaction* sa, SA nn) { }
5597 struct sigaction sa;
5602 ace_cv_lib_struct_sigaction_vv1_handler=yes
5604 ace_cv_lib_struct_sigaction_vv1_handler=no
5608 dnl Check if struct sigaction takes a void (*)(int, ...) handler
5609 AC_CACHE_CHECK([if struct sigaction takes a void (*)(int, ...) handler],
5610 [ace_cv_lib_struct_sigaction_vi1a2_handler],[
5611 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5613 typedef void (*SA)(int, ...);
5614 void foo(struct sigaction* sa, SA nn) { }
5616 struct sigaction sa;
5621 ace_cv_lib_struct_sigaction_vi1a2_handler=yes
5623 ace_cv_lib_struct_sigaction_vi1a2_handler=no
5627 dnl Check if struct sigaction takes a void (*)(...) handler
5628 AC_CACHE_CHECK([if struct sigaction takes a void (*)(...) handler],
5629 [ace_cv_lib_struct_sigaction_va1_handler],[
5630 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5632 typedef void (*SA)(...);
5633 void foo(struct sigaction* sa, SA nn) { }
5635 struct sigaction sa;
5640 ace_cv_lib_struct_sigaction_va1_handler=yes
5642 ace_cv_lib_struct_sigaction_va1_handler=no
5645 fi dnl test "$ac_cv_type_struct_sigaction" = yes
5647 dnl TODO: This doesn't work.
5648 dnl The linux compiler issues a warning regarding the invalid void*
5651 dnl FIXED by adding "-Werror" to compiler flags when using GNU C++
5653 ACE_CONVERT_WARNINGS_TO_ERRORS(
5655 dnl Check if msgsnd() takes a struct msgbuf* second argument
5656 ACE_CACHE_CHECK([if msgsnd() takes a struct msgbuf* second argument],
5657 [ace_cv_lib_posix_msgsnd_msgbufp_2],[
5658 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5659 #ifndef ACE_LACKS_SYS_TYPES_H
5660 # include <sys/types.h>
5662 # include <sys/ipc.h>
5663 #ifndef ACE_LACKS_SYS_MSG_H
5664 # include <sys/msg.h>
5668 struct msgbuf* msgp = 0;
5671 msgsnd(msqid, msgp, msgsz, msgflg);
5673 ace_cv_lib_posix_msgsnd_msgbufp_2=yes
5675 ace_cv_lib_posix_msgsnd_msgbufp_2=no
5679 dnl "ACTIONS-IF-SUCCESSFUL" handled later in configure.in
5682 dnl Check if msgsnd() takes a const void* second argument
5683 ACE_CACHE_CHECK([if msgsnd() takes a const void* second argument],
5684 [ace_cv_lib_posix_msgsnd_cvoidp_2],[
5685 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5686 #ifndef ACE_LACKS_SYS_TYPES_H
5687 # include <sys/types.h>
5689 # include <sys/ipc.h>
5690 #ifndef ACE_LACKS_SYS_MSG_H
5691 # include <sys/msg.h>
5695 const void* msgp = 0;
5698 msgsnd(msqid, msgp, msgsz, msgflg);
5700 ace_cv_lib_posix_msgsnd_cvoidp_2=yes
5702 ace_cv_lib_posix_msgsnd_cvoidp_2=no
5706 dnl Do nothing if msgsnd takes a const void* second argument
5709 dnl If we get this far we presumably have a non-const void* second param
5710 AC_DEFINE([ACE_HAS_NONCONST_MSGSND])
5713 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5715 dnl TODO: This doesn't work.
5716 dnl The linux compiler issues a warning regarding the invalid void*
5719 dnl FIXED by adding "-Werror" to compiler flags when using GNU C++
5721 ACE_CONVERT_WARNINGS_TO_ERRORS(
5723 dnl Check if msgrcv() takes a void* second argument
5724 AC_CACHE_CHECK([if msgrcv() takes a void* second argument],
5725 [ace_cv_lib_posix_msgrcv_voidp_2],[
5726 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5727 #ifndef ACE_LACKS_SYS_TYPES_H
5728 # include <sys/types.h>
5730 # include <sys/ipc.h>
5731 #ifndef ACE_LACKS_SYS_MSG_H
5732 # include <sys/msg.h>
5740 msgrcv(msqid, msgp, msgsz, msgtyp, msgflg);
5742 ace_cv_lib_posix_msgrcv_voidp_2=yes
5744 ace_cv_lib_posix_msgrcv_voidp_2=no
5747 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5750 if test "$ac_cv_func_shmat" = yes; then
5751 dnl TODO: This doesn't work.
5752 dnl The linux compiler issues a warning regarding the invalid void*
5755 dnl FIXED by adding "-Werror" to compiler flags when using GNU C++
5757 ACE_CONVERT_WARNINGS_TO_ERRORS(
5759 dnl Check if shmat() takes a void* second argument
5760 AC_CACHE_CHECK([if shmat() takes a void* second argument],
5761 [ace_cv_lib_posix_shmat_voidp_2],[
5762 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5763 #ifndef ACE_LACKS_SYS_TYPES_H
5764 # include <sys/types.h>
5766 # include <sys/ipc.h>
5767 # include <sys/shm.h>
5772 shmat(shmid, shmaddr, shmflg);
5774 ace_cv_lib_posix_shmat_voidp_2=yes
5776 ace_cv_lib_posix_shmat_voidp_2=no
5779 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5780 if test "$ace_cv_lib_posix_shmat_voidp_2" = no; then
5781 AC_DEFINE([ACE_HAS_CHARPTR_SHMAT], 1,
5782 [Define to 1 if arg 2 of 'shmat' is char *'])
5786 if test "$ac_cv_func_shmdt" = yes; then
5787 dnl TODO: This doesn't work.
5788 dnl The linux compiler issues a warning regarding the invalid void*
5791 dnl FIXED by adding "-Werror" to compiler flags when using GNU C++
5793 ACE_CONVERT_WARNINGS_TO_ERRORS(
5795 dnl Check if shmdt() takes a void* second argument
5796 AC_CACHE_CHECK([if shmdt() takes a void* argument],
5797 [ace_cv_lib_posix_shmdt_voidp],[
5798 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5799 #ifndef ACE_LACKS_SYS_TYPES_H
5800 # include <sys/types.h>
5802 # include <sys/ipc.h>
5803 # include <sys/shm.h>
5808 ace_cv_lib_posix_shmdt_voidp=yes
5810 ace_cv_lib_posix_shmdt_voidp=no
5813 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5814 if test "$ace_cv_lib_posix_shmdt_voidp" = no; then
5815 AC_DEFINE([ACE_HAS_CHARPTR_SHMDT], 1,
5816 [Define to 1 if arg 1 of 'shmdt' is char *'])
5820 dnl TODO: This doesn't work.
5821 dnl The linux compiler issues a warning regarding the invalid void*
5824 dnl FIXED by adding "-Werror" to compiler flags when using GNU C++
5826 ACE_CONVERT_WARNINGS_TO_ERRORS(
5828 dnl Check if sigaction() takes a const* second argument
5829 AC_CACHE_CHECK([if sigaction() takes a const* second argument],
5830 [ace_cv_lib_posix_sigaction_constp_2],[
5831 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5835 const struct sigaction* act = 0;
5836 struct sigaction* oldact = 0;
5837 sigaction(signum, act, oldact);
5839 ace_cv_lib_posix_sigaction_constp_2=yes
5841 ace_cv_lib_posix_sigaction_constp_2=no
5844 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5846 if test "$ace_cv_lib_posix_sigaction_constp_2" = yes; then
5847 AC_DEFINE([ACE_HAS_SIGACTION_CONSTP2])
5850 dnl We need to use the ACE_CONVERT_WARNINGS_TO_ERRORS() macro since
5851 dnl passing a void * just caused implicit conversion warnings when
5852 dnl using GNU C++, for example.
5853 ACE_CONVERT_WARNINGS_TO_ERRORS(
5855 dnl Check for SVR4 style gettimeofday()
5856 AC_CACHE_CHECK([if gettimeofday() takes a void * second argument],
5857 [ace_cv_lib_voidptr_gettimeofday],
5859 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5860 #include <sys/time.h>
5861 #ifndef ACE_LACKS_UNISTD_H
5862 # include <unistd.h>
5865 struct timeval *tv = 0;
5868 gettimeofday(tv, tzp);
5870 ace_cv_lib_voidptr_gettimeofday=yes
5872 ace_cv_lib_voidptr_gettimeofday=no
5875 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5877 if test "$ace_cv_lib_voidptr_gettimeofday" = no; then
5878 ACE_CONVERT_WARNINGS_TO_ERRORS(
5880 dnl Check for old OSF1 style gettimeofday()
5881 AC_CACHE_CHECK([if gettimeofday() takes a struct timezone * second argument],
5882 [ace_cv_lib_timezone_gettimeofday],
5884 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5885 #include <sys/time.h>
5886 #ifndef ACE_LACKS_UNISTD_H
5887 # include <unistd.h>
5890 struct timeval *tv = 0;
5891 struct timezone *tzp = 0;
5893 gettimeofday(tv, tzp);
5895 ace_cv_lib_timezone_gettimeofday=yes
5897 ace_cv_lib_timezone_gettimeofday=no
5900 ]) dnl ACE_CONVERT_WARNINGS_TO_ERRORS
5901 fi dnl test "$ace_cv_lib_voidptr_gettimeofday" = no
5903 dnl Check for gettimeofday() protoype
5904 if test "$ace_cv_lib_voidptr_gettimeofday" = yes ||
5905 test "$ace_cv_lib_timezone_gettimeofday" = yes; then
5907 AC_CHECK_DECL([gettimeofday],
5909 if test "$ace_cv_lib_voidptr_gettimeofday" = yes; then
5910 AC_DEFINE([ACE_HAS_VOIDPTR_GETTIMEOFDAY])
5912 AC_DEFINE([ACE_HAS_TIMEZONE_GETTIMEOFDAY])
5915 if test "$ace_cv_lib_voidptr_gettimeofday" = yes; then
5916 AC_DEFINE([ACE_HAS_SVR4_GETTIMEOFDAY])
5918 AC_DEFINE([ACE_HAS_OSF1_GETTIMEOFDAY])
5922 #include <sys/time.h>
5923 #ifndef ACE_LACKS_UNISTD_H
5924 # include <unistd.h>
5928 fi dnl Check for gettimeofday() protoype
5931 dnl Check if ctime_r() takes two arguments
5932 if test "$ac_cv_func_ctime_r" = yes; then
5933 ACE_CACHE_CHECK([if ctime_r() takes two arguments],
5934 [ace_cv_lib_posix_ctime_r_2_params],
5936 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5943 const time_t *t = 0;
5947 ace_cv_lib_posix_ctime_r_2_params=yes
5949 ace_cv_lib_posix_ctime_r_2_params=no
5951 ], [AC_DEFINE([ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R])],)
5952 fi dnl test "$ac_cv_func_ctime_r" = yes
5956 dnl SECTION 12: checks for type characteristics
5959 dnl struct msghdr stuff
5960 dnl Only run the following tests if the msghdr structure exists.
5961 if test "$ace_cv_struct_msghdr" = yes; then
5963 ACE_CACHE_CHECK([if struct msghdr has a msg_accrights member],
5964 [ace_cv_lib_posix_struct_msghdr_has_msg_accrights],[
5965 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5966 #ifndef ACE_LACKS_SYS_TYPES_H
5967 # include <sys/types.h>
5969 #include <sys/socket.h>
5972 mh.msg_accrights = 0;
5974 ace_cv_lib_posix_struct_msghdr_has_msg_accrights=yes
5976 ace_cv_lib_posix_struct_msghdr_has_msg_accrights=no
5980 ACE_CACHE_CHECK([if struct msghdr has a msg_accrightslen member],
5981 [ace_cv_lib_posix_struct_msghdr_has_msg_accrightslen],[
5982 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5983 #ifndef ACE_LACKS_SYS_TYPES_H
5984 # include <sys/types.h>
5986 #include <sys/socket.h>
5989 mh.msg_accrightslen = 0;
5991 ace_cv_lib_posix_struct_msghdr_has_msg_accrightslen=yes
5993 ace_cv_lib_posix_struct_msghdr_has_msg_accrightslen=no
5997 dnl Check for 4.4 BSD style struct msghdr members
5998 dnl The following test should only be run if the above two testsfail.
5999 if test "$ace_cv_lib_posix_struct_msghdr_has_msg_accrights" = no &&
6000 test "$ace_cv_lib_posix_struct_msghdr_has_msg_accrightslen" = no; then
6001 AC_DEFINE([ACE_LACKS_MSG_ACCRIGHTS])
6002 ACE_CACHE_CHECK([for 4.4 BSD style struct msghdr],
6003 [ace_cv_lib_4_4bsd_msghdr],[
6004 AC_EGREP_HEADER([msg_control], [sys/socket.h],
6006 ace_cv_lib_4_4bsd_msghdr=yes
6009 ace_cv_lib_4_4bsd_msghdr=no
6013 AC_DEFINE([ACE_HAS_4_4BSD_SENDMSG_RECVMSG])
6016 AC_MSG_WARN([No supported msghdr structure was found. ACE may not compile or function properly.])
6020 fi dnl End struct msghdr_stuff
6023 dnl SECTION 13: checks for system services
6026 dnl Check if platform defines ctime() as a macro
6027 ACE_CACHE_CHECK([for ctime() macro],
6028 [ace_cv_feature_have_ctime_macro],
6030 AC_EGREP_CPP([ACE_CTIME_MACRO],
6039 ace_cv_feature_have_ctime_macro=yes
6042 ace_cv_feature_have_ctime_macro=no
6044 ], [AC_DEFINE([ACE_HAS_BROKEN_CTIME])],)
6046 dnl Check if platform defines ctime_r, asctime_r, rand_r or getpwnam_r
6048 ACE_CACHE_CHECK([for reentrant function macros],
6049 [ace_cv_feature_has_broken_r_routines],
6051 AC_EGREP_CPP([ACE_R_MACROS],
6059 #if !defined (ACE_LACKS_PWD_H)
6063 #if defined (ctime_r) || \
6064 defined (asctime_r) || \
6065 defined (rand_r) || \
6066 defined (getpwnam_r)
6071 ace_cv_feature_has_broken_r_routines=yes
6074 ace_cv_feature_has_broken_r_routines=no
6076 ], [AC_DEFINE([ACE_HAS_BROKEN_R_ROUTINES])],)
6078 dnl Check if platform defines sig{empty,fill,add,del}set as macros
6079 ACE_CACHE_CHECK([for sig{empty fill add del}set macros],
6080 [ace_cv_feature_have_sig_macros],
6082 AC_EGREP_CPP([ACE_SIG_MACROS],
6084 #ifndef ACE_LACKS_SYS_TYPES_H
6085 # include <sys/types.h>
6089 #if defined (sigemptyset) || \
6090 defined (sigfillset) || \
6091 defined (sigaddset) || \
6092 defined (sigdelset) || \
6093 defined (sigismember)
6098 ace_cv_feature_have_sig_macros=yes
6101 ace_cv_feature_have_sig_macros=no
6103 ], [AC_DEFINE([ACE_HAS_SIG_MACROS])],)
6105 dnl Check for open() mode masks
6106 ACE_CACHE_CHECK([for open() mode masks],
6107 [ace_cv_feature_have_open_mode_masks],[
6108 AC_EGREP_CPP([ACE_OPEN_MODE_MASKS_EXIST],
6110 #ifndef ACE_LACKS_SYS_TYPES_H
6111 # include <sys/types.h>
6113 #include <sys/stat.h>
6116 /* These are ORed so that ACE will not redefine any of them if any of
6118 #if defined (S_IRWXU) || \
6119 defined (S_IRUSR) || \
6120 defined (S_IWUSR) || \
6121 defined (S_IXUSR) || \
6122 defined (S_IRWXG) || \
6123 defined (S_IRGRP) || \
6124 defined (S_IWGRP) || \
6125 defined (S_IXGRP) || \
6126 defined (S_IRWXO) || \
6127 defined (S_IROTH) || \
6128 defined (S_IWOTH) || \
6130 ACE_OPEN_MODE_MASKS_EXIST
6134 ace_cv_feature_have_open_mode_masks=yes
6137 ace_cv_feature_have_open_mode_masks=no
6139 ], , [AC_DEFINE([ACE_LACKS_MODE_MASKS])])
6142 dnl Check if platform supports POSIX O_NONBLOCK semantics
6143 ACE_CACHE_CHECK([for POSIX O_NONBLOCK semantics],
6144 [ace_cv_feature_posix_o_nonblock],[
6145 AC_EGREP_CPP([ACE_POSIX_O_NONBLOCK],
6147 #ifndef ACE_LACKS_SYS_TYPES_H
6148 # include <sys/types.h>
6150 #include <sys/stat.h>
6153 #if defined (O_NONBLOCK)
6154 ACE_POSIX_O_NONBLOCK
6158 ace_cv_feature_posix_o_nonblock=yes
6161 ace_cv_feature_posix_o_nonblock=no
6163 ], [AC_DEFINE([ACE_HAS_POSIX_NONBLOCK])],)
6165 dnl Check for MAP_FAILED constant
6166 ACE_CACHE_CHECK([for MAP_FAILED constant],
6167 [ace_cv_lib_have_map_failed],[
6168 dnl We need the square brackets around "ACEMAPFAILED.+[0-9]" to
6169 dnl prevent the character class "[0-9]" from becoming "0-9" due to
6171 AC_EGREP_CPP([ACEMAPFAILED.+[0-9]],
6173 #include <sys/mman.h>
6174 ACEMAPFAILED MAP_FAILED
6177 ace_cv_lib_have_map_failed=yes
6180 ace_cv_lib_have_map_failed=no
6184 dnl Check if platform defines MAP_FAILED as a long constant
6185 ACE_CACHE_CHECK([if MAP_FAILED is a long constant],
6186 [ace_cv_feature_long_map_failed],[
6187 dnl We need the square brackets around "ACEMAPFAILED.+[0-9]L" to
6188 dnl prevent the character class "[0-9]" from becoming "0-9" due to
6190 AC_EGREP_CPP([ACEMAPFAILED.+[0-9]L],
6192 #include <sys/mman.h>
6193 ACEMAPFAILED MAP_FAILED
6196 ace_cv_feature_long_map_failed=yes
6199 ace_cv_feature_long_map_failed=no
6201 ], [AC_DEFINE([ACE_HAS_LONG_MAP_FAILED])],
6203 dnl Check if MAP_FAILED is _not_ cast to void *
6204 ACE_CACHE_CHECK([if MAP_FAILED is not cast to void *],
6205 [ace_cv_have_broken_map_failed],[
6206 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6207 #include <sys/mman.h>
6209 void * foo = MAP_FAILED;
6211 ace_cv_have_broken_map_failed=no
6213 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
6215 #include <sys/mman.h>
6218 void * foo = (void *) MAP_FAILED;
6221 ace_cv_have_broken_map_failed=yes
6224 dnl If we get here then we have no idea what is wrong!
6225 ace_cv_have_broken_map_failed=no
6228 ], [AC_DEFINE([ACE_HAS_BROKEN_MAP_FAILED])],)
6232 dnl Check if platform supports TCP_NODELAY support
6233 ACE_CACHE_CHECK([for TCP_NODELAY support],
6234 [ace_cv_feature_tcp_nodelay],[
6235 AC_EGREP_CPP([ACE_TCPNODELAY],
6237 #ifndef ACE_LACKS_SYS_TYPES_H
6238 # include <sys/types.h>
6240 #include <netinet/tcp.h>
6242 #if defined (TCP_NODELAY)
6247 ace_cv_feature_tcp_nodelay=yes
6250 ace_cv_feature_tcp_nodelay=no
6252 ], , [AC_DEFINE([ACE_LACKS_TCP_NODELAY])])
6254 dnl Check if platform supports SO_SNDBUF/SO_RCVBUF socket options
6255 ACE_CACHE_CHECK([for SO_SNDBUF/SO_RCVBUF socket options],
6256 [ace_cv_feature_so_sndbuf_rcvbuf],[
6257 AC_EGREP_CPP([ACE_SO_BUF],
6259 #ifndef ACE_LACKS_SYS_TYPES_H
6260 # include <sys/types.h>
6262 #include <sys/socket.h>
6264 #if defined (SO_SNDBUF) && \
6270 ace_cv_feature_so_sndbuf_rcvbuf=yes
6273 ace_cv_feature_so_sndbuf_rcvbuf=no
6275 ], , [AC_DEFINE([ACE_LACKS_SOCKET_BUFSIZ])])
6277 dnl Check if memcpy is faster or loop unrolling is faster on a given
6279 ACE_CACHE_CHECK([if ACE memcpy needs loop unrolling], [ace_cv_memcpy_loop_unroll],
6280 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
6284 smemcpy (void* dest, const void* src, const size_t n)
6286 unsigned char* to = static_cast<unsigned char*>( dest) ;
6287 const unsigned char* from = static_cast<const unsigned char*>( src) ;
6288 // Unroll the loop...
6291 case 16: to[15] = from[15] ;
6292 case 15: to[14] = from[14] ;
6293 case 14: to[13] = from[13] ;
6294 case 13: to[12] = from[12] ;
6295 case 12: to[11] = from[11] ;
6296 case 11: to[10] = from[10] ;
6297 case 10: to[9] = from[9] ;
6298 case 9: to[8] = from[8] ;
6299 case 8: to[7] = from[7] ;
6300 case 7: to[6] = from[6] ;
6301 case 6: to[5] = from[5] ;
6302 case 5: to[4] = from[4] ;
6303 case 4: to[3] = from[3] ;
6304 case 3: to[2] = from[2] ;
6305 case 2: to[1] = from[1] ;
6306 case 1: to[0] = from[0] ;
6307 case 0: return dest;
6308 default: return memcpy (dest, src, n);
6313 void* (* test_func) (void *dst, const void* src, size_t);
6315 namespace { enum { ITERATIONS = 100000 }; }
6317 #include <sys/time.h>
6321 main(int argc, char* argv[])
6323 struct timeval start, now;
6328 const void* src = " THIS IS A TEST";
6330 // We want to test if the loop unrolling is faster for sizes
6332 for (size_t counter = 16; counter >=1; counter--)
6334 test_func = smemcpy;
6337 for (int i = ITERATIONS ; i > 0 ; --i)
6338 test_func ((void *)dest, src, counter);
6340 gettimeofday (&start, 0) ;
6341 for (int j = ITERATIONS ; j > 0 ; --j)
6342 test_func ((void *)dest, src, counter);
6343 gettimeofday (&now, 0);
6345 double fast = 1000000 * (now.tv_sec - start.tv_sec) +
6346 now.tv_usec - start.tv_usec ;
6351 for (int k = ITERATIONS ; k > 0 ; --k)
6352 test_func ((void *)dest, src, counter);
6354 gettimeofday (&start, 0) ;
6355 for (int l = ITERATIONS ; l > 0 ; --l)
6356 test_func ((void *)dest, src, counter);
6357 gettimeofday (&now, 0) ;
6359 double slow = 1000000 * (now.tv_sec-start.tv_sec) +
6360 now.tv_usec - start.tv_usec ;
6362 return 1; // Unrolling was slower than actual memcpy
6364 if (1.10*fast > slow)
6365 return 1; // Unrolling was not faster by 10%
6367 return 0; // Unrolling was faster -- success
6368 }]])], [ace_cv_memcpy_loop_unroll=yes],
6369 [ace_cv_memcpy_loop_unroll=no],
6370 dnl Cross compilation case
6371 [ace_cv_memcpy_loop_unroll=no])],
6372 dnl only if the test succeeds set the macro
6373 [AC_DEFINE([ACE_HAS_MEMCPY_LOOP_UNROLL], 1,
6374 [Define to 1 if unrolled ACE_OS::fast_memcpy() is faster than system memcpy()])],)
6376 dnl TODO: We only check for ACE_HAS_AUTOMATIC_INIT_FINI on platforms that
6377 dnl have SVR4 dynamic linking since ACE doesn't support it otherwise.
6378 if test "$ac_cv_header_dlfcn_h" = yes &&
6379 test "$ace_has_svr4_dynamic_linking" = yes; then
6380 dnl Check if platform calls init/fini automatically
6381 ACE_CACHE_CHECK([for automatic init/fini calls],
6382 [ace_cv_feature_auto_init_fini],[
6383 ace_cv_feature_auto_init_fini=yes
6384 # TODO: We know how to check for this, but we need to:
6386 # 1. Compile one file.
6387 # 2. Compile and link another file.
6388 # 3. Run file in point (2); it returns what we need.
6390 # How do we do all that?
6391 ], [AC_DEFINE([ACE_HAS_AUTOMATIC_INIT_FINI])],)
6392 fi dnl test "$ac_cv_header_dlfcn_h" = yes &&
6393 dnl "$ace_has_svr4_dynamic_linking" = yes
6395 dnl Check for recursive thread exit semantics
6396 if test "$ace_user_enable_threads" = yes; then
6397 ACE_CACHE_CHECK([for recursive thread exit semantics],
6398 [ace_cv_feature_recursive_thr_exit],[
6399 ace_cv_feature_recursive_thr_exit=yes
6400 # TODO: How do we check for recursive thread exit semantics
6401 ], [AC_DEFINE([ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS])],)
6404 dnl Check for UNIX domain sockets
6405 ACE_CACHE_CHECK([for UNIX domain sockets],
6406 [ace_cv_feature_unix_sockets],
6408 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6409 #ifndef ACE_LACKS_SYS_TYPES_H
6410 # include <sys/types.h>
6416 ace_cv_feature_unix_sockets=yes
6418 ace_cv_feature_unix_sockets=no
6420 ], , [AC_DEFINE([ACE_LACKS_UNIX_DOMAIN_SOCKETS])])
6422 dnl Check for raw sockets
6423 ACE_CACHE_CHECK([for raw sockets],
6424 [ace_cv_feature_raw_sockets],
6426 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6427 #ifndef ACE_LACKS_SYS_TYPES_H
6428 # include <sys/types.h>
6430 #include <sys/socket.h>
6431 #include <netinet/in.h>
6433 return socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
6435 ace_cv_feature_raw_sockets=yes
6437 ace_cv_feature_raw_sockets=no
6439 ], [AC_DEFINE([ACE_HAS_ICMP_SUPPORT])])
6441 dnl Check for ACE_Handle_Set optimized for select()
6442 ACE_CACHE_CHECK([for ACE_Handle_Set optimized for select()],
6443 [ace_cv_feature_handle_set_optimized_for_select],[
6444 ace_cv_feature_handle_set_optimized_for_select=yes
6445 # TODO: We know how to check this. We need to:
6447 # 1. Compile and link a file.
6448 # 2. Run nm on that file.
6450 # How do we do that?
6451 ], [AC_DEFINE([ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT])],)
6453 dnl Even we if we don't have IP multicasting, we still need to define
6454 dnl "ACE_HAS_IP_MULTICAST" since struct ip_mreq gets redefined by ACE.
6455 dnl What do we do about this problem?
6457 dnl Check for IP multicast support
6458 ACE_CACHE_CHECK([for IP multicast support],
6459 [ace_cv_feature_ip_multicast],[
6460 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6461 #ifndef ACE_LACKS_SYS_TYPES_H
6462 # include <sys/types.h>
6464 #include <netinet/in.h>
6468 ace_cv_feature_ip_multicast=yes
6470 dnl Some platforms define ip_mreq in <sys/netinet/in.h>.
6471 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
6473 #ifndef ACE_LACKS_SYS_TYPES_H
6474 # include <sys/types.h>
6476 #include <sys/netinet/in.h>
6482 ace_cv_feature_ip_multicast=yes
6485 ace_cv_feature_ip_multicast=no
6488 ], [AC_DEFINE([ACE_HAS_IP_MULTICAST])],)
6490 ACE_CACHE_CHECK([if running on an Alpha],
6491 [ace_cv_feature_alpha],[
6494 ace_cv_feature_alpha=yes
6497 ace_cv_feature_alpha=no
6504 dnl We only define ACE_HAS_ALPHA_TIMER if we are running Linux
6505 dnl on an Alpha and are using GNU C++!
6506 if test "$GXX" = yes; then
6507 AC_DEFINE([ACE_HAS_ALPHA_TIMER], 1,
6508 [Define to 1 if system should use Alpha's cycle counter])
6514 ACE_CACHE_CHECK([if running on a Power PC],
6515 [ace_cv_feature_powerpc],[
6518 ace_cv_feature_powerpc=yes
6521 ace_cv_feature_powerpc=no
6528 dnl We don't do anything for AIX since AIX already has a
6529 dnl hi-res timer function!
6532 dnl Only define ACE_HAS_POWERPC_TIMER when using GNU C++!
6533 if test "$GXX" = yes; then
6534 AC_DEFINE([ACE_HAS_POWERPC_TIMER], 1,
6535 [Define to 1 if system should use PowerPC's cycle counter])
6541 ACE_CACHE_CHECK([if running on a Pentium(tm) processor],
6542 [ace_cv_feature_pentium],[
6544 i386-* | i486-* |i586-* | i686-*)
6545 dnl If we do have a pentium, than define ACE_HAS_PENTIUM and add
6546 dnl gethrtime.cpp to the source list, but only if we're using GNU C++
6547 dnl since gethrtime.cpp uses assembler code specific to that compiler.
6548 if test "$GXX" = yes; then
6549 ace_cv_feature_pentium=yes
6551 ace_cv_feature_pentium=no
6555 ace_cv_feature_pentium=no
6560 AC_DEFINE([ACE_HAS_PENTIUM], 1,
6561 [Define to 1 if system is using Intel Pentium(tm) processor])
6563 AM_CONDITIONAL([ACE_ON_PENTIUM], [test X$ace_cv_feature_pentium = Xyes])
6566 i386-* | i486-* | i586-* | i686-* | x86_64-*)
6567 if test "$GXX" = yes; then
6568 ace_cv_has_intel_assembly=yes
6570 ace_cv_has_intel_assembly=no
6574 ace_cv_has_intel_assembly=no
6577 if test "$ace_cv_has_intel_assembly" != "no"; then
6578 AC_DEFINE([ACE_HAS_INTEL_ASSEMBLY], 1,
6579 [Define to 1 if the system supports x86/x86_64 inline assembly])
6583 dnl SECTION 14: checks for aggregated features
6584 dnl TODO: Little by little, get rid of these...
6588 dnl Macro ACE_HAS_REENTRANT_FUNCTIONS means the following functions
6593 dnl getpwnam_r (if we don't have, define ACE_LACKS_PWD_REENTRANT_FUNCTIONS)
6598 dnl * getprotobyname_r
6599 dnl * getprotobynumber_r
6600 dnl * gethostbyaddr_r
6601 dnl * gethostbyname_r
6602 dnl * getservbyname_r
6604 dnl Those marked with '*' are NOT usable if
6605 dnl ACE_LACKS_NETDB_REENTRANT_FUNCTIONS) is defined.
6607 dnl The time has come to create feature macros for each of these...
6608 dnl With the separate feature macros, we will define (for now)
6609 dnl ACE_HAS_REENTRANT_FUNCTIONS only when all of those WITHOUHT a '*'
6610 dnl are defined. Also, if any of those with '*' are missing, we will
6611 dnl define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS.
6613 dnl Don't bother with reentrant functions if they are disabled by the user.
6614 if test "$ace_user_enable_reentrant_funcs" = yes &&
6615 test "$ac_cv_func_rand_r" = yes &&
6616 test "$ac_cv_func_strtok_r" = yes &&
6617 test "$ac_cv_func_ctime_r" = yes &&
6618 test "$ac_cv_func_localtime_r" = yes &&
6619 test "$ac_cv_func_gmtime_r" = yes &&
6620 test "$ac_cv_func_asctime_r" = yes; then
6621 AC_DEFINE([ACE_HAS_REENTRANT_FUNCTIONS])
6622 # Explicitly enable reentrant functions if thread support is not enabled.
6623 if test "$ace_user_enable_threads" = no; then
6624 ACE_CPPFLAGS="$ACE_CPPFLAGS -D_REENTRANT"
6628 dnl Don't bother with reentrant functions if they are disabled by the user.
6629 if test "$ace_user_enable_reentrant_funcs" = no ||
6630 test "$ac_cv_func_getprotobyname_r" = no ||
6631 test "$ac_cv_func_getprotobynumber_r" = no ||
6632 test "$ac_cv_func_gethostbyaddr_r" = no ||
6633 test "$ac_cv_func_gethostbyname_r" = no ||
6634 test "$ac_cv_func_getservbyname_r" = no; then
6635 AC_DEFINE([ACE_LACKS_NETDB_REENTRANT_FUNCTIONS])
6639 dnl The following is a kludge until the netdb reentrant function
6640 dnl number of arguments is handled.
6642 *linux*) AC_DEFINE([ACE_LACKS_NETDB_REENTRANT_FUNCTIONS]);;
6647 dnl Macro ACE_LACKS_SOME_POSIX_PROTOTYPES implies any of the following
6650 dnl ! ACE_HAS_MSGSND_MSGBUFP_2
6651 dnl ! ACE_LACKS_MSGRCV_VOIDP_2
6652 dnl ! ACE_LACKS_SHMAT_VOIDP_2
6654 dnl So, for now, we define it if any of those were autoconf'ed.
6656 dnl @@ THESE NEED TO BE ADDED AS PROPER CONFIG SETTINGS. --Steve
6657 dnl if test "$ace_cv_lib_posix_msgsnd_msgbufp_2" = yes ||
6658 dnl test "$ace_cv_lib_posix_msgrcv_voidp_2" != yes ||
6659 dnl test "$ace_cv_lib_posix_shmat_voidp_2" != yes ; then
6660 dnl AC_DEFINE([ACE_LACKS_SOME_POSIX_PROTOTYPES])
6663 if test "$ac_cv_func_msgctl" = yes &&
6664 test "$ac_cv_func_msgget" = yes &&
6665 test "$ac_cv_func_msgrcv" = yes &&
6666 test "$ac_cv_func_semctl" = yes &&
6667 test "$ac_cv_func_semget" = yes &&
6668 test "$ac_cv_func_semop" = yes &&
6669 test "$ac_cv_func_shmat" = yes &&
6670 test "$ac_cv_func_shmctl" = yes &&
6671 test "$ac_cv_func_shmdt" = yes &&
6672 test "$ac_cv_func_shmget" = yes; then
6673 AC_DEFINE([ACE_HAS_SYSV_IPC])
6676 if test "$ac_cv_func_shmat" != yes ||
6677 test "$ac_cv_func_shmctl" != yes ||
6678 test "$ac_cv_func_shmdt" != yes ||
6679 test "$ac_cv_func_shmget" != yes; then
6680 AC_DEFINE([ACE_LACKS_SYSV_SHMEM])
6683 dnl Check for what POSIX threads draft we have
6684 AC_MSG_CHECKING([which POSIX thread library was found])
6688 dnl Check if we have Pthreads Draft 4
6689 dnl if test "$ac_cv_func_pthread_delay_np" = yes &&
6690 if test "$ac_cv_func_pthread_mutexattr_create" = yes &&
6691 dnl test "$ac_cv_func_pthread_mutexattr_setkind_np" = yes &&
6692 test "$ac_cv_func_pthread_mutexattr_delete" = yes &&
6693 test "$ac_cv_func_pthread_condattr_delete" = yes &&
6694 test "$ac_cv_func_pthread_condattr_create" = yes &&
6695 test "$ac_cv_func_pthread_setprio" = yes &&
6696 test "$ac_cv_func_pthread_getprio" = yes &&
6697 dnl test "$ac_cv_func_pthread_getspecific" = yes &&
6698 test "$ac_cv_func_pthread_setcancel" = yes &&
6699 test "$ac_cv_func_pthread_setasynccancel" = yes &&
6700 test "$ac_cv_func_pthread_kill" = yes; then
6701 ace_has_pthreads=yes
6702 AC_MSG_RESULT([POSIX Threads Draft 4])
6703 AC_DEFINE([ACE_HAS_PTHREADS_DRAFT4], 1,
6704 [Platform supports POSIX Threads .4a Draft 4])
6705 dnl Check if we have Pthreads Draft 6
6706 elif test "$ac_cv_func_pthread_mutexattr_init" = yes &&
6707 test "$ac_cv_func_pthread_mutexattr_destroy" = yes &&
6708 test "$ac_cv_func_pthread_condattr_destroy" = yes &&
6709 test "$ac_cv_func_pthread_condattr_init" = yes &&
6710 test "$ac_cv_func_pthread_attr_setprio" = yes &&
6711 test "$ac_cv_func_pthread_attr_getprio" = yes &&
6712 test "$ac_cv_func_pthread_setintr" = yes &&
6713 test "$ac_cv_func_pthread_setintrtype" = yes; then
6714 ace_has_pthreads=yes
6715 AC_MSG_RESULT([POSIX Threads Draft 6])
6716 AC_DEFINE([ACE_HAS_PTHREADS_DRAFT6], 1,
6717 [Platform supports POSIX Threads .4a Draft 6])
6718 dnl Check if we have Pthreads Draft 7
6719 elif test "$ac_cv_func_pthread_mutexattr_init" = yes &&
6720 test "$ac_cv_func_pthread_mutexattr_destroy" = yes &&
6721 test "$ac_cv_func_pthread_condattr_destroy" = yes &&
6722 test "$ac_cv_func_pthread_condattr_init" = yes &&
6723 test "$ac_cv_func_pthread_setschedparam" = yes &&
6724 test "$ac_cv_func_pthread_getschedparam" = yes &&
6725 test "$ac_cv_func_pthread_setcancelstate" = yes &&
6726 test "$ac_cv_func_pthread_setcanceltype" = yes &&
6727 test "$ace_has_sched_yield" != yes; then
6728 ace_has_pthreads=yes
6729 AC_MSG_RESULT([POSIX Threads Draft 7])
6730 AC_DEFINE([ACE_HAS_PTHREADS_DRAFT7], 1,
6731 [Platform supports POSIX Threads .1c Draft 7])
6732 dnl Check if we have Pthreads Draft Standard
6733 elif test "$ac_cv_func_pthread_mutexattr_init" = yes &&
6734 test "$ac_cv_func_pthread_mutexattr_destroy" = yes &&
6735 test "$ac_cv_func_pthread_condattr_destroy" = yes &&
6736 test "$ac_cv_func_pthread_condattr_init" = yes &&
6737 test "$ac_cv_func_pthread_setschedparam" = yes &&
6738 test "$ac_cv_func_pthread_getschedparam" = yes &&
6739 test "$ac_cv_func_pthread_setcancelstate" = yes &&
6740 test "$ac_cv_func_pthread_setcanceltype" = yes &&
6741 test "$ace_has_sched_yield" = yes; then
6742 ace_has_pthreads=yes
6743 AC_MSG_RESULT([POSIX Threads Draft Standard])
6744 AC_DEFINE([ACE_HAS_PTHREADS_STD], 1,
6745 [Platform supports POSIX.1c-1995 threads])
6748 AC_MSG_RESULT([none])
6749 fi dnl PTHREAD DRAFT CHECKS
6751 dnl Check if we have UNIX International threads
6752 AC_MSG_CHECKING([if a UNIX International thread library was found])
6753 if test "$ace_has_sthreads" = yes; then
6754 AC_MSG_RESULT([yes])
6759 if test "$ace_user_enable_threads" != yes ||
6760 test "$ace_has_pthreads" != yes &&
6761 test "$ace_has_sthreads" != yes; then
6762 dnl We don't have a usable thread library!
6763 ace_user_enable_threads=no
6764 dnl Make sure _REENTRANT and _THREAD_SAFE are not in the
6765 dnl preprocessor flags since thread support is being disabled.
6766 dnl Removal of these flags is only performed if the configure script
6768 if test -n "$ACE_THR_CPPFLAGS"; then
6769 dnl changequote(, )dnl
6770 CPPFLAGS=`eval "echo $CPPFLAGS | sed -e 's/$ACE_THR_CPPFLAGS//' -e 's/-D_THREAD_SAFE\(=[[0-9]]*\)\?//'"`
6771 dnl changequote([, ])dnl
6774 AC_MSG_WARN([It appears that you do NOT have any usable thread libraries])
6775 AC_MSG_WARN([or thread support was explicitly disabled.])
6776 AC_MSG_WARN([Disabling thread support.])
6777 dnl ACE uses different versions of readdir_r depending on the thread
6778 dnl library being used, i.e. on the ACE_HAS_*THREADS* macros. Since
6779 dnl it doesn't seem like a good idea to define any ACE_HAS_*THREADS*
6780 dnl macro if ACE won't be supporting threads, define ACE_LACKS_READDIR_R
6781 dnl regardless if readdir_r() exists.
6782 if test "$ac_cv_func_readdir_r" = yes; then
6783 AC_MSG_WARN([Disabling support for readdir_r() since thread support])
6784 AC_MSG_WARN([is being disabled.])
6785 AC_DEFINE([ACE_LACKS_READDIR_R])
6786 fi dnl test "$ac_cv_func_readdir_r" = yes
6789 if test "$ace_user_enable_threads" = yes; then
6790 dnl If we get this far then we have threads.
6791 dnl FIXME: The "_POSIX" macros may need to be defined _before_ the checks for
6792 dnl reentrant functions! However, we don't want to define them if
6793 dnl the UNIX International threads library was detected.
6794 AC_DEFINE([ACE_HAS_THREADS])
6795 AC_DEFINE([ACE_MT_SAFE])
6796 ACE_CPPFLAGS="$ACE_CPPFLAGS $ACE_THR_CPPFLAGS"
6798 if test "$ace_has_pthreads" = yes; then
6800 dnl Check if OS requires non-null status pointer for ::pthread_join ()
6802 dnl This test must be performed after the POSIX threads implementation
6803 dnl that the platform supports has been determined.
6804 ACE_CACHE_CHECK([for pthread_join null status pointer support],
6805 [ace_cv_have_null_status_pthread_join],[
6806 AC_EGREP_CPP([WE_HAVE_PTHREADS_D4],
6808 #if defined (ACE_HAS_PTHREADS) && defined (ACE_HAS_PTHREADS_DRAFT4)
6809 /* This test is only valid for Pthreads Draft 4 */
6814 AC_RUN_IFELSE([AC_LANG_SOURCE([[
6819 #include <pthread.h>
6821 /* _THREAD_SAFE is defined in <pthread.h> on some platforms. */
6822 #ifndef _THREAD_SAFE
6823 #define _THREAD_SAFE
6832 nothing (void *unused)
6840 pthread_attr_t attr;
6846 /* We return 0 on error for these calls since we only want to
6847 return an error status if pthread_join fails. If these calls
6848 fail then we've got other problems! */
6849 if (pthread_attr_create (&attr) != 0) return 0 /*1*/;
6851 if (pthread_create (&id, attr, nothing, 0) != 0) return 0 /*2*/;
6853 if (pthread_attr_delete (&attr) != 0) return /*3*/;
6856 /* With a second (status) arg of 0, LynxOS 3.0.0 pthread_join ()
6857 will fail with errno 14 (address fault detected). */
6858 if (pthread_join (id, 0) == -1) {
6859 fprintf (stderr, "%s: %d; ", __FILE__, __LINE__);
6860 perror ("pthread_join");
6864 if (pthread_join (id, &status) == -1) {
6865 fprintf (stderr, "%s: %d; ", __FILE__, __LINE__);
6866 perror ("pthread_join");
6873 ace_cv_have_null_status_pthread_join=yes
6875 ace_cv_have_null_status_pthread_join=no
6877 dnl If we are cross-compiling let's hope that
6878 dnl that we have a working null status pointer
6879 dnl for pthread_join.
6880 ace_cv_have_null_status_pthread_join=yes
6884 ace_cv_have_null_status_pthread_join=yes
6886 ], , [AC_DEFINE([ACE_LACKS_NULL_PTHREAD_STATUS])])
6888 dnl Check if OS supports mutex timeouts
6889 dnl (e.g. pthread_mutex_timedlock()).
6890 ACE_CACHE_CHECK([for mutex timeouts],
6891 [ace_cv_have_mutex_timeouts],[
6892 AC_RUN_IFELSE([AC_LANG_SOURCE([[
6897 #include <pthread.h>
6899 /* _THREAD_SAFE is defined in <pthread.h> on some platforms. */
6900 #ifndef _THREAD_SAFE
6901 #define _THREAD_SAFE
6907 #include <sys/time.h>
6910 #ifndef ACE_LACKS_UNISTD_H
6911 # include <unistd.h>
6914 pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
6919 void *threadFunc (void *parm)
6923 struct timespec deltatime;
6926 if (gettimeofday (&tv, 0) != 0)
6931 deltatime.tv_sec = tv.tv_sec + 5;
6932 deltatime.tv_nsec = 0;
6934 rc = pthread_mutex_timedlock (&mutex, &deltatime);
6936 if (rc != ETIMEDOUT)
6938 /* printf("Got an incorrect return code from pthread_mutex_timedlock\n"); */
6949 rc = pthread_mutex_lock (&mutex);
6955 rc = pthread_create (&thread, NULL, threadFunc, NULL);
6961 rc = pthread_join (thread, NULL);
6967 pthread_mutex_destroy (&mutex);
6972 ace_cv_have_mutex_timeouts=yes
6974 ace_cv_have_mutex_timeouts=no
6976 dnl Cross-compiled case
6977 AC_CHECK_FUNC([pthread_mutex_timedlock],
6978 [ace_cv_have_mutex_timeouts=yes],
6979 [ace_cv_have_mutex_timeouts=no])
6981 ], [AC_DEFINE([ACE_HAS_MUTEX_TIMEOUTS])],)
6983 dnl Check if platform needs to #include <sched.h> to get thread
6984 dnl scheduling defs.
6985 ACE_CACHE_CHECK([if sched.h is needed for thread scheduling definitions],
6986 [ace_cv_needs_sched_h],
6988 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6989 #ifdef ACE_HAS_STHREADS
6993 #ifdef ACE_HAS_PTHREADS
6994 #include <pthread.h>
6997 int foo = SCHED_OTHER;
6999 ace_cv_needs_sched_h=no
7001 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
7003 #ifdef ACE_HAS_STHREADS
7007 #ifdef ACE_HAS_PTHREADS
7008 #include <pthread.h>
7014 int foo = SCHED_OTHER;
7017 ace_cv_needs_sched_h=yes
7020 dnl We're hosed if we get here!
7021 ace_cv_needs_sched_h=no
7026 AC_DEFINE([ACE_NEEDS_SCHED_H])
7029 dnl Check if platform only supports SCHED_OTHER scheduling policy
7031 dnl This test must be performed after the POSIX threads implementation
7032 dnl that the platform supports has been determined.
7033 ACE_CACHE_CHECK([if SCHED_OTHER is only scheduling policy],
7034 [ace_cv_feature_only_have_sched_other],
7036 AC_EGREP_CPP([WE_ONLY_HAVE_SCHED_OTHER],
7038 #ifdef ACE_HAS_STHREADS
7039 # include <thread.h>
7042 #ifdef ACE_HAS_PTHREADS
7043 # include <pthread.h>
7046 #if defined (ACE_NEEDS_SCHED_H)
7050 /* These are ORed so that ACE will not redefine
7051 any of them if any of them exist. */
7052 #if !defined (SCHED_FIFO) && \
7053 !defined (SCHED_RR) && \
7054 defined (SCHED_OTHER)
7055 WE_ONLY_HAVE_SCHED_OTHER
7059 ace_cv_feature_only_have_sched_other=yes
7062 AC_RUN_IFELSE([AC_LANG_SOURCE([[
7067 #include <pthread.h>
7069 /* _THREAD_SAFE is defined in <pthread.h> on some platforms. */
7070 #ifndef _THREAD_SAFE
7071 #define _THREAD_SAFE
7079 pthread_attr_t ace_attr;
7081 #if defined (ACE_HAS_PTHREADS_DRAFT4)
7082 if (pthread_attr_create (&ace_attr) != 0)
7084 if (pthread_attr_init (&ace_attr) != 0)
7087 perror ("pthread_attr_init");
7088 return 0; /* Return "successfully" since only the policy call
7089 will return with an error for this test. */
7092 #if defined (ACE_HAS_PTHREADS_DRAFT4)
7093 if (pthread_attr_setsched (&ace_attr, SCHED_FIFO) != 0)
7095 if (pthread_attr_setschedpolicy (&ace_attr, SCHED_FIFO) != 0)
7098 perror ("pthread_attr_setschedpolicy");
7102 #if defined (ACE_HAS_PTHREADS_DRAFT4)
7103 if (pthread_attr_delete (&ace_attr) != 0)
7105 if (pthread_attr_destroy (&ace_attr) != 0)
7108 perror ("pthread_attr_destroy");
7109 return 0; /* Return "successfully" since only the policy call
7110 will return with an error for this test. */
7116 ace_cv_feature_only_have_sched_other=no
7118 ace_cv_feature_only_have_sched_other=yes
7120 dnl We only get here if polices other than SCHED_OTHER
7121 dnl were found in the headers and we are cross-compiling.
7123 dnl If we are cross-compiling let's hope that the
7124 dnl scheduling policies found in the headers
7125 dnl besides SCHED_OTHER (e.g. SCHED_FIFO, SCHED_RR)
7127 ace_cv_feature_only_have_sched_other=no
7130 ], [AC_DEFINE([ACE_HAS_ONLY_SCHED_OTHER])],)
7131 fi dnl test "$ace_has_pthreads" = yes
7132 fi dnl test "$ace_user_enable_threads" = yes
7135 AC_CHECK_HEADER(libc.h)
7136 AC_CHECK_HEADER(osfcn.h)
7137 if test "$ac_cv_header_libc_h" != yes ||
7138 test "$ac_cv_header_osfcn_h" != yes; then
7139 AC_DEFINE([ACE_HAS_CPLUSPLUS_HEADERS])
7144 if test "$ace_cv_lib_signal_vi1_2" = yes &&
7145 test "$ace_cv_lib_signal_vi1_ret" = yes &&
7146 test "$ace_cv_lib_struct_sigaction_vi1_handler" = yes; then
7147 AC_DEFINE([ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES])
7148 elif test "$ace_cv_lib_signal_vi1_2" != yes &&
7149 test "$ace_cv_lib_signal_vv1_2" != yes &&
7150 test "$ace_cv_lib_signal_vi1a2_2" != yes &&
7151 test "$ace_cv_lib_signal_va1_2" = yes &&
7152 test "$ace_cv_lib_signal_vi1_ret" != yes &&
7153 test "$ace_cv_lib_signal_vv1_ret" != yes &&
7154 test "$ace_cv_lib_signal_vi1a2_ret" != yes &&
7155 test "$ace_cv_lib_signal_va1_ret" = yes &&
7156 test "$ace_cv_lib_struct_sigaction_vi1_handler" != yes &&
7157 test "$ace_cv_lib_struct_sigaction_vv1_handler" != yes &&
7158 test "$ace_cv_lib_struct_sigaction_vi1a2_handler" != yes &&
7159 test "$ace_cv_lib_struct_sigaction_va1_handler" = yes; then
7160 AC_DEFINE([ACE_HAS_LYNXOS_SIGNALS])
7161 AC_DEFINE([ACE_HAS_TANDEM_SIGNALS])
7162 elif test "$ace_cv_lib_signal_vi1_2" = yes &&
7163 test "$ace_cv_lib_signal_vi1_ret" = yes &&
7164 test "$ace_cv_lib_struct_sigaction_vi1_handler" != yes; then
7165 AC_DEFINE([ACE_HAS_SVR4_SIGNAL_T])
7166 elif test "$ace_cv_lib_signal_vi1_2" = yes &&
7167 test "$ace_cv_lib_signal_vv1_ret" = yes &&
7168 test "$ace_cv_lib_struct_sigaction_vv1_handler" = yes; then
7169 AC_DEFINE([ACE_HAS_SVR4_SIGNAL_T])
7170 elif test "$ace_cv_lib_signal_vi1_2" = yes &&
7171 test "$ace_cv_lib_signal_vi1_ret" != yes &&
7172 test "$ace_cv_lib_signal_vv1_ret" != yes &&
7173 test "$ace_cv_lib_signal_vi1a2_ret" != yes &&
7174 test "$ace_cv_lib_signal_va1_ret" = yes &&
7175 test "$ace_cv_lib_struct_sigaction_vi1_handler" != yes &&
7176 test "$ace_cv_lib_struct_sigaction_vv1_handler" != yes &&
7177 test "$ace_cv_lib_struct_sigaction_vi1a2_handler" != yes &&
7178 test "$ace_cv_lib_struct_sigaction_va1_handler" = yes; then
7179 AC_DEFINE([ACE_HAS_UNIXWARE_SVR4_SIGNAL_T])
7180 fi dnl ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
7183 dnl SECTION 15: Final checks
7186 dnl Make final substitutions and defines
7187 if test "$ace_u_long_long_typedef_set" = yes; then
7188 AC_DEFINE_UNQUOTED([ACE_INT64_TYPE], [$ACE_INT64],
7189 [Define to signed 64 bit integer type])
7190 AC_DEFINE_UNQUOTED([ACE_UINT64_TYPE], [$ACE_UINT64],
7191 [Define to unsigned 64 bit integer type])
7194 dnl Combine package set flags with user's flags.
7195 dnl User's flags go after package flags to allow user to override
7196 dnl package defaults.
7197 dnl X_CFLAGS comes from AC_PATH_XTRA. It may include, for example,
7198 dnl additional include file paths or macros that need to be defined
7199 dnl in order for X11 related files to be compiled properly.
7200 if test "$ace_user_enable_optimize"; then
7201 dnl We want OCXXFLAGS to be on the end, so we use CXXFLAGS,
7202 dnl not ACE_CXXFLAGS!
7203 CXXFLAGS="$CXXFLAGS $OCXXFLAGS"
7204 CFLAGS="$CFLAGS $OCFLAGS"
7206 CXXFLAGS="$ACE_CXXFLAGS $X_CFLAGS $CXXFLAGS"
7207 CFLAGS="$ACE_CFLAGS $X_CFLAGS $CFLAGS"
7208 CPPFLAGS="$ACE_CPPFLAGS $CPPFLAGS"
7209 LDFLAGS="$ACE_LDFLAGS $LDFLAGS"
7211 dnl The following tests should be performed _after_ the bulk of the
7212 dnl ACE macros have been defined.
7214 dnl Flush the cache so that it is easier to debug the configure script
7215 dnl if the following integrity check fails.
7218 dnl Verify the integrity of the current configuration.
7219 ACE_CACHE_CHECK([if generated ACE configuration is usable],
7220 [ace_cv_configuration_is_usable],
7222 dnl We want an empty ace/config.h to prevent multiple defines
7223 dnl with Autoconf's confdefs.h
7224 ACE_USE_TEMP_FILE([ace/config.h],
7226 dnl Now run the compilation test
7227 ACE_TRY_COMPILE([-I. -I${srcdir}],
7229 // Include ".cpp" files instead of headers so that we can get a more
7230 // thorough test compile.
7231 #include "ace/Time_Value.cpp"
7232 #include "ace/Reactor.cpp"
7235 ACE_Time_Value t = ACE_OS::gettimeofday ();
7238 ACE_Reactor * r = ACE_Reactor::instance ();
7243 ace_cv_configuration_is_usable=yes
7246 ace_cv_configuration_is_usable=no
7251 dnl Looks good! Do nothing.
7252 dnl It appears that ace/OS.cpp compiled. If it didn't compile then
7253 dnl there would be no chance that the rest of ACE would compile.
7258 The generated configuration appears to be unusable. Please verify
7259 that your system path and environment variables are correct. If they
7260 appear to be correct then please send the maintainer of this configure
7261 script $ACE_CONFIGURE_MAINTAINER the *COMPRESSED* 'config.log' file
7262 and the following information:
7264 ACE 'configure' Script Information
7265 ==================================
7266 [RCS] translit([$Id: configure.ac 82832 2008-09-25 17:38:39Z jtc $], [$"])
7269 ACE Version: ACE_VERSION
7271 C++ Preprocessor: $CXXCPP
7272 C++ Flags: $CXXFLAGS
7273 Preprocessor Flags: $CPPFLAGS
7275 Linker Flags: $LDFLAGS
7277 System type information:
7278 Build: $build Host: $host
7280 In the meantime, please use the stock ACE build procedure detailed in
7281 the file 'ACE-INSTALL.html'.
7287 dnl Check for ACE_IOStream support
7288 ACE_CACHE_CHECK([for ACE_IOStream support],
7289 [ace_cv_feature_ace_iostream],
7291 dnl We want an empty ace/config.h to prevent multiple defines
7292 dnl with Autoconf's confdefs.h
7293 ACE_USE_TEMP_FILE([ace/config.h],
7295 dnl Now run the compilation test
7296 ACE_TRY_COMPILE([-I. -I${srcdir}],
7298 #include "ace/IOStream.cpp"
7304 ace_cv_feature_ace_iostream=yes
7307 ace_cv_feature_ace_iostream=no
7310 ], , [AC_DEFINE([ACE_LACKS_ACE_IOSTREAM])])
7312 dnl Check if ACE needs conversion to pass ACE_TTY_IO to DEV_Connector
7313 ACE_CACHE_CHECK([if ACE needs conversion to pass ACE_TTY_IO to DEV_Connector],
7314 [ace_cv_lib_need_dev_io_conv],
7316 dnl We want an empty ace/config.h to prevent multiple defines
7317 dnl with Autoconf's confdefs.h
7318 ACE_USE_TEMP_FILE([ace/config.h],
7320 dnl Now run the compilation test
7321 ACE_TRY_COMPILE([-I. -I${srcdir}],
7323 #include "ace/OS.cpp"
7329 ace_cv_lib_need_dev_io_conv=no
7332 dnl Now check if ACE_NEEDS_DEV_IO_CONVERSION makes
7333 dnl compilation work!
7334 ACE_TRY_COMPILE([-I. -I${srcdir}],
7336 #define ACE_NEEDS_DEV_IO_CONVERSION
7337 #include "ace/DEV_Connector.cpp"
7343 ace_cv_lib_need_dev_io_conv=yes
7346 dnl If we get here, then we have no idea what is wrong!
7347 ace_cv_lib_need_dev_io_conv=no
7351 ], [AC_DEFINE([ACE_NEEDS_DEV_IO_CONVERSION])],)
7353 dnl End ACE macro tests!
7355 dnl Substitute whatever X libraries ACE needs, if any.
7356 AC_SUBST([ACE_XLIBS])
7358 dnl Prepend purify and quantify command lines if purify and quantify are
7359 dnl enabled. Otherwise, PURELINK and PRELINK will just be "blank."
7360 LD="$PURELINK $PRELINK $LD"
7361 dnl LDFLAGS="$ACE_LDFLAGS $LDFLAGS"
7363 dnl AC_SUBST(LDFLAGS)
7364 dnl AC_SUBST(LIBOBJS)
7366 dnl Force CXXFLAGS to be substituted in Makefiles that don't "need" them.
7367 AC_SUBST([CXXFLAGS])
7369 dnl Precompute the absolute pathname of the ACE tests directory so
7370 dnl that we can avoid using GNU Make extensions in the ACE tests
7372 ACE_TESTS_DIR=`pwd`/tests
7373 AC_SUBST([ACE_TESTS_DIR])
7376 dnl SECTION 16: AC_CONFIG_FILES([FILE...])
7379 dnl We can finally create all the files listed here; Makefile is
7380 dnl created from Makefile.in, etc. Top-level Makefiles should be
7386 dnl apps/gperf/Makefile
7387 dnl apps/gperf/src/Makefile
7389 dnl man/man3/Makefile
7390 dnl netsvcs/Makefile
7391 dnl netsvcs/clients/Makefile
7392 dnl netsvcs/clients/Logger/Makefile
7393 dnl netsvcs/clients/Naming/Makefile
7394 dnl netsvcs/clients/Naming/Client/Makefile
7395 dnl netsvcs/clients/Naming/Dump_Restore/Makefile
7396 dnl netsvcs/clients/Tokens/Makefile
7397 dnl netsvcs/clients/Tokens/collection/Makefile
7398 dnl netsvcs/clients/Tokens/deadlock/Makefile
7399 dnl netsvcs/clients/Tokens/invariant/Makefile
7400 dnl netsvcs/clients/Tokens/manual/Makefile
7401 dnl netsvcs/clients/Tokens/mutex/Makefile
7402 dnl netsvcs/clients/Tokens/rw_lock/Makefile
7403 dnl netsvcs/lib/Makefile
7404 dnl netsvcs/servers/Makefile
7412 dnl Note that the "ACE_VERSION" in the message below is an M4 macro
7413 dnl that expands to the version of ACE being configured.
7414 AC_CONFIG_COMMANDS([default],[
7416 echo "Configuration of ACE ACE_VERSION is now complete."