Skip to content
configure 834 KiB
Newer Older
powelld's avatar
powelld committed
21001 21002 21003 21004 21005 21006 21007 21008 21009 21010 21011 21012 21013 21014 21015 21016 21017 21018 21019 21020 21021 21022 21023 21024 21025 21026 21027 21028 21029 21030 21031 21032 21033 21034 21035 21036 21037 21038 21039 21040 21041 21042 21043 21044 21045 21046 21047 21048 21049 21050 21051 21052 21053 21054 21055 21056 21057 21058 21059 21060 21061 21062 21063 21064 21065 21066 21067 21068 21069 21070 21071 21072 21073 21074 21075 21076 21077 21078 21079 21080 21081 21082 21083 21084 21085 21086 21087 21088 21089 21090 21091 21092 21093 21094 21095 21096 21097 21098 21099 21100 21101 21102 21103 21104 21105 21106 21107 21108 21109 21110 21111 21112 21113 21114 21115 21116 21117 21118 21119 21120 21121 21122 21123 21124 21125 21126 21127 21128 21129 21130 21131 21132 21133 21134 21135 21136 21137 21138 21139 21140 21141 21142 21143 21144 21145 21146 21147 21148 21149 21150 21151 21152 21153 21154 21155 21156 21157 21158 21159 21160 21161 21162 21163 21164 21165 21166 21167 21168 21169 21170 21171 21172 21173 21174 21175 21176 21177 21178 21179 21180 21181 21182 21183 21184 21185 21186 21187 21188 21189 21190 21191 21192 21193 21194 21195 21196 21197 21198 21199 21200 21201 21202 21203 21204 21205 21206 21207 21208 21209 21210 21211 21212 21213 21214 21215 21216 21217 21218 21219 21220 21221 21222 21223 21224 21225 21226 21227 21228 21229 21230 21231 21232 21233 21234 21235 21236 21237 21238 21239 21240 21241 21242 21243 21244 21245 21246 21247 21248 21249 21250 21251 21252 21253 21254 21255 21256 21257 21258 21259 21260 21261 21262 21263 21264 21265 21266 21267 21268 21269 21270 21271 21272 21273 21274 21275 21276 21277 21278 21279 21280 21281 21282 21283 21284 21285 21286 21287 21288 21289 21290 21291 21292 21293 21294 21295 21296 21297 21298 21299 21300 21301 21302 21303 21304 21305 21306 21307 21308 21309 21310 21311 21312 21313 21314 21315 21316 21317 21318 21319 21320 21321 21322 21323 21324 21325 21326 21327 21328 21329 21330 21331 21332 21333 21334 21335 21336 21337 21338 21339 21340 21341 21342 21343 21344 21345 21346 21347 21348 21349 21350 21351 21352 21353 21354 21355 21356 21357 21358 21359 21360 21361 21362 21363 21364 21365 21366 21367 21368 21369 21370 21371 21372 21373 21374 21375 21376 21377 21378 21379 21380 21381 21382 21383 21384 21385 21386 21387 21388 21389 21390 21391 21392 21393 21394 21395 21396 21397 21398 21399 21400 21401 21402 21403 21404 21405 21406 21407 21408 21409 21410 21411 21412 21413 21414 21415 21416 21417 21418 21419 21420 21421 21422 21423 21424 21425 21426 21427 21428 21429 21430 21431 21432 21433 21434 21435 21436 21437 21438 21439 21440 21441 21442 21443 21444 21445 21446 21447 21448 21449 21450 21451 21452 21453 21454 21455 21456 21457 21458 21459 21460 21461 21462 21463 21464 21465 21466 21467 21468 21469 21470 21471 21472 21473 21474 21475 21476 21477 21478 21479 21480 21481 21482 21483 21484 21485 21486 21487 21488 21489 21490 21491 21492 21493 21494 21495 21496 21497 21498 21499 21500 21501 21502 21503 21504 21505 21506 21507 21508 21509 21510 21511 21512 21513 21514 21515 21516 21517 21518 21519 21520 21521 21522 21523 21524 21525 21526 21527 21528 21529 21530 21531 21532 21533 21534 21535 21536 21537 21538 21539 21540 21541 21542 21543 21544 21545 21546 21547 21548 21549 21550 21551 21552 21553 21554 21555 21556 21557 21558 21559 21560 21561 21562 21563 21564 21565 21566 21567 21568 21569 21570 21571 21572 21573 21574 21575 21576 21577 21578 21579 21580 21581 21582 21583 21584 21585 21586 21587 21588 21589 21590 21591 21592 21593 21594 21595 21596 21597 21598 21599 21600 21601 21602 21603 21604 21605 21606 21607 21608 21609 21610 21611 21612 21613 21614 21615 21616 21617 21618 21619 21620 21621 21622 21623 21624 21625 21626 21627 21628 21629 21630 21631 21632 21633 21634 21635 21636 21637 21638 21639 21640 21641 21642 21643 21644 21645 21646 21647 21648 21649 21650 21651 21652 21653 21654 21655 21656 21657 21658 21659 21660 21661 21662 21663 21664 21665 21666 21667 21668 21669 21670 21671 21672 21673 21674 21675 21676 21677 21678 21679 21680 21681 21682 21683 21684 21685 21686 21687 21688 21689 21690 21691 21692 21693 21694 21695 21696 21697 21698 21699 21700 21701 21702 21703 21704 21705 21706 21707 21708 21709 21710 21711 21712 21713 21714 21715 21716 21717 21718 21719 21720 21721 21722 21723 21724 21725 21726 21727 21728 21729 21730 21731 21732 21733 21734 21735 21736 21737 21738 21739 21740 21741 21742 21743 21744 21745 21746 21747 21748 21749 21750 21751 21752 21753 21754 21755 21756 21757 21758 21759 21760 21761 21762 21763 21764 21765 21766 21767 21768 21769 21770 21771 21772 21773 21774 21775 21776 21777 21778 21779 21780 21781 21782 21783 21784 21785 21786 21787 21788 21789 21790 21791 21792 21793 21794 21795 21796 21797 21798 21799 21800 21801 21802 21803 21804 21805 21806 21807 21808 21809 21810 21811 21812 21813 21814 21815 21816 21817 21818 21819 21820 21821 21822 21823 21824 21825 21826 21827 21828 21829 21830 21831 21832 21833 21834 21835 21836 21837 21838 21839 21840 21841 21842 21843 21844 21845 21846 21847 21848 21849 21850 21851 21852 21853 21854 21855 21856 21857 21858 21859 21860 21861 21862 21863 21864 21865 21866 21867 21868 21869 21870 21871 21872 21873 21874 21875 21876 21877 21878 21879 21880 21881 21882 21883 21884 21885 21886 21887 21888 21889 21890 21891 21892 21893 21894 21895 21896 21897 21898 21899 21900 21901 21902 21903 21904 21905 21906 21907 21908 21909 21910 21911 21912 21913 21914 21915 21916 21917 21918 21919 21920 21921 21922 21923 21924 21925 21926 21927 21928 21929 21930 21931 21932 21933 21934 21935 21936 21937 21938 21939 21940 21941 21942 21943 21944 21945 21946 21947 21948 21949 21950 21951 21952 21953 21954 21955 21956 21957 21958 21959 21960 21961 21962 21963 21964 21965 21966 21967 21968 21969 21970 21971 21972 21973 21974 21975 21976 21977 21978 21979 21980 21981 21982 21983 21984 21985 21986 21987 21988 21989 21990 21991 21992 21993 21994 21995 21996 21997 21998 21999 22000
done

case $host in
    *alpha*-dec-osf* )
        have_sigwait="1"
        ;;
esac





for ac_func in poll kqueue port_create
do :
  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
  cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF

fi
done


# Check for the Linux epoll interface; epoll* may be available in libc
# but return ENOSYS on a pre-2.6 kernel, so do a run-time check.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for epoll support" >&5
$as_echo_n "checking for epoll support... " >&6; }
if ${apr_cv_epoll+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  apr_cv_epoll=no
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#include <sys/epoll.h>
#include <unistd.h>

int main()
{
    return epoll_create(5) == -1;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
  apr_cv_epoll=yes
else
  apr_cv_epoll=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_epoll" >&5
$as_echo "$apr_cv_epoll" >&6; }

if test "$apr_cv_epoll" = "yes"; then

$as_echo "#define HAVE_EPOLL 1" >>confdefs.h

fi

# test for epoll_create1
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for epoll_create1 support" >&5
$as_echo_n "checking for epoll_create1 support... " >&6; }
if ${apr_cv_epoll_create1+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  apr_cv_epoll_create1=no
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#include <sys/epoll.h>
#include <unistd.h>

int main()
{
    return epoll_create1(0) == -1;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
  apr_cv_epoll_create1=yes
else
  apr_cv_epoll_create1=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_epoll_create1" >&5
$as_echo "$apr_cv_epoll_create1" >&6; }

if test "$apr_cv_epoll_create1" = "yes"; then

$as_echo "#define HAVE_EPOLL_CREATE1 1" >>confdefs.h

fi

# test for dup3
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dup3 support" >&5
$as_echo_n "checking for dup3 support... " >&6; }
if ${apr_cv_dup3+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  apr_cv_dup3=no
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#include <unistd.h>

int main()
{
    return dup3(STDOUT_FILENO, STDERR_FILENO, 0) == -1;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
  apr_cv_dup3=yes
else
  apr_cv_dup3=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_dup3" >&5
$as_echo "$apr_cv_dup3" >&6; }

if test "$apr_cv_dup3" = "yes"; then

$as_echo "#define HAVE_DUP3 1" >>confdefs.h

fi

# Test for accept4().  Create a non-blocking socket, bind it to
# an unspecified port & address (kernel picks), and attempt to
# call accept4() on it.  If the syscall is wired up (i.e. the
# kernel is new enough), it should return EAGAIN.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for accept4 support" >&5
$as_echo_n "checking for accept4 support... " >&6; }
if ${apr_cv_accept4+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  apr_cv_accept4=no
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>

int main(int argc, char **argv)
{
    int fd, flags;
    struct sockaddr_in sin;

    if ((fd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
        return 1;
    flags = fcntl(fd, F_GETFL);
    if (flags == -1 || fcntl(fd, F_SETFL, flags|O_NONBLOCK) == -1)
        return 5;

    memset(&sin, 0, sizeof sin);
    sin.sin_family = AF_INET;

    if (bind(fd, (struct sockaddr *) &sin, sizeof sin) == -1)
        return 2;

    if (listen(fd, 5) == -1)
        return 3;

    if (accept4(fd, NULL, 0, SOCK_NONBLOCK) == 0
        || errno == EAGAIN || errno == EWOULDBLOCK)
        return 0;

    return 4;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
  apr_cv_accept4=yes
else
  apr_cv_accept4=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_accept4" >&5
$as_echo "$apr_cv_accept4" >&6; }

if test "$apr_cv_accept4" = "yes"; then

$as_echo "#define HAVE_ACCEPT4 1" >>confdefs.h

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SOCK_CLOEXEC support" >&5
$as_echo_n "checking for SOCK_CLOEXEC support... " >&6; }
if ${apr_cv_sock_cloexec+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  apr_cv_sock_cloexec=no
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#include <sys/types.h>
#include <sys/socket.h>

int main()
{
    return socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, 0) == -1;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
  apr_cv_sock_cloexec=yes
else
  apr_cv_sock_cloexec=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_sock_cloexec" >&5
$as_echo "$apr_cv_sock_cloexec" >&6; }

if test "$apr_cv_sock_cloexec" = "yes"; then

$as_echo "#define HAVE_SOCK_CLOEXEC 1" >>confdefs.h

fi

for ac_func in fdatasync
do :
  ac_fn_c_check_func "$LINENO" "fdatasync" "ac_cv_func_fdatasync"
if test "x$ac_cv_func_fdatasync" = xyes; then :
  cat >>confdefs.h <<_ACEOF
#define HAVE_FDATASYNC 1
_ACEOF

fi
done


# test for epoll_create1
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for epoll_create1 support" >&5
$as_echo_n "checking for epoll_create1 support... " >&6; }
if ${apr_cv_epoll_create1+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  apr_cv_epoll_create1=no
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#include <sys/epoll.h>
#include <unistd.h>

int main()
{
    return epoll_create1(0) == -1;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
  apr_cv_epoll_create1=yes
else
  apr_cv_epoll_create1=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_epoll_create1" >&5
$as_echo "$apr_cv_epoll_create1" >&6; }

if test "$apr_cv_epoll_create1" = "yes"; then

$as_echo "#define HAVE_EPOLL_CREATE1 1" >>confdefs.h

fi

# Check for z/OS async i/o support.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for asio -> message queue support" >&5
$as_echo_n "checking for asio -> message queue support... " >&6; }
if ${apr_cv_aio_msgq+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  apr_cv_aio_msgq=no
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#define _AIO_OS390
#include <aio.h>

int main()
{
    struct aiocb a;

    a.aio_notifytype = AIO_MSGQ;  /* use IPC message queue for notification */

    return aio_cancel(2, NULL) == -1;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
  apr_cv_aio_msgq=yes
else
  apr_cv_aio_msgq=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_aio_msgq" >&5
$as_echo "$apr_cv_aio_msgq" >&6; }

if test "$apr_cv_aio_msgq" = "yes"; then

$as_echo "#define HAVE_AIO_MSGQ 1" >>confdefs.h

fi

# test for dup3
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dup3 support" >&5
$as_echo_n "checking for dup3 support... " >&6; }
if ${apr_cv_dup3+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  apr_cv_dup3=no
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#include <unistd.h>

int main()
{
    return dup3(STDOUT_FILENO, STDERR_FILENO, 0) == -1;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
  apr_cv_dup3=yes
else
  apr_cv_dup3=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_dup3" >&5
$as_echo "$apr_cv_dup3" >&6; }

if test "$apr_cv_dup3" = "yes"; then

$as_echo "#define HAVE_DUP3 1" >>confdefs.h

fi

# test for accept4
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for accept4 support" >&5
$as_echo_n "checking for accept4 support... " >&6; }
if ${apr_cv_accept4+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  apr_cv_accept4=no
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <signal.h>
#include <errno.h>

#define A4_SOCK "./apr_accept4_test_socket"

int main()
{
    pid_t pid;
    int fd;
    struct sockaddr_un loc, rem;
    socklen_t rem_sz;

    if ((pid = fork())) {
        int status;

        unlink(A4_SOCK);

        if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
            goto cleanup_failure2;

        loc.sun_family = AF_UNIX;
        strncpy(loc.sun_path, A4_SOCK, sizeof(loc.sun_path) - 1);

        if (bind(fd, (struct sockaddr *) &loc,
                 sizeof(struct sockaddr_un)) == -1)
            goto cleanup_failure;

        if (listen(fd, 5) == -1)
            goto cleanup_failure;

        rem_sz = sizeof(struct sockaddr_un);
        if (accept4(fd, (struct sockaddr *) &rem, &rem_sz, 0) == -1) {
            goto cleanup_failure;
        }
        else {
            close(fd);
            waitpid(pid, &status, 0);
            unlink(A4_SOCK);
            return 0;
        }

cleanup_failure:
        close(fd);
cleanup_failure2:
        kill(pid, SIGKILL);
        waitpid(pid, &status, 0);
        unlink(A4_SOCK);
        return 1;
    }
    else {
        if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
            return 1; /* this will be bad: we'll hang */

        loc.sun_family = AF_UNIX;
        strncpy(loc.sun_path, A4_SOCK, sizeof(loc.sun_path) - 1);

        while(connect(fd, (struct sockaddr *) &loc,
                      sizeof(struct sockaddr_un)) == -1 &&
              (errno==ENOENT || errno==ECONNREFUSED))
            ;

        close(fd);
        return 0;
    }
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
  apr_cv_accept4=yes
else
  apr_cv_accept4=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_accept4" >&5
$as_echo "$apr_cv_accept4" >&6; }

if test "$apr_cv_accept4" = "yes"; then

$as_echo "#define HAVE_ACCEPT4 1" >>confdefs.h

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SOCK_CLOEXEC support" >&5
$as_echo_n "checking for SOCK_CLOEXEC support... " >&6; }
if ${apr_cv_sock_cloexec+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  apr_cv_sock_cloexec=no
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#include <sys/types.h>
#include <sys/socket.h>

int main()
{
    return socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, 0) == -1;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
  apr_cv_sock_cloexec=yes
else
  apr_cv_sock_cloexec=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_sock_cloexec" >&5
$as_echo "$apr_cv_sock_cloexec" >&6; }

if test "$apr_cv_sock_cloexec" = "yes"; then

$as_echo "#define HAVE_SOCK_CLOEXEC 1" >>confdefs.h

fi

for ac_func in getpwnam_r getpwuid_r getgrnam_r getgrgid_r
do :
  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
  cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF

fi
done


echo "${nl}Checking for Shared Memory Support..."

# The real-time POSIX extensions (e.g. shm_*, sem_*) may only
# be available if linking against librt.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing shm_open" >&5
$as_echo_n "checking for library containing shm_open... " >&6; }
if ${ac_cv_search_shm_open+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char shm_open ();
int
main ()
{
return shm_open ();
  ;
  return 0;
}
_ACEOF
for ac_lib in '' rt; do
  if test -z "$ac_lib"; then
    ac_res="none required"
  else
    ac_res=-l$ac_lib
    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
  fi
  if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_search_shm_open=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext
  if ${ac_cv_search_shm_open+:} false; then :
  break
fi
done
if ${ac_cv_search_shm_open+:} false; then :

else
  ac_cv_search_shm_open=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_shm_open" >&5
$as_echo "$ac_cv_search_shm_open" >&6; }
ac_res=$ac_cv_search_shm_open
if test "$ac_res" != no; then :
  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"

fi


case $host in
 *-sysv*)
   ac_includes_default="$ac_includes_default
#if HAVE_SYS_MUTEX_H /* needed to define lock_t for sys/shm.h */
# include <sys/mutex.h>
#endif";;
esac

for ac_header in sys/types.h sys/mman.h sys/ipc.h sys/mutex.h sys/shm.h sys/file.h kernel/OS.h os2.h windows.h
do :
  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
  cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF

fi

done

for ac_func in mmap munmap shm_open shm_unlink shmget shmat shmdt shmctl \
                create_area mprotect
do :
  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
  cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF

fi
done



  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANON in sys/mman.h" >&5
$as_echo_n "checking for MAP_ANON in sys/mman.h... " >&6; }
if ${ac_cv_define_MAP_ANON+:} false; then :
  $as_echo_n "(cached) " >&6
else

    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#include <sys/mman.h>
#ifdef MAP_ANON
YES_IS_DEFINED
#endif

_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  $EGREP "YES_IS_DEFINED" >/dev/null 2>&1; then :
  ac_cv_define_MAP_ANON=yes
else
  ac_cv_define_MAP_ANON=no
fi
rm -f conftest*


fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_define_MAP_ANON" >&5
$as_echo "$ac_cv_define_MAP_ANON" >&6; }
  if test "$ac_cv_define_MAP_ANON" = "yes"; then

$as_echo "#define HAVE_MAP_ANON 1" >>confdefs.h

  fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/zero" >&5
$as_echo_n "checking for /dev/zero... " >&6; }
if ${ac_cv_file__dev_zero+:} false; then :
  $as_echo_n "(cached) " >&6
else
  test "$cross_compiling" = yes &&
  as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
if test -r "/dev/zero"; then
  ac_cv_file__dev_zero=yes
else
  ac_cv_file__dev_zero=no
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_zero" >&5
$as_echo "$ac_cv_file__dev_zero" >&6; }
if test "x$ac_cv_file__dev_zero" = xyes; then :

fi


# Not all systems can mmap /dev/zero (such as HP-UX).  Check for that.
if test "$ac_cv_func_mmap" = "yes" &&
   test "$ac_cv_file__dev_zero" = "yes"; then
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mmap that can map /dev/zero" >&5
$as_echo_n "checking for mmap that can map /dev/zero... " >&6; }
    if test "$cross_compiling" = yes; then :
  ac_cv_file__dev_zero=no
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
    int main()
    {
        int fd;
        void *m;
        fd = open("/dev/zero", O_RDWR);
        if (fd < 0) {
            return 1;
        }
        m = mmap(0, sizeof(void*), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
        if (m == (void *)-1) {  /* aka MAP_FAILED */
            return 2;
        }
        if (munmap(m, sizeof(void*)) < 0) {
            return 3;
        }
        return 0;
    }
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :

else
  ac_cv_file__dev_zero=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi


    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_zero" >&5
$as_echo "$ac_cv_file__dev_zero" >&6; }
fi

# Now we determine which one is our anonymous shmem preference.
haveshmgetanon="0"
havemmapzero="0"
havemmapanon="0"
ac_decision_item='anonymous shared memory allocation method'
ac_decision_msg='FAILED'
ac_decision=''

ac_rc=yes
for ac_spec in header:sys/ipc.h header:sys/shm.h header:sys/file.h              func:shmget func:shmat func:shmdt func:shmctl; do
    ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
    ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
    case $ac_type in
        header )
            ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
            ac_var="ac_cv_header_$ac_item"
            ;;
        file )
            ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
            ac_var="ac_cv_file_$ac_item"
            ;;
        func )   ac_var="ac_cv_func_$ac_item"   ;;
        struct ) ac_var="ac_cv_struct_$ac_item" ;;
        define ) ac_var="ac_cv_define_$ac_item" ;;
        custom ) ac_var="$ac_item" ;;
    esac
    eval "ac_val=\$$ac_var"
    if test ".$ac_val" != .yes; then
        ac_rc=no
        break
    fi
done
if test ".$ac_rc" = .yes; then
    :
    haveshmgetanon="1"

ac_decision='USE_SHMEM_SHMGET_ANON'
ac_decision_msg='SysV IPC shmget()'
ac_decision_USE_SHMEM_SHMGET_ANON=yes
ac_decision_USE_SHMEM_SHMGET_ANON_msg='SysV IPC shmget()'

else
    :

fi

ac_rc=yes
for ac_spec in header:sys/mman.h func:mmap func:munmap file:/dev/zero; do
    ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
    ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
    case $ac_type in
        header )
            ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
            ac_var="ac_cv_header_$ac_item"
            ;;
        file )
            ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
            ac_var="ac_cv_file_$ac_item"
            ;;
        func )   ac_var="ac_cv_func_$ac_item"   ;;
        struct ) ac_var="ac_cv_struct_$ac_item" ;;
        define ) ac_var="ac_cv_define_$ac_item" ;;
        custom ) ac_var="$ac_item" ;;
    esac
    eval "ac_val=\$$ac_var"
    if test ".$ac_val" != .yes; then
        ac_rc=no
        break
    fi
done
if test ".$ac_rc" = .yes; then
    :
    havemmapzero="1"

ac_decision='USE_SHMEM_MMAP_ZERO'
ac_decision_msg='SVR4-style mmap() on /dev/zero'
ac_decision_USE_SHMEM_MMAP_ZERO=yes
ac_decision_USE_SHMEM_MMAP_ZERO_msg='SVR4-style mmap() on /dev/zero'

else
    :

fi

ac_rc=yes
for ac_spec in header:sys/mman.h func:mmap func:munmap define:MAP_ANON; do
    ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
    ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
    case $ac_type in
        header )
            ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
            ac_var="ac_cv_header_$ac_item"
            ;;
        file )
            ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
            ac_var="ac_cv_file_$ac_item"
            ;;
        func )   ac_var="ac_cv_func_$ac_item"   ;;
        struct ) ac_var="ac_cv_struct_$ac_item" ;;
        define ) ac_var="ac_cv_define_$ac_item" ;;
        custom ) ac_var="$ac_item" ;;
    esac
    eval "ac_val=\$$ac_var"
    if test ".$ac_val" != .yes; then
        ac_rc=no
        break
    fi
done
if test ".$ac_rc" = .yes; then
    :
    havemmapanon="1"

ac_decision='USE_SHMEM_MMAP_ANON'
ac_decision_msg='4.4BSD-style mmap() via MAP_ANON'
ac_decision_USE_SHMEM_MMAP_ANON=yes
ac_decision_USE_SHMEM_MMAP_ANON_msg='4.4BSD-style mmap() via MAP_ANON'

else
    :

fi

ac_rc=yes
for ac_spec in header:os2.h; do
    ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
    ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
    case $ac_type in
        header )
            ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
            ac_var="ac_cv_header_$ac_item"
            ;;
        file )
            ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
            ac_var="ac_cv_file_$ac_item"
            ;;
        func )   ac_var="ac_cv_func_$ac_item"   ;;
        struct ) ac_var="ac_cv_struct_$ac_item" ;;
        define ) ac_var="ac_cv_define_$ac_item" ;;
        custom ) ac_var="$ac_item" ;;
    esac
    eval "ac_val=\$$ac_var"
    if test ".$ac_val" != .yes; then
        ac_rc=no
        break
    fi
done
if test ".$ac_rc" = .yes; then
    :
    haveos2shm="1"

ac_decision='USE_SHMEM_OS2_ANON'
ac_decision_msg='OS/2 DosAllocSharedMem()'
ac_decision_USE_SHMEM_OS2_ANON=yes
ac_decision_USE_SHMEM_OS2_ANON_msg='OS/2 DosAllocSharedMem()'

else
    :

fi

ac_rc=yes
for ac_spec in header:kernel/OS.h func:create_area; do
    ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
    ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
    case $ac_type in
        header )
            ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
            ac_var="ac_cv_header_$ac_item"
            ;;
        file )
            ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
            ac_var="ac_cv_file_$ac_item"
            ;;
        func )   ac_var="ac_cv_func_$ac_item"   ;;
        struct ) ac_var="ac_cv_struct_$ac_item" ;;
        define ) ac_var="ac_cv_define_$ac_item" ;;
        custom ) ac_var="$ac_item" ;;
    esac
    eval "ac_val=\$$ac_var"
    if test ".$ac_val" != .yes; then
        ac_rc=no
        break
    fi
done
if test ".$ac_rc" = .yes; then
    :
    havebeosshm="1"

ac_decision='USE_SHMEM_BEOS_ANON'
ac_decision_msg='BeOS areas'
ac_decision_USE_SHMEM_BEOS_ANON=yes
ac_decision_USE_SHMEM_BEOS_ANON_msg='BeOS areas'

else
    :

fi

ac_rc=yes
for ac_spec in header:windows.h func:CreateFileMapping; do
    ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
    ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
    case $ac_type in
        header )
            ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
            ac_var="ac_cv_header_$ac_item"
            ;;
        file )
            ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
            ac_var="ac_cv_file_$ac_item"
            ;;
        func )   ac_var="ac_cv_func_$ac_item"   ;;
        struct ) ac_var="ac_cv_struct_$ac_item" ;;
        define ) ac_var="ac_cv_define_$ac_item" ;;
        custom ) ac_var="$ac_item" ;;
    esac
    eval "ac_val=\$$ac_var"
    if test ".$ac_val" != .yes; then
        ac_rc=no
        break
    fi
done
if test ".$ac_rc" = .yes; then
    :
    havewin32shm="1"

ac_decision='USE_SHMEM_WIN32_ANON'
ac_decision_msg='Windows CreateFileMapping()'
ac_decision_USE_SHMEM_WIN32_ANON=yes
ac_decision_USE_SHMEM_WIN32_ANON_msg='Windows CreateFileMapping()'

else
    :

fi

case $host in
    *linux* )
        # Linux has problems with MM_SHMT_MMANON even though it reports
        # that it has it.
        # FIXME - find exact 2.3 version that MMANON was fixed in.  It is
        # confirmed fixed in 2.4 series.
        if test $os_pre24linux -eq 1; then
            { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabling anon mmap() support for Linux pre-2.4" >&5
$as_echo "$as_me: WARNING: Disabling anon mmap() support for Linux pre-2.4" >&2;}
                ac_decision=''
    for ac_item in USE_SHMEM_MMAP_ZERO USE_SHMEM_SHMGET_ANON; do
         eval "ac_decision_this=\$ac_decision_${ac_item}"
         if test ".$ac_decision_this" = .yes; then
             ac_decision=$ac_item
             eval "ac_decision_msg=\$ac_decision_${ac_item}_msg"
         fi
    done

        fi
        ;;
    *hpux11* )
            ac_decision=''
    for ac_item in USE_SHMEM_SHMGET_ANON; do
         eval "ac_decision_this=\$ac_decision_${ac_item}"
         if test ".$ac_decision_this" = .yes; then
             ac_decision=$ac_item
             eval "ac_decision_msg=\$ac_decision_${ac_item}_msg"
         fi
    done